From 77090180c28f90a98e26662101c14599db233163 Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Thu, 13 Feb 2020 10:39:23 -0800 Subject: [PATCH 001/169] chore: initial library generation --- .../google-cloud-billing/CODE_OF_CONDUCT.md | 43 ++++ packages/google-cloud-billing/CONTRIBUTING.md | 65 ++++++ packages/google-cloud-billing/LICENSE | 202 ++++++++++++++++++ packages/google-cloud-billing/README.md | 95 ++++++++ packages/google-cloud-billing/synth.py | 46 ++++ 5 files changed, 451 insertions(+) create mode 100644 packages/google-cloud-billing/CODE_OF_CONDUCT.md create mode 100644 packages/google-cloud-billing/CONTRIBUTING.md create mode 100644 packages/google-cloud-billing/LICENSE create mode 100644 packages/google-cloud-billing/README.md create mode 100644 packages/google-cloud-billing/synth.py diff --git a/packages/google-cloud-billing/CODE_OF_CONDUCT.md b/packages/google-cloud-billing/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..46b2a08ea6d --- /dev/null +++ b/packages/google-cloud-billing/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/packages/google-cloud-billing/CONTRIBUTING.md b/packages/google-cloud-billing/CONTRIBUTING.md new file mode 100644 index 00000000000..f6c4cf010e3 --- /dev/null +++ b/packages/google-cloud-billing/CONTRIBUTING.md @@ -0,0 +1,65 @@ +# 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. + +## Running the tests + +1. [Prepare your environment for Node.js setup][setup]. + +1. Install dependencies: + + npm install + +1. Run the tests: + + # Run unit tests. + npm test + + # Run sample integration tests. + gcloud auth application-default login + npm run samples-test + + # Run all system tests. + gcloud auth application-default login + npm run system-test + +1. Lint (and maybe fix) any changes: + + npm run fix + +[setup]: https://cloud.google.com/nodejs/docs/setup diff --git a/packages/google-cloud-billing/LICENSE b/packages/google-cloud-billing/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-billing/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-billing/README.md b/packages/google-cloud-billing/README.md new file mode 100644 index 00000000000..27a0ee30919 --- /dev/null +++ b/packages/google-cloud-billing/README.md @@ -0,0 +1,95 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Cloud Billing: Node.js Client](https://github.com/googleapis/nodejs-billing) + +[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![npm version](https://img.shields.io/npm/v/@google-cloud/billing.svg)](https://www.npmjs.org/package/@google-cloud/billing) +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-billing/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-billing) + + + + +Billing client for Node.js + + +* [Cloud Billing Node.js Client API Reference][client-docs] +* [Cloud Billing Documentation][product-docs] +* [github.com/googleapis/nodejs-billing](https://github.com/googleapis/nodejs-billing) + +Read more about the client libraries for Cloud APIs, including the older +Google APIs Client Libraries, in [Client Libraries Explained][explained]. + +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained + +**Table of contents:** + + +* [Quickstart](#quickstart) + * [Before you begin](#before-you-begin) + * [Installing the client library](#installing-the-client-library) + + +* [Versioning](#versioning) +* [Contributing](#contributing) +* [License](#license) + +## Quickstart + +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Cloud Billing 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/billing +``` + + + + + +The [Cloud Billing Node.js Client API Reference][client-docs] documentation +also contains samples. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + + + +This library is considered to be in **beta**. This means it is expected to be +mostly stable while we work toward a general availability release; however, +complete stability is not guaranteed. We will address issues and requests +against beta libraries with a high priority. + + + + +More Information: [Google Cloud Platform Launch Stages][launch_stages] + +[launch_stages]: https://cloud.google.com/terms/launch-stages + +## Contributing + +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-billing/blob/master/CONTRIBUTING.md). + +## License + +Apache Version 2.0 + +See [LICENSE](https://github.com/googleapis/nodejs-billing/blob/master/LICENSE) + +[client-docs]: https://googleapis.dev/nodejs/billing/latest/index.html +[product-docs]: https://cloud.google.com/billing/docs/ +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudbilling.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-billing/synth.py b/packages/google-cloud-billing/synth.py new file mode 100644 index 00000000000..4acc1c852b9 --- /dev/null +++ b/packages/google-cloud-billing/synth.py @@ -0,0 +1,46 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +import synthtool.gcp as gcp +import subprocess +import logging + +logging.basicConfig(level=logging.DEBUG) + +# run the gapic generator +name = 'billing' +gapic = gcp.GAPICMicrogenerator() +versions = ['v1'] +for version in versions: + library = gapic.typescript_library( + name, + proto_path=f'google/cloud/{name}/{version}', + generator_args={ + "grpc-service-config": f"google/cloud/{name}/{version}/cloud_{name}_grpc_service_config.json", + "package-name": f"@google-cloud/{name}", + }, + extra_proto_files=['google/cloud/common_resources.proto'], + version=version) +s.copy(library, excludes=['package.json', 'README.md']) + +# Copy common templates +common_templates = gcp.CommonTemplates() +templates = common_templates.node_library(source_location='build/src') +s.copy(templates, excludes=[]) + +# Node.js specific cleanup +subprocess.run(['npm', 'install']) +subprocess.run(['npm', 'run', 'fix']) From b1e5a2f0330844a2d81aa7eb1526726b67f8a82d Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Thu, 27 Feb 2020 15:33:32 -0800 Subject: [PATCH 002/169] feat!: initial library generation (#1) --- packages/google-cloud-billing/.eslintignore | 5 + packages/google-cloud-billing/.eslintrc.yml | 15 + packages/google-cloud-billing/.gitignore | 14 + packages/google-cloud-billing/.jsdoc.js | 48 + packages/google-cloud-billing/.mocharc.json | 5 + packages/google-cloud-billing/.nycrc | 24 + packages/google-cloud-billing/.prettierignore | 3 + packages/google-cloud-billing/.prettierrc | 8 + .../google-cloud-billing/.repo-metadata.json | 13 + packages/google-cloud-billing/README.md | 42 +- packages/google-cloud-billing/codecov.yaml | 4 + .../linkinator.config.json | 12 + packages/google-cloud-billing/package.json | 56 + .../cloud/billing/v1/cloud_billing.proto | 360 + .../cloud/billing/v1/cloud_catalog.proto | 331 + .../google/cloud/common_resources.proto | 52 + .../google-cloud-billing/protos/protos.d.ts | 7821 ++++++ .../google-cloud-billing/protos/protos.js | 19660 ++++++++++++++++ .../google-cloud-billing/protos/protos.json | 1965 ++ .../google-cloud-billing/samples/README.md | 50 + .../google-cloud-billing/samples/package.json | 23 + .../samples/quickstart.js | 46 + .../samples/test/quickstart.js | 34 + packages/google-cloud-billing/src/index.ts | 25 + .../src/v1/cloud_billing_client.ts | 1353 ++ .../src/v1/cloud_billing_client_config.json | 76 + .../src/v1/cloud_billing_proto_list.json | 4 + .../src/v1/cloud_catalog_client.ts | 653 + .../src/v1/cloud_catalog_client_config.json | 34 + .../src/v1/cloud_catalog_proto_list.json | 4 + packages/google-cloud-billing/src/v1/index.ts | 20 + packages/google-cloud-billing/synth.metadata | 31 + .../system-test/fixtures/sample/src/index.js | 28 + .../system-test/fixtures/sample/src/index.ts | 26 + .../system-test/install.ts | 51 + .../test/gapic-cloud_billing-v1.ts | 585 + .../test/gapic-cloud_catalog-v1.ts | 184 + packages/google-cloud-billing/tsconfig.json | 19 + packages/google-cloud-billing/tslint.json | 3 + .../google-cloud-billing/webpack.config.js | 64 + 40 files changed, 33748 insertions(+), 3 deletions(-) create mode 100644 packages/google-cloud-billing/.eslintignore create mode 100644 packages/google-cloud-billing/.eslintrc.yml create mode 100644 packages/google-cloud-billing/.gitignore create mode 100644 packages/google-cloud-billing/.jsdoc.js create mode 100644 packages/google-cloud-billing/.mocharc.json create mode 100644 packages/google-cloud-billing/.nycrc create mode 100644 packages/google-cloud-billing/.prettierignore create mode 100644 packages/google-cloud-billing/.prettierrc create mode 100644 packages/google-cloud-billing/.repo-metadata.json create mode 100644 packages/google-cloud-billing/codecov.yaml create mode 100644 packages/google-cloud-billing/linkinator.config.json create mode 100644 packages/google-cloud-billing/package.json create mode 100644 packages/google-cloud-billing/protos/google/cloud/billing/v1/cloud_billing.proto create mode 100644 packages/google-cloud-billing/protos/google/cloud/billing/v1/cloud_catalog.proto create mode 100644 packages/google-cloud-billing/protos/google/cloud/common_resources.proto create mode 100644 packages/google-cloud-billing/protos/protos.d.ts create mode 100644 packages/google-cloud-billing/protos/protos.js create mode 100644 packages/google-cloud-billing/protos/protos.json create mode 100644 packages/google-cloud-billing/samples/README.md create mode 100644 packages/google-cloud-billing/samples/package.json create mode 100644 packages/google-cloud-billing/samples/quickstart.js create mode 100644 packages/google-cloud-billing/samples/test/quickstart.js create mode 100644 packages/google-cloud-billing/src/index.ts create mode 100644 packages/google-cloud-billing/src/v1/cloud_billing_client.ts create mode 100644 packages/google-cloud-billing/src/v1/cloud_billing_client_config.json create mode 100644 packages/google-cloud-billing/src/v1/cloud_billing_proto_list.json create mode 100644 packages/google-cloud-billing/src/v1/cloud_catalog_client.ts create mode 100644 packages/google-cloud-billing/src/v1/cloud_catalog_client_config.json create mode 100644 packages/google-cloud-billing/src/v1/cloud_catalog_proto_list.json create mode 100644 packages/google-cloud-billing/src/v1/index.ts create mode 100644 packages/google-cloud-billing/synth.metadata create mode 100644 packages/google-cloud-billing/system-test/fixtures/sample/src/index.js create mode 100644 packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts create mode 100644 packages/google-cloud-billing/system-test/install.ts create mode 100644 packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts create mode 100644 packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts create mode 100644 packages/google-cloud-billing/tsconfig.json create mode 100644 packages/google-cloud-billing/tslint.json create mode 100644 packages/google-cloud-billing/webpack.config.js diff --git a/packages/google-cloud-billing/.eslintignore b/packages/google-cloud-billing/.eslintignore new file mode 100644 index 00000000000..09b31fe735a --- /dev/null +++ b/packages/google-cloud-billing/.eslintignore @@ -0,0 +1,5 @@ +**/node_modules +src/**/doc/* +build/ +docs/ +protos/ diff --git a/packages/google-cloud-billing/.eslintrc.yml b/packages/google-cloud-billing/.eslintrc.yml new file mode 100644 index 00000000000..73eeec27612 --- /dev/null +++ b/packages/google-cloud-billing/.eslintrc.yml @@ -0,0 +1,15 @@ +--- +extends: + - 'eslint:recommended' + - 'plugin:node/recommended' + - prettier +plugins: + - node + - prettier +rules: + prettier/prettier: error + block-scoped-var: error + eqeqeq: error + no-warning-comments: warn + no-var: error + prefer-const: error diff --git a/packages/google-cloud-billing/.gitignore b/packages/google-cloud-billing/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-billing/.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-billing/.jsdoc.js b/packages/google-cloud-billing/.jsdoc.js new file mode 100644 index 00000000000..c6ecbdc9263 --- /dev/null +++ b/packages/google-cloud-billing/.jsdoc.js @@ -0,0 +1,48 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +'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' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2018 Google, LLC.', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/billing', + theme: 'lumen' + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-billing/.mocharc.json b/packages/google-cloud-billing/.mocharc.json new file mode 100644 index 00000000000..670c5e2c24b --- /dev/null +++ b/packages/google-cloud-billing/.mocharc.json @@ -0,0 +1,5 @@ +{ + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} diff --git a/packages/google-cloud-billing/.nycrc b/packages/google-cloud-billing/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /dev/null +++ b/packages/google-cloud-billing/.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-billing/.prettierignore b/packages/google-cloud-billing/.prettierignore new file mode 100644 index 00000000000..f6fac98b0a8 --- /dev/null +++ b/packages/google-cloud-billing/.prettierignore @@ -0,0 +1,3 @@ +node_modules/* +samples/node_modules/* +src/**/doc/* diff --git a/packages/google-cloud-billing/.prettierrc b/packages/google-cloud-billing/.prettierrc new file mode 100644 index 00000000000..df6eac07446 --- /dev/null +++ b/packages/google-cloud-billing/.prettierrc @@ -0,0 +1,8 @@ +--- +bracketSpacing: false +printWidth: 80 +semi: true +singleQuote: true +tabWidth: 2 +trailingComma: es5 +useTabs: false diff --git a/packages/google-cloud-billing/.repo-metadata.json b/packages/google-cloud-billing/.repo-metadata.json new file mode 100644 index 00000000000..155984b5294 --- /dev/null +++ b/packages/google-cloud-billing/.repo-metadata.json @@ -0,0 +1,13 @@ +{ + "name": "billing", + "name_pretty": "Cloud Billing", + "product_documentation": "https://cloud.google.com/billing/docs", + "client_documentation": "https://googleapis.dev/nodejs/billing/latest/index.html", + "issue_tracker": "https://issuetracker.google.com/savedsearches/559770", + "release_level": "beta", + "language": "nodejs", + "repo": "googleapis/nodejs-billing", + "distribution_name": "@google-cloud/billing", + "api_id": "cloudbilling.googleapis.com", + "requires_billing": true +} diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 27a0ee30919..f5371968088 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -29,8 +29,8 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. * [Quickstart](#quickstart) * [Before you begin](#before-you-begin) * [Installing the client library](#installing-the-client-library) - - + * [Using the client library](#using-the-client-library) +* [Samples](#samples) * [Versioning](#versioning) * [Contributing](#contributing) * [License](#license) @@ -52,6 +52,42 @@ npm install @google-cloud/billing ``` +### Using the client library + +```javascript + // Imports the Google Cloud client library + const {CloudBillingClient} = require('@google-cloud/billing'); + + // Creates a client + const client = new CloudBillingClient(); + + // name = 'my-project' // Project name to list billing accounts for. + + async function listBillingAccounts() { + const [accounts] = await client.listBillingAccounts({ + name, + }); + console.info(`found ${accounts.length} billing accounts:`); + for (const account of accounts) { + console.info(`${account.displayName}:`); + console.info(`\topen: ${account.open}`); + console.info(`\tparentBillingAccount: ${account.masterBillingAccount}`); + } + } + listBillingAccounts(); + +``` + + + +## Samples + +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-billing/tree/master/samples) directory. The samples' `README.md` +has instructions for running the samples. + +| Sample | Source Code | Try it | +| --------------------------- | --------------------------------- | ------ | +| Quickstart | [source code](https://github.com/googleapis/nodejs-billing/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-billing&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | @@ -87,7 +123,7 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-billing/blob/master/LICENSE) [client-docs]: https://googleapis.dev/nodejs/billing/latest/index.html -[product-docs]: https://cloud.google.com/billing/docs/ +[product-docs]: https://cloud.google.com/billing/docs [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project [billing]: https://support.google.com/cloud/answer/6293499#enable-billing diff --git a/packages/google-cloud-billing/codecov.yaml b/packages/google-cloud-billing/codecov.yaml new file mode 100644 index 00000000000..5724ea9478d --- /dev/null +++ b/packages/google-cloud-billing/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/packages/google-cloud-billing/linkinator.config.json b/packages/google-cloud-billing/linkinator.config.json new file mode 100644 index 00000000000..acbeb589800 --- /dev/null +++ b/packages/google-cloud-billing/linkinator.config.json @@ -0,0 +1,12 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://googleapis.dev/nodejs/billing/latest/.*", + "https://www.npmjs.org/package/@google-cloud/billing", + "https://github.com/googleapis/nodejs-billing/tree/master/samples", + "https://github.com/googleapis/nodejs-billing/blob/master/samples/quickstart.js" + ] +} diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json new file mode 100644 index 00000000000..ec7b2b74246 --- /dev/null +++ b/packages/google-cloud-billing/package.json @@ -0,0 +1,56 @@ +{ + "name": "@google-cloud/billing", + "version": "0.1.0", + "description": "Billing client for Node.js", + "repository": "googleapis/nodejs-billing", + "license": "Apache-2.0", + "author": "Google LLC", + "files": [ + "build/src", + "build/protos" + ], + "main": "build/src/index.js", + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "docs-test": "linkinator docs", + "fix": "gts fix && eslint samples --fix", + "lint": "gts check && eslint samples", + "prelint": "cd samples; npm link ../; npm i", + "predocs-test": "npm run docs", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test", + "samples-test": "cd samples/ && npm link ../ && npm test && cd ../" + }, + "dependencies": { + "google-gax": "^1.12.0" + }, + "devDependencies": { + "@types/mocha": "^5.2.5", + "@types/node": "^12.0.0", + "c8": "^6.0.0", + "gts": "^1.0.0", + "jsdoc": "^3.5.5", + "jsdoc-fresh": "^1.0.1", + "jsdoc-region-tag": "^1.0.2", + "linkinator": "^1.5.0", + "mocha": "^6.0.0", + "pack-n-play": "^1.0.0-2", + "null-loader": "^3.0.0", + "ts-loader": "^6.2.1", + "typescript": "~3.6.4", + "webpack": "^4.41.2", + "webpack-cli": "^3.3.10", + "eslint": "^6.0.0", + "eslint-config-prettier": "^6.0.0", + "eslint-plugin-node": "^11.0.0", + "eslint-plugin-prettier": "^3.0.1", + "prettier": "^1.17.0" + }, + "engines": { + "node": ">=8.13.0" + } +} diff --git a/packages/google-cloud-billing/protos/google/cloud/billing/v1/cloud_billing.proto b/packages/google-cloud-billing/protos/google/cloud/billing/v1/cloud_billing.proto new file mode 100644 index 00000000000..f0b19d14d13 --- /dev/null +++ b/packages/google-cloud-billing/protos/google/cloud/billing/v1/cloud_billing.proto @@ -0,0 +1,360 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.billing.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/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/v1;billing"; +option java_multiple_files = true; +option java_outer_classname = "CloudBillingProto"; +option java_package = "com.google.cloud.billing.v1"; + +// Retrieves GCP Console billing accounts and associates them with projects. +service CloudBilling { + option (google.api.default_host) = "cloudbilling.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Gets information about a billing account. The current authenticated user + // must be a [viewer of the billing + // account](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc GetBillingAccount(GetBillingAccountRequest) returns (BillingAccount) { + option (google.api.http) = { + get: "/v1/{name=billingAccounts/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists the billing accounts that the current authenticated user has + // permission to + // [view](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc ListBillingAccounts(ListBillingAccountsRequest) returns (ListBillingAccountsResponse) { + option (google.api.http) = { + get: "/v1/billingAccounts" + }; + option (google.api.method_signature) = ""; + } + + // Updates a billing account's fields. + // Currently the only field that can be edited is `display_name`. + // The current authenticated user must have the `billing.accounts.update` + // IAM permission, which is typically given to the + // [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) + // of the billing account. + rpc UpdateBillingAccount(UpdateBillingAccountRequest) returns (BillingAccount) { + option (google.api.http) = { + patch: "/v1/{name=billingAccounts/*}" + body: "account" + }; + option (google.api.method_signature) = "name,account"; + } + + // Creates a billing account. + // This method can only be used to create + // [billing subaccounts](https://cloud.google.com/billing/docs/concepts) + // by GCP resellers. + // When creating a subaccount, the current authenticated user must have the + // `billing.accounts.update` IAM permission on the master account, which is + // typically given to billing account + // [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + // This method will return an error if the master account has not been + // provisioned as a reseller account. + rpc CreateBillingAccount(CreateBillingAccountRequest) returns (BillingAccount) { + option (google.api.http) = { + post: "/v1/billingAccounts" + body: "billing_account" + }; + option (google.api.method_signature) = "billing_account"; + } + + // Lists the projects associated with a billing account. The current + // authenticated user must have the `billing.resourceAssociations.list` IAM + // permission, which is often given to billing account + // [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc ListProjectBillingInfo(ListProjectBillingInfoRequest) returns (ListProjectBillingInfoResponse) { + option (google.api.http) = { + get: "/v1/{name=billingAccounts/*}/projects" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the billing information for a project. The current authenticated user + // must have [permission to view the + // project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + // ). + rpc GetProjectBillingInfo(GetProjectBillingInfoRequest) returns (ProjectBillingInfo) { + option (google.api.http) = { + get: "/v1/{name=projects/*}/billingInfo" + }; + option (google.api.method_signature) = "name"; + } + + // Sets or updates the billing account associated with a project. You specify + // the new billing account by setting the `billing_account_name` in the + // `ProjectBillingInfo` resource to the resource name of a billing account. + // Associating a project with an open billing account enables billing on the + // project and allows charges for resource usage. If the project already had a + // billing account, this method changes the billing account used for resource + // usage charges. + // + // *Note:* Incurred charges that have not yet been reported in the transaction + // history of the GCP Console might be billed to the new billing + // account, even if the charge occurred before the new billing account was + // assigned to the project. + // + // The current authenticated user must have ownership privileges for both the + // [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + // ) and the [billing + // account](https://cloud.google.com/billing/docs/how-to/billing-access). + // + // You can disable billing on the project by setting the + // `billing_account_name` field to empty. This action disassociates the + // current billing account from the project. Any billable activity of your + // in-use services will stop, and your application could stop functioning as + // expected. Any unbilled charges to date will be billed to the previously + // associated account. The current authenticated user must be either an owner + // of the project or an owner of the billing account for the project. + // + // Note that associating a project with a *closed* billing account will have + // much the same effect as disabling billing on the project: any paid + // resources used by the project will be shut down. Thus, unless you wish to + // disable billing, you should always call this method with the name of an + // *open* billing account. + rpc UpdateProjectBillingInfo(UpdateProjectBillingInfoRequest) returns (ProjectBillingInfo) { + option (google.api.http) = { + put: "/v1/{name=projects/*}/billingInfo" + body: "project_billing_info" + }; + option (google.api.method_signature) = "name,project_billing_info"; + } + + // Gets the access control policy for a billing account. + // The caller must have the `billing.accounts.getIamPolicy` permission on the + // account, which is often given to billing account + // [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + get: "/v1/{resource=billingAccounts/*}:getIamPolicy" + }; + option (google.api.method_signature) = "resource"; + } + + // Sets the access control policy for a billing account. Replaces any existing + // policy. + // The caller must have the `billing.accounts.setIamPolicy` permission on the + // account, which is often given to billing account + // [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=billingAccounts/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Tests the access control policy for a billing account. This method takes + // the resource and a set of permissions as input and returns the subset of + // the input permissions that the caller is allowed for that resource. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=billingAccounts/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } +} + +// A billing account in [GCP Console](https://console.cloud.google.com/). +// You can assign a billing account to one or more projects. +message BillingAccount { + // The resource name of the billing account. The resource name has the form + // `billingAccounts/{billing_account_id}`. For example, + // `billingAccounts/012345-567890-ABCDEF` would be the resource name for + // billing account `012345-567890-ABCDEF`. + string name = 1 [(google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + }]; + + // Output only. True if the billing account is open, and will therefore be charged for any + // usage on associated projects. False if the billing account is closed, and + // therefore projects associated with it will be unable to use paid services. + bool open = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The display name given to the billing account, such as `My Billing + // Account`. This name is displayed in the GCP Console. + string display_name = 3; + + // If this account is a + // [subaccount](https://cloud.google.com/billing/docs/concepts), then this + // will be the resource name of the master billing account that it is being + // resold through. + // Otherwise this will be empty. + string master_billing_account = 4; +} + +// Encapsulation of billing information for a GCP Console project. A project +// has at most one associated billing account at a time (but a billing account +// can be assigned to multiple projects). +message ProjectBillingInfo { + // The resource name for the `ProjectBillingInfo`; has the form + // `projects/{project_id}/billingInfo`. For example, the resource name for the + // billing information for project `tokyo-rain-123` would be + // `projects/tokyo-rain-123/billingInfo`. This field is read-only. + string name = 1; + + // The ID of the project that this `ProjectBillingInfo` represents, such as + // `tokyo-rain-123`. This is a convenience field so that you don't need to + // parse the `name` field to obtain a project ID. This field is read-only. + string project_id = 2; + + // The resource name of the billing account associated with the project, if + // any. For example, `billingAccounts/012345-567890-ABCDEF`. + string billing_account_name = 3; + + // True if the project is associated with an open billing account, to which + // usage on the project is charged. False if the project is associated with a + // closed billing account, or no billing account at all, and therefore cannot + // use paid services. This field is read-only. + bool billing_enabled = 4; +} + +// Request message for `GetBillingAccount`. +message GetBillingAccountRequest { + // Required. The resource name of the billing account to retrieve. For example, + // `billingAccounts/012345-567890-ABCDEF`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + } + ]; +} + +// Request message for `ListBillingAccounts`. +message ListBillingAccountsRequest { + // Requested page size. The maximum page size is 100; this is also the + // default. + int32 page_size = 1; + + // A token identifying a page of results to return. This should be a + // `next_page_token` value returned from a previous `ListBillingAccounts` + // call. If unspecified, the first page of results is returned. + string page_token = 2; + + // Options for how to filter the returned billing accounts. + // Currently this only supports filtering for + // [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + // single provided reseller billing account. + // (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + // Boolean algebra and other fields are not currently supported. + string filter = 3; +} + +// Response message for `ListBillingAccounts`. +message ListBillingAccountsResponse { + // A list of billing accounts. + repeated BillingAccount billing_accounts = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListBillingAccounts` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} + +// Request message for `CreateBillingAccount`. +message CreateBillingAccountRequest { + // Required. The billing account resource to create. + // Currently CreateBillingAccount only supports subaccount creation, so + // any created billing accounts must be under a provided master billing + // account. + BillingAccount billing_account = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `UpdateBillingAccount`. +message UpdateBillingAccountRequest { + // Required. The name of the billing account resource to be updated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + } + ]; + + // Required. The billing account resource to replace the resource on the server. + BillingAccount account = 2 [(google.api.field_behavior) = REQUIRED]; + + // The update mask applied to the resource. + // Only "display_name" is currently supported. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for `ListProjectBillingInfo`. +message ListProjectBillingInfoRequest { + // Required. The resource name of the billing account associated with the projects that + // you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + } + ]; + + // Requested page size. The maximum page size is 100; this is also the + // default. + int32 page_size = 2; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous `ListProjectBillingInfo` + // call. If unspecified, the first page of results is returned. + string page_token = 3; +} + +// Request message for `ListProjectBillingInfoResponse`. +message ListProjectBillingInfoResponse { + // A list of `ProjectBillingInfo` resources representing the projects + // associated with the billing account. + repeated ProjectBillingInfo project_billing_info = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListProjectBillingInfo` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} + +// Request message for `GetProjectBillingInfo`. +message GetProjectBillingInfoRequest { + // Required. The resource name of the project for which billing information is + // retrieved. For example, `projects/tokyo-rain-123`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `UpdateProjectBillingInfo`. +message UpdateProjectBillingInfoRequest { + // Required. The resource name of the project associated with the billing information + // that you want to update. For example, `projects/tokyo-rain-123`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The new billing information for the project. Read-only fields are ignored; + // thus, you can leave empty all fields except `billing_account_name`. + ProjectBillingInfo project_billing_info = 2; +} diff --git a/packages/google-cloud-billing/protos/google/cloud/billing/v1/cloud_catalog.proto b/packages/google-cloud-billing/protos/google/cloud/billing/v1/cloud_catalog.proto new file mode 100644 index 00000000000..7bc2f14e3b1 --- /dev/null +++ b/packages/google-cloud-billing/protos/google/cloud/billing/v1/cloud_catalog.proto @@ -0,0 +1,331 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.billing.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/money.proto"; + +option csharp_namespace = "Google.Cloud.Billing.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/v1;billing"; +option java_multiple_files = true; +option java_outer_classname = "CloudCatalogProto"; +option java_package = "com.google.cloud.billing.v1"; +option objc_class_prefix = "CLDCTLG"; + +// A catalog of Google Cloud Platform services and SKUs. +// Provides pricing information and metadata on Google Cloud Platform services +// and SKUs. +service CloudCatalog { + option (google.api.default_host) = "cloudbilling.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all public cloud services. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1/services" + }; + option (google.api.method_signature) = ""; + } + + // Lists all publicly available SKUs for a given cloud service. + rpc ListSkus(ListSkusRequest) returns (ListSkusResponse) { + option (google.api.http) = { + get: "/v1/{parent=services/*}/skus" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Encapsulates a single service in Google Cloud Platform. +message Service { + option (google.api.resource) = { + type: "cloudbilling.googleapis.com/Service" + pattern: "services/{service}" + }; + + // The resource name for the service. + // Example: "services/DA34-426B-A397" + string name = 1; + + // The identifier for the service. + // Example: "DA34-426B-A397" + string service_id = 2; + + // A human readable display name for this service. + string display_name = 3; + + // The business under which the service is offered. + // Ex. "businessEntities/GCP", "businessEntities/Maps" + string business_entity_name = 4; +} + +// Encapsulates a single SKU in Google Cloud Platform +message Sku { + option (google.api.resource) = { + type: "cloudbilling.googleapis.com/Sku" + pattern: "services/{service}/skus/{sku}" + }; + + // The resource name for the SKU. + // Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE" + string name = 1; + + // The identifier for the SKU. + // Example: "AA95-CD31-42FE" + string sku_id = 2; + + // A human readable description of the SKU, has a maximum length of 256 + // characters. + string description = 3; + + // The category hierarchy of this SKU, purely for organizational purpose. + Category category = 4; + + // List of service regions this SKU is offered at. + // Example: "asia-east1" + // Service regions can be found at https://cloud.google.com/about/locations/ + repeated string service_regions = 5; + + // A timeline of pricing info for this SKU in chronological order. + repeated PricingInfo pricing_info = 6; + + // Identifies the service provider. + // This is 'Google' for first party services in Google Cloud Platform. + string service_provider_name = 7; +} + +// Represents the category hierarchy of a SKU. +message Category { + // The display name of the service this SKU belongs to. + string service_display_name = 1; + + // The type of product the SKU refers to. + // Example: "Compute", "Storage", "Network", "ApplicationServices" etc. + string resource_family = 2; + + // A group classification for related SKUs. + // Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc. + string resource_group = 3; + + // Represents how the SKU is consumed. + // Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc. + string usage_type = 4; +} + +// Represents the pricing information for a SKU at a single point of time. +message PricingInfo { + // The timestamp from which this pricing was effective within the requested + // time range. This is guaranteed to be greater than or equal to the + // start_time field in the request and less than the end_time field in the + // request. If a time range was not specified in the request this field will + // be equivalent to a time within the last 12 hours, indicating the latest + // pricing info. + google.protobuf.Timestamp effective_time = 1; + + // An optional human readable summary of the pricing information, has a + // maximum length of 256 characters. + string summary = 2; + + // Expresses the pricing formula. See `PricingExpression` for an example. + PricingExpression pricing_expression = 3; + + // Aggregation Info. This can be left unspecified if the pricing expression + // doesn't require aggregation. + AggregationInfo aggregation_info = 4; + + // Conversion rate used for currency conversion, from USD to the currency + // specified in the request. This includes any surcharge collected for billing + // in non USD currency. If a currency is not specified in the request this + // defaults to 1.0. + // Example: USD * currency_conversion_rate = JPY + double currency_conversion_rate = 5; +} + +// Expresses a mathematical pricing formula. For Example:- +// +// `usage_unit: GBy` +// `tiered_rates:` +// `[start_usage_amount: 20, unit_price: $10]` +// `[start_usage_amount: 100, unit_price: $5]` +// +// The above expresses a pricing formula where the first 20GB is free, the +// next 80GB is priced at $10 per GB followed by $5 per GB for additional +// usage. +message PricingExpression { + // The price rate indicating starting usage and its corresponding price. + message TierRate { + // Usage is priced at this rate only after this amount. + // Example: start_usage_amount of 10 indicates that the usage will be priced + // at the unit_price after the first 10 usage_units. + double start_usage_amount = 1; + + // The price per unit of usage. + // Example: unit_price of amount $10 indicates that each unit will cost $10. + google.type.Money unit_price = 2; + } + + // The short hand for unit of usage this pricing is specified in. + // Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte". + string usage_unit = 1; + + // The unit of usage in human readable form. + // Example: "gibi byte". + string usage_unit_description = 4; + + // The base unit for the SKU which is the unit used in usage exports. + // Example: "By" + string base_unit = 5; + + // The base unit in human readable form. + // Example: "byte". + string base_unit_description = 6; + + // Conversion factor for converting from price per usage_unit to price per + // base_unit, and start_usage_amount to start_usage_amount in base_unit. + // unit_price / base_unit_conversion_factor = price per base_unit. + // start_usage_amount * base_unit_conversion_factor = start_usage_amount in + // base_unit. + double base_unit_conversion_factor = 7; + + // The recommended quantity of units for displaying pricing info. When + // displaying pricing info it is recommended to display: + // (unit_price * display_quantity) per display_quantity usage_unit. + // This field does not affect the pricing formula and is for display purposes + // only. + // Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and + // the display_quantity is "1000" then the recommended way of displaying the + // pricing info is "0.10 USD per 1000 GB" + double display_quantity = 2; + + // The list of tiered rates for this pricing. The total cost is computed by + // applying each of the tiered rates on usage. This repeated list is sorted + // by ascending order of start_usage_amount. + repeated TierRate tiered_rates = 3; +} + +// Represents the aggregation level and interval for pricing of a single SKU. +message AggregationInfo { + // The level at which usage is aggregated to compute cost. + // Example: "ACCOUNT" aggregation level indicates that usage for tiered + // pricing is aggregated across all projects in a single account. + enum AggregationLevel { + AGGREGATION_LEVEL_UNSPECIFIED = 0; + + ACCOUNT = 1; + + PROJECT = 2; + } + + // The interval at which usage is aggregated to compute cost. + // Example: "MONTHLY" aggregation interval indicates that usage for tiered + // pricing is aggregated every month. + enum AggregationInterval { + AGGREGATION_INTERVAL_UNSPECIFIED = 0; + + DAILY = 1; + + MONTHLY = 2; + } + + AggregationLevel aggregation_level = 1; + + AggregationInterval aggregation_interval = 2; + + // The number of intervals to aggregate over. + // Example: If aggregation_level is "DAILY" and aggregation_count is 14, + // aggregation will be over 14 days. + int32 aggregation_count = 3; +} + +// Request message for `ListServices`. +message ListServicesRequest { + // Requested page size. Defaults to 5000. + int32 page_size = 1; + + // A token identifying a page of results to return. This should be a + // `next_page_token` value returned from a previous `ListServices` + // call. If unspecified, the first page of results is returned. + string page_token = 2; +} + +// Response message for `ListServices`. +message ListServicesResponse { + // A list of services. + repeated Service services = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListServices` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} + +// Request message for `ListSkus`. +message ListSkusRequest { + // Required. The name of the service. + // Example: "services/DA34-426B-A397" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/Service" + } + ]; + + // Optional inclusive start time of the time range for which the pricing + // versions will be returned. Timestamps in the future are not allowed. + // The time range has to be within a single calendar month in + // America/Los_Angeles timezone. Time range as a whole is optional. If not + // specified, the latest pricing will be returned (up to 12 hours old at + // most). + google.protobuf.Timestamp start_time = 2; + + // Optional exclusive end time of the time range for which the pricing + // versions will be returned. Timestamps in the future are not allowed. + // The time range has to be within a single calendar month in + // America/Los_Angeles timezone. Time range as a whole is optional. If not + // specified, the latest pricing will be returned (up to 12 hours old at + // most). + google.protobuf.Timestamp end_time = 3; + + // The ISO 4217 currency code for the pricing info in the response proto. + // Will use the conversion rate as of start_time. + // Optional. If not specified USD will be used. + string currency_code = 4; + + // Requested page size. Defaults to 5000. + int32 page_size = 5; + + // A token identifying a page of results to return. This should be a + // `next_page_token` value returned from a previous `ListSkus` + // call. If unspecified, the first page of results is returned. + string page_token = 6; +} + +// Response message for `ListSkus`. +message ListSkusResponse { + // The list of public SKUs of the given service. + repeated Sku skus = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListSkus` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} diff --git a/packages/google-cloud-billing/protos/google/cloud/common_resources.proto b/packages/google-cloud-billing/protos/google/cloud/common_resources.proto new file mode 100644 index 00000000000..56c9f800d5e --- /dev/null +++ b/packages/google-cloud-billing/protos/google/cloud/common_resources.proto @@ -0,0 +1,52 @@ +// 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 file contains stub messages for common resources in GCP. +// It is not intended to be directly generated, and is instead used by +// other tooling to be able to match common resource patterns. +syntax = "proto3"; + +package google.cloud; + +import "google/api/resource.proto"; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Project" + pattern: "projects/{project}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Organization" + pattern: "organizations/{organization}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Folder" + pattern: "folders/{folder}" +}; + + +option (google.api.resource_definition) = { + type: "cloudbilling.googleapis.com/BillingAccount" + pattern: "billingAccounts/{billing_account}" +}; + +option (google.api.resource_definition) = { + type: "locations.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; + diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts new file mode 100644 index 00000000000..faa96400004 --- /dev/null +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -0,0 +1,7821 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import * as Long from "long"; +import * as $protobuf from "protobufjs"; +/** Namespace google. */ +export namespace google { + + /** Namespace cloud. */ + namespace cloud { + + /** Namespace billing. */ + namespace billing { + + /** Namespace v1. */ + namespace v1 { + + /** Represents a CloudBilling */ + class CloudBilling extends $protobuf.rpc.Service { + + /** + * Constructs a new CloudBilling 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 CloudBilling 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): CloudBilling; + + /** + * Calls GetBillingAccount. + * @param request GetBillingAccountRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BillingAccount + */ + public getBillingAccount(request: google.cloud.billing.v1.IGetBillingAccountRequest, callback: google.cloud.billing.v1.CloudBilling.GetBillingAccountCallback): void; + + /** + * Calls GetBillingAccount. + * @param request GetBillingAccountRequest message or plain object + * @returns Promise + */ + public getBillingAccount(request: google.cloud.billing.v1.IGetBillingAccountRequest): Promise; + + /** + * Calls ListBillingAccounts. + * @param request ListBillingAccountsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListBillingAccountsResponse + */ + public listBillingAccounts(request: google.cloud.billing.v1.IListBillingAccountsRequest, callback: google.cloud.billing.v1.CloudBilling.ListBillingAccountsCallback): void; + + /** + * Calls ListBillingAccounts. + * @param request ListBillingAccountsRequest message or plain object + * @returns Promise + */ + public listBillingAccounts(request: google.cloud.billing.v1.IListBillingAccountsRequest): Promise; + + /** + * Calls UpdateBillingAccount. + * @param request UpdateBillingAccountRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BillingAccount + */ + public updateBillingAccount(request: google.cloud.billing.v1.IUpdateBillingAccountRequest, callback: google.cloud.billing.v1.CloudBilling.UpdateBillingAccountCallback): void; + + /** + * Calls UpdateBillingAccount. + * @param request UpdateBillingAccountRequest message or plain object + * @returns Promise + */ + public updateBillingAccount(request: google.cloud.billing.v1.IUpdateBillingAccountRequest): Promise; + + /** + * Calls CreateBillingAccount. + * @param request CreateBillingAccountRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BillingAccount + */ + public createBillingAccount(request: google.cloud.billing.v1.ICreateBillingAccountRequest, callback: google.cloud.billing.v1.CloudBilling.CreateBillingAccountCallback): void; + + /** + * Calls CreateBillingAccount. + * @param request CreateBillingAccountRequest message or plain object + * @returns Promise + */ + public createBillingAccount(request: google.cloud.billing.v1.ICreateBillingAccountRequest): Promise; + + /** + * Calls ListProjectBillingInfo. + * @param request ListProjectBillingInfoRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProjectBillingInfoResponse + */ + public listProjectBillingInfo(request: google.cloud.billing.v1.IListProjectBillingInfoRequest, callback: google.cloud.billing.v1.CloudBilling.ListProjectBillingInfoCallback): void; + + /** + * Calls ListProjectBillingInfo. + * @param request ListProjectBillingInfoRequest message or plain object + * @returns Promise + */ + public listProjectBillingInfo(request: google.cloud.billing.v1.IListProjectBillingInfoRequest): Promise; + + /** + * Calls GetProjectBillingInfo. + * @param request GetProjectBillingInfoRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProjectBillingInfo + */ + public getProjectBillingInfo(request: google.cloud.billing.v1.IGetProjectBillingInfoRequest, callback: google.cloud.billing.v1.CloudBilling.GetProjectBillingInfoCallback): void; + + /** + * Calls GetProjectBillingInfo. + * @param request GetProjectBillingInfoRequest message or plain object + * @returns Promise + */ + public getProjectBillingInfo(request: google.cloud.billing.v1.IGetProjectBillingInfoRequest): Promise; + + /** + * Calls UpdateProjectBillingInfo. + * @param request UpdateProjectBillingInfoRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProjectBillingInfo + */ + public updateProjectBillingInfo(request: google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, callback: google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfoCallback): void; + + /** + * Calls UpdateProjectBillingInfo. + * @param request UpdateProjectBillingInfoRequest message or plain object + * @returns Promise + */ + public updateProjectBillingInfo(request: google.cloud.billing.v1.IUpdateProjectBillingInfoRequest): 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.billing.v1.CloudBilling.GetIamPolicyCallback): void; + + /** + * Calls GetIamPolicy. + * @param request GetIamPolicyRequest message or plain object + * @returns Promise + */ + public getIamPolicy(request: google.iam.v1.IGetIamPolicyRequest): 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.billing.v1.CloudBilling.SetIamPolicyCallback): void; + + /** + * Calls SetIamPolicy. + * @param request SetIamPolicyRequest message or plain object + * @returns Promise + */ + public setIamPolicy(request: google.iam.v1.ISetIamPolicyRequest): 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.billing.v1.CloudBilling.TestIamPermissionsCallback): void; + + /** + * Calls TestIamPermissions. + * @param request TestIamPermissionsRequest message or plain object + * @returns Promise + */ + public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest): Promise; + } + + namespace CloudBilling { + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getBillingAccount}. + * @param error Error, if any + * @param [response] BillingAccount + */ + type GetBillingAccountCallback = (error: (Error|null), response?: google.cloud.billing.v1.BillingAccount) => void; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#listBillingAccounts}. + * @param error Error, if any + * @param [response] ListBillingAccountsResponse + */ + type ListBillingAccountsCallback = (error: (Error|null), response?: google.cloud.billing.v1.ListBillingAccountsResponse) => void; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#updateBillingAccount}. + * @param error Error, if any + * @param [response] BillingAccount + */ + type UpdateBillingAccountCallback = (error: (Error|null), response?: google.cloud.billing.v1.BillingAccount) => void; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#createBillingAccount}. + * @param error Error, if any + * @param [response] BillingAccount + */ + type CreateBillingAccountCallback = (error: (Error|null), response?: google.cloud.billing.v1.BillingAccount) => void; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#listProjectBillingInfo}. + * @param error Error, if any + * @param [response] ListProjectBillingInfoResponse + */ + type ListProjectBillingInfoCallback = (error: (Error|null), response?: google.cloud.billing.v1.ListProjectBillingInfoResponse) => void; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getProjectBillingInfo}. + * @param error Error, if any + * @param [response] ProjectBillingInfo + */ + type GetProjectBillingInfoCallback = (error: (Error|null), response?: google.cloud.billing.v1.ProjectBillingInfo) => void; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#updateProjectBillingInfo}. + * @param error Error, if any + * @param [response] ProjectBillingInfo + */ + type UpdateProjectBillingInfoCallback = (error: (Error|null), response?: google.cloud.billing.v1.ProjectBillingInfo) => void; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#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.billing.v1.CloudBilling#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.billing.v1.CloudBilling#testIamPermissions}. + * @param error Error, if any + * @param [response] TestIamPermissionsResponse + */ + type TestIamPermissionsCallback = (error: (Error|null), response?: google.iam.v1.TestIamPermissionsResponse) => void; + } + + /** Properties of a BillingAccount. */ + interface IBillingAccount { + + /** BillingAccount name */ + name?: (string|null); + + /** BillingAccount open */ + open?: (boolean|null); + + /** BillingAccount displayName */ + displayName?: (string|null); + + /** BillingAccount masterBillingAccount */ + masterBillingAccount?: (string|null); + } + + /** Represents a BillingAccount. */ + class BillingAccount implements IBillingAccount { + + /** + * Constructs a new BillingAccount. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IBillingAccount); + + /** BillingAccount name. */ + public name: string; + + /** BillingAccount open. */ + public open: boolean; + + /** BillingAccount displayName. */ + public displayName: string; + + /** BillingAccount masterBillingAccount. */ + public masterBillingAccount: string; + + /** + * Creates a new BillingAccount instance using the specified properties. + * @param [properties] Properties to set + * @returns BillingAccount instance + */ + public static create(properties?: google.cloud.billing.v1.IBillingAccount): google.cloud.billing.v1.BillingAccount; + + /** + * Encodes the specified BillingAccount message. Does not implicitly {@link google.cloud.billing.v1.BillingAccount.verify|verify} messages. + * @param message BillingAccount message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IBillingAccount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BillingAccount message, length delimited. Does not implicitly {@link google.cloud.billing.v1.BillingAccount.verify|verify} messages. + * @param message BillingAccount message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IBillingAccount, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BillingAccount message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BillingAccount + * @throws {Error} If the payload is not 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.billing.v1.BillingAccount; + + /** + * Decodes a BillingAccount message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BillingAccount + * @throws {Error} If the payload 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.billing.v1.BillingAccount; + + /** + * Verifies a BillingAccount message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BillingAccount message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BillingAccount + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.BillingAccount; + + /** + * Creates a plain object from a BillingAccount message. Also converts values to other types if specified. + * @param message BillingAccount + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.BillingAccount, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BillingAccount to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ProjectBillingInfo. */ + interface IProjectBillingInfo { + + /** ProjectBillingInfo name */ + name?: (string|null); + + /** ProjectBillingInfo projectId */ + projectId?: (string|null); + + /** ProjectBillingInfo billingAccountName */ + billingAccountName?: (string|null); + + /** ProjectBillingInfo billingEnabled */ + billingEnabled?: (boolean|null); + } + + /** Represents a ProjectBillingInfo. */ + class ProjectBillingInfo implements IProjectBillingInfo { + + /** + * Constructs a new ProjectBillingInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IProjectBillingInfo); + + /** ProjectBillingInfo name. */ + public name: string; + + /** ProjectBillingInfo projectId. */ + public projectId: string; + + /** ProjectBillingInfo billingAccountName. */ + public billingAccountName: string; + + /** ProjectBillingInfo billingEnabled. */ + public billingEnabled: boolean; + + /** + * Creates a new ProjectBillingInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ProjectBillingInfo instance + */ + public static create(properties?: google.cloud.billing.v1.IProjectBillingInfo): google.cloud.billing.v1.ProjectBillingInfo; + + /** + * Encodes the specified ProjectBillingInfo message. Does not implicitly {@link google.cloud.billing.v1.ProjectBillingInfo.verify|verify} messages. + * @param message ProjectBillingInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IProjectBillingInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProjectBillingInfo message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ProjectBillingInfo.verify|verify} messages. + * @param message ProjectBillingInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IProjectBillingInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProjectBillingInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProjectBillingInfo + * @throws {Error} If the payload is not 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.billing.v1.ProjectBillingInfo; + + /** + * Decodes a ProjectBillingInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProjectBillingInfo + * @throws {Error} If the payload 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.billing.v1.ProjectBillingInfo; + + /** + * Verifies a ProjectBillingInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ProjectBillingInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProjectBillingInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ProjectBillingInfo; + + /** + * Creates a plain object from a ProjectBillingInfo message. Also converts values to other types if specified. + * @param message ProjectBillingInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ProjectBillingInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProjectBillingInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetBillingAccountRequest. */ + interface IGetBillingAccountRequest { + + /** GetBillingAccountRequest name */ + name?: (string|null); + } + + /** Represents a GetBillingAccountRequest. */ + class GetBillingAccountRequest implements IGetBillingAccountRequest { + + /** + * Constructs a new GetBillingAccountRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IGetBillingAccountRequest); + + /** GetBillingAccountRequest name. */ + public name: string; + + /** + * Creates a new GetBillingAccountRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetBillingAccountRequest instance + */ + public static create(properties?: google.cloud.billing.v1.IGetBillingAccountRequest): google.cloud.billing.v1.GetBillingAccountRequest; + + /** + * Encodes the specified GetBillingAccountRequest message. Does not implicitly {@link google.cloud.billing.v1.GetBillingAccountRequest.verify|verify} messages. + * @param message GetBillingAccountRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IGetBillingAccountRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetBillingAccountRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.GetBillingAccountRequest.verify|verify} messages. + * @param message GetBillingAccountRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IGetBillingAccountRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetBillingAccountRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetBillingAccountRequest + * @throws {Error} If the payload is not 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.billing.v1.GetBillingAccountRequest; + + /** + * Decodes a GetBillingAccountRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetBillingAccountRequest + * @throws {Error} If the payload 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.billing.v1.GetBillingAccountRequest; + + /** + * Verifies a GetBillingAccountRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetBillingAccountRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetBillingAccountRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.GetBillingAccountRequest; + + /** + * Creates a plain object from a GetBillingAccountRequest message. Also converts values to other types if specified. + * @param message GetBillingAccountRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.GetBillingAccountRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetBillingAccountRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListBillingAccountsRequest. */ + interface IListBillingAccountsRequest { + + /** ListBillingAccountsRequest pageSize */ + pageSize?: (number|null); + + /** ListBillingAccountsRequest pageToken */ + pageToken?: (string|null); + + /** ListBillingAccountsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListBillingAccountsRequest. */ + class ListBillingAccountsRequest implements IListBillingAccountsRequest { + + /** + * Constructs a new ListBillingAccountsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IListBillingAccountsRequest); + + /** ListBillingAccountsRequest pageSize. */ + public pageSize: number; + + /** ListBillingAccountsRequest pageToken. */ + public pageToken: string; + + /** ListBillingAccountsRequest filter. */ + public filter: string; + + /** + * Creates a new ListBillingAccountsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBillingAccountsRequest instance + */ + public static create(properties?: google.cloud.billing.v1.IListBillingAccountsRequest): google.cloud.billing.v1.ListBillingAccountsRequest; + + /** + * Encodes the specified ListBillingAccountsRequest message. Does not implicitly {@link google.cloud.billing.v1.ListBillingAccountsRequest.verify|verify} messages. + * @param message ListBillingAccountsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IListBillingAccountsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBillingAccountsRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListBillingAccountsRequest.verify|verify} messages. + * @param message ListBillingAccountsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IListBillingAccountsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBillingAccountsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBillingAccountsRequest + * @throws {Error} If the payload is not 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.billing.v1.ListBillingAccountsRequest; + + /** + * Decodes a ListBillingAccountsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBillingAccountsRequest + * @throws {Error} If the payload 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.billing.v1.ListBillingAccountsRequest; + + /** + * Verifies a ListBillingAccountsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBillingAccountsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBillingAccountsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ListBillingAccountsRequest; + + /** + * Creates a plain object from a ListBillingAccountsRequest message. Also converts values to other types if specified. + * @param message ListBillingAccountsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ListBillingAccountsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBillingAccountsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListBillingAccountsResponse. */ + interface IListBillingAccountsResponse { + + /** ListBillingAccountsResponse billingAccounts */ + billingAccounts?: (google.cloud.billing.v1.IBillingAccount[]|null); + + /** ListBillingAccountsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListBillingAccountsResponse. */ + class ListBillingAccountsResponse implements IListBillingAccountsResponse { + + /** + * Constructs a new ListBillingAccountsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IListBillingAccountsResponse); + + /** ListBillingAccountsResponse billingAccounts. */ + public billingAccounts: google.cloud.billing.v1.IBillingAccount[]; + + /** ListBillingAccountsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListBillingAccountsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBillingAccountsResponse instance + */ + public static create(properties?: google.cloud.billing.v1.IListBillingAccountsResponse): google.cloud.billing.v1.ListBillingAccountsResponse; + + /** + * Encodes the specified ListBillingAccountsResponse message. Does not implicitly {@link google.cloud.billing.v1.ListBillingAccountsResponse.verify|verify} messages. + * @param message ListBillingAccountsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IListBillingAccountsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBillingAccountsResponse message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListBillingAccountsResponse.verify|verify} messages. + * @param message ListBillingAccountsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IListBillingAccountsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBillingAccountsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBillingAccountsResponse + * @throws {Error} If the payload is not 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.billing.v1.ListBillingAccountsResponse; + + /** + * Decodes a ListBillingAccountsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBillingAccountsResponse + * @throws {Error} If the payload 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.billing.v1.ListBillingAccountsResponse; + + /** + * Verifies a ListBillingAccountsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBillingAccountsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBillingAccountsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ListBillingAccountsResponse; + + /** + * Creates a plain object from a ListBillingAccountsResponse message. Also converts values to other types if specified. + * @param message ListBillingAccountsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ListBillingAccountsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBillingAccountsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateBillingAccountRequest. */ + interface ICreateBillingAccountRequest { + + /** CreateBillingAccountRequest billingAccount */ + billingAccount?: (google.cloud.billing.v1.IBillingAccount|null); + } + + /** Represents a CreateBillingAccountRequest. */ + class CreateBillingAccountRequest implements ICreateBillingAccountRequest { + + /** + * Constructs a new CreateBillingAccountRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.ICreateBillingAccountRequest); + + /** CreateBillingAccountRequest billingAccount. */ + public billingAccount?: (google.cloud.billing.v1.IBillingAccount|null); + + /** + * Creates a new CreateBillingAccountRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateBillingAccountRequest instance + */ + public static create(properties?: google.cloud.billing.v1.ICreateBillingAccountRequest): google.cloud.billing.v1.CreateBillingAccountRequest; + + /** + * Encodes the specified CreateBillingAccountRequest message. Does not implicitly {@link google.cloud.billing.v1.CreateBillingAccountRequest.verify|verify} messages. + * @param message CreateBillingAccountRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.ICreateBillingAccountRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateBillingAccountRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.CreateBillingAccountRequest.verify|verify} messages. + * @param message CreateBillingAccountRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.ICreateBillingAccountRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateBillingAccountRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateBillingAccountRequest + * @throws {Error} If the payload is not 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.billing.v1.CreateBillingAccountRequest; + + /** + * Decodes a CreateBillingAccountRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateBillingAccountRequest + * @throws {Error} If the payload 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.billing.v1.CreateBillingAccountRequest; + + /** + * Verifies a CreateBillingAccountRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateBillingAccountRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateBillingAccountRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.CreateBillingAccountRequest; + + /** + * Creates a plain object from a CreateBillingAccountRequest message. Also converts values to other types if specified. + * @param message CreateBillingAccountRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.CreateBillingAccountRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateBillingAccountRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateBillingAccountRequest. */ + interface IUpdateBillingAccountRequest { + + /** UpdateBillingAccountRequest name */ + name?: (string|null); + + /** UpdateBillingAccountRequest account */ + account?: (google.cloud.billing.v1.IBillingAccount|null); + + /** UpdateBillingAccountRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateBillingAccountRequest. */ + class UpdateBillingAccountRequest implements IUpdateBillingAccountRequest { + + /** + * Constructs a new UpdateBillingAccountRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IUpdateBillingAccountRequest); + + /** UpdateBillingAccountRequest name. */ + public name: string; + + /** UpdateBillingAccountRequest account. */ + public account?: (google.cloud.billing.v1.IBillingAccount|null); + + /** UpdateBillingAccountRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateBillingAccountRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateBillingAccountRequest instance + */ + public static create(properties?: google.cloud.billing.v1.IUpdateBillingAccountRequest): google.cloud.billing.v1.UpdateBillingAccountRequest; + + /** + * Encodes the specified UpdateBillingAccountRequest message. Does not implicitly {@link google.cloud.billing.v1.UpdateBillingAccountRequest.verify|verify} messages. + * @param message UpdateBillingAccountRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IUpdateBillingAccountRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateBillingAccountRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.UpdateBillingAccountRequest.verify|verify} messages. + * @param message UpdateBillingAccountRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IUpdateBillingAccountRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateBillingAccountRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateBillingAccountRequest + * @throws {Error} If the payload is not 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.billing.v1.UpdateBillingAccountRequest; + + /** + * Decodes an UpdateBillingAccountRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateBillingAccountRequest + * @throws {Error} If the payload 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.billing.v1.UpdateBillingAccountRequest; + + /** + * Verifies an UpdateBillingAccountRequest message. + * @param message Plain 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 UpdateBillingAccountRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateBillingAccountRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.UpdateBillingAccountRequest; + + /** + * Creates a plain object from an UpdateBillingAccountRequest message. Also converts values to other types if specified. + * @param message UpdateBillingAccountRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.UpdateBillingAccountRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateBillingAccountRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProjectBillingInfoRequest. */ + interface IListProjectBillingInfoRequest { + + /** ListProjectBillingInfoRequest name */ + name?: (string|null); + + /** ListProjectBillingInfoRequest pageSize */ + pageSize?: (number|null); + + /** ListProjectBillingInfoRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListProjectBillingInfoRequest. */ + class ListProjectBillingInfoRequest implements IListProjectBillingInfoRequest { + + /** + * Constructs a new ListProjectBillingInfoRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IListProjectBillingInfoRequest); + + /** ListProjectBillingInfoRequest name. */ + public name: string; + + /** ListProjectBillingInfoRequest pageSize. */ + public pageSize: number; + + /** ListProjectBillingInfoRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListProjectBillingInfoRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProjectBillingInfoRequest instance + */ + public static create(properties?: google.cloud.billing.v1.IListProjectBillingInfoRequest): google.cloud.billing.v1.ListProjectBillingInfoRequest; + + /** + * Encodes the specified ListProjectBillingInfoRequest message. Does not implicitly {@link google.cloud.billing.v1.ListProjectBillingInfoRequest.verify|verify} messages. + * @param message ListProjectBillingInfoRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IListProjectBillingInfoRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProjectBillingInfoRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListProjectBillingInfoRequest.verify|verify} messages. + * @param message ListProjectBillingInfoRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IListProjectBillingInfoRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProjectBillingInfoRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProjectBillingInfoRequest + * @throws {Error} If the payload is not 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.billing.v1.ListProjectBillingInfoRequest; + + /** + * Decodes a ListProjectBillingInfoRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProjectBillingInfoRequest + * @throws {Error} If the payload 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.billing.v1.ListProjectBillingInfoRequest; + + /** + * Verifies a ListProjectBillingInfoRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProjectBillingInfoRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProjectBillingInfoRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ListProjectBillingInfoRequest; + + /** + * Creates a plain object from a ListProjectBillingInfoRequest message. Also converts values to other types if specified. + * @param message ListProjectBillingInfoRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ListProjectBillingInfoRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProjectBillingInfoRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProjectBillingInfoResponse. */ + interface IListProjectBillingInfoResponse { + + /** ListProjectBillingInfoResponse projectBillingInfo */ + projectBillingInfo?: (google.cloud.billing.v1.IProjectBillingInfo[]|null); + + /** ListProjectBillingInfoResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProjectBillingInfoResponse. */ + class ListProjectBillingInfoResponse implements IListProjectBillingInfoResponse { + + /** + * Constructs a new ListProjectBillingInfoResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IListProjectBillingInfoResponse); + + /** ListProjectBillingInfoResponse projectBillingInfo. */ + public projectBillingInfo: google.cloud.billing.v1.IProjectBillingInfo[]; + + /** ListProjectBillingInfoResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProjectBillingInfoResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProjectBillingInfoResponse instance + */ + public static create(properties?: google.cloud.billing.v1.IListProjectBillingInfoResponse): google.cloud.billing.v1.ListProjectBillingInfoResponse; + + /** + * Encodes the specified ListProjectBillingInfoResponse message. Does not implicitly {@link google.cloud.billing.v1.ListProjectBillingInfoResponse.verify|verify} messages. + * @param message ListProjectBillingInfoResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IListProjectBillingInfoResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProjectBillingInfoResponse message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListProjectBillingInfoResponse.verify|verify} messages. + * @param message ListProjectBillingInfoResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IListProjectBillingInfoResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProjectBillingInfoResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProjectBillingInfoResponse + * @throws {Error} If the payload is not 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.billing.v1.ListProjectBillingInfoResponse; + + /** + * Decodes a ListProjectBillingInfoResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProjectBillingInfoResponse + * @throws {Error} If the payload 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.billing.v1.ListProjectBillingInfoResponse; + + /** + * Verifies a ListProjectBillingInfoResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListProjectBillingInfoResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProjectBillingInfoResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ListProjectBillingInfoResponse; + + /** + * Creates a plain object from a ListProjectBillingInfoResponse message. Also converts values to other types if specified. + * @param message ListProjectBillingInfoResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ListProjectBillingInfoResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProjectBillingInfoResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProjectBillingInfoRequest. */ + interface IGetProjectBillingInfoRequest { + + /** GetProjectBillingInfoRequest name */ + name?: (string|null); + } + + /** Represents a GetProjectBillingInfoRequest. */ + class GetProjectBillingInfoRequest implements IGetProjectBillingInfoRequest { + + /** + * Constructs a new GetProjectBillingInfoRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IGetProjectBillingInfoRequest); + + /** GetProjectBillingInfoRequest name. */ + public name: string; + + /** + * Creates a new GetProjectBillingInfoRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProjectBillingInfoRequest instance + */ + public static create(properties?: google.cloud.billing.v1.IGetProjectBillingInfoRequest): google.cloud.billing.v1.GetProjectBillingInfoRequest; + + /** + * Encodes the specified GetProjectBillingInfoRequest message. Does not implicitly {@link google.cloud.billing.v1.GetProjectBillingInfoRequest.verify|verify} messages. + * @param message GetProjectBillingInfoRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IGetProjectBillingInfoRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProjectBillingInfoRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.GetProjectBillingInfoRequest.verify|verify} messages. + * @param message GetProjectBillingInfoRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IGetProjectBillingInfoRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProjectBillingInfoRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProjectBillingInfoRequest + * @throws {Error} If the payload is not 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.billing.v1.GetProjectBillingInfoRequest; + + /** + * Decodes a GetProjectBillingInfoRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProjectBillingInfoRequest + * @throws {Error} If the payload 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.billing.v1.GetProjectBillingInfoRequest; + + /** + * Verifies a GetProjectBillingInfoRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetProjectBillingInfoRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProjectBillingInfoRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.GetProjectBillingInfoRequest; + + /** + * Creates a plain object from a GetProjectBillingInfoRequest message. Also converts values to other types if specified. + * @param message GetProjectBillingInfoRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.GetProjectBillingInfoRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProjectBillingInfoRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UpdateProjectBillingInfoRequest. */ + interface IUpdateProjectBillingInfoRequest { + + /** UpdateProjectBillingInfoRequest name */ + name?: (string|null); + + /** UpdateProjectBillingInfoRequest projectBillingInfo */ + projectBillingInfo?: (google.cloud.billing.v1.IProjectBillingInfo|null); + } + + /** Represents an UpdateProjectBillingInfoRequest. */ + class UpdateProjectBillingInfoRequest implements IUpdateProjectBillingInfoRequest { + + /** + * Constructs a new UpdateProjectBillingInfoRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IUpdateProjectBillingInfoRequest); + + /** UpdateProjectBillingInfoRequest name. */ + public name: string; + + /** UpdateProjectBillingInfoRequest projectBillingInfo. */ + public projectBillingInfo?: (google.cloud.billing.v1.IProjectBillingInfo|null); + + /** + * Creates a new UpdateProjectBillingInfoRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateProjectBillingInfoRequest instance + */ + public static create(properties?: google.cloud.billing.v1.IUpdateProjectBillingInfoRequest): google.cloud.billing.v1.UpdateProjectBillingInfoRequest; + + /** + * Encodes the specified UpdateProjectBillingInfoRequest message. Does not implicitly {@link google.cloud.billing.v1.UpdateProjectBillingInfoRequest.verify|verify} messages. + * @param message UpdateProjectBillingInfoRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateProjectBillingInfoRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.UpdateProjectBillingInfoRequest.verify|verify} messages. + * @param message UpdateProjectBillingInfoRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateProjectBillingInfoRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateProjectBillingInfoRequest + * @throws {Error} If the payload is not 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.billing.v1.UpdateProjectBillingInfoRequest; + + /** + * Decodes an UpdateProjectBillingInfoRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateProjectBillingInfoRequest + * @throws {Error} If the payload 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.billing.v1.UpdateProjectBillingInfoRequest; + + /** + * Verifies an UpdateProjectBillingInfoRequest message. + * @param message Plain 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 UpdateProjectBillingInfoRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateProjectBillingInfoRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.UpdateProjectBillingInfoRequest; + + /** + * Creates a plain object from an UpdateProjectBillingInfoRequest message. Also converts values to other types if specified. + * @param message UpdateProjectBillingInfoRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.UpdateProjectBillingInfoRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateProjectBillingInfoRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Represents a CloudCatalog */ + class CloudCatalog extends $protobuf.rpc.Service { + + /** + * Constructs a new CloudCatalog 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 CloudCatalog 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): CloudCatalog; + + /** + * Calls ListServices. + * @param request ListServicesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListServicesResponse + */ + public listServices(request: google.cloud.billing.v1.IListServicesRequest, callback: google.cloud.billing.v1.CloudCatalog.ListServicesCallback): void; + + /** + * Calls ListServices. + * @param request ListServicesRequest message or plain object + * @returns Promise + */ + public listServices(request: google.cloud.billing.v1.IListServicesRequest): Promise; + + /** + * Calls ListSkus. + * @param request ListSkusRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSkusResponse + */ + public listSkus(request: google.cloud.billing.v1.IListSkusRequest, callback: google.cloud.billing.v1.CloudCatalog.ListSkusCallback): void; + + /** + * Calls ListSkus. + * @param request ListSkusRequest message or plain object + * @returns Promise + */ + public listSkus(request: google.cloud.billing.v1.IListSkusRequest): Promise; + } + + namespace CloudCatalog { + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudCatalog#listServices}. + * @param error Error, if any + * @param [response] ListServicesResponse + */ + type ListServicesCallback = (error: (Error|null), response?: google.cloud.billing.v1.ListServicesResponse) => void; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudCatalog#listSkus}. + * @param error Error, if any + * @param [response] ListSkusResponse + */ + type ListSkusCallback = (error: (Error|null), response?: google.cloud.billing.v1.ListSkusResponse) => void; + } + + /** Properties of a Service. */ + interface IService { + + /** Service name */ + name?: (string|null); + + /** Service serviceId */ + serviceId?: (string|null); + + /** Service displayName */ + displayName?: (string|null); + + /** Service businessEntityName */ + businessEntityName?: (string|null); + } + + /** Represents a Service. */ + class Service implements IService { + + /** + * Constructs a new Service. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IService); + + /** Service name. */ + public name: string; + + /** Service serviceId. */ + public serviceId: string; + + /** Service displayName. */ + public displayName: string; + + /** Service businessEntityName. */ + public businessEntityName: string; + + /** + * Creates a new Service instance using the specified properties. + * @param [properties] Properties to set + * @returns Service instance + */ + public static create(properties?: google.cloud.billing.v1.IService): google.cloud.billing.v1.Service; + + /** + * Encodes the specified Service message. Does not implicitly {@link google.cloud.billing.v1.Service.verify|verify} messages. + * @param message Service message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Service message, length delimited. Does not implicitly {@link google.cloud.billing.v1.Service.verify|verify} messages. + * @param message Service message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Service message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Service + * @throws {Error} If the payload is not 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.billing.v1.Service; + + /** + * Decodes a Service message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Service + * @throws {Error} If the payload 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.billing.v1.Service; + + /** + * Verifies a Service message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Service message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Service + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.Service; + + /** + * Creates a plain object from a Service message. Also converts values to other types if specified. + * @param message Service + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.Service, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Service to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Sku. */ + interface ISku { + + /** Sku name */ + name?: (string|null); + + /** Sku skuId */ + skuId?: (string|null); + + /** Sku description */ + description?: (string|null); + + /** Sku category */ + category?: (google.cloud.billing.v1.ICategory|null); + + /** Sku serviceRegions */ + serviceRegions?: (string[]|null); + + /** Sku pricingInfo */ + pricingInfo?: (google.cloud.billing.v1.IPricingInfo[]|null); + + /** Sku serviceProviderName */ + serviceProviderName?: (string|null); + } + + /** Represents a Sku. */ + class Sku implements ISku { + + /** + * Constructs a new Sku. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.ISku); + + /** Sku name. */ + public name: string; + + /** Sku skuId. */ + public skuId: string; + + /** Sku description. */ + public description: string; + + /** Sku category. */ + public category?: (google.cloud.billing.v1.ICategory|null); + + /** Sku serviceRegions. */ + public serviceRegions: string[]; + + /** Sku pricingInfo. */ + public pricingInfo: google.cloud.billing.v1.IPricingInfo[]; + + /** Sku serviceProviderName. */ + public serviceProviderName: string; + + /** + * Creates a new Sku instance using the specified properties. + * @param [properties] Properties to set + * @returns Sku instance + */ + public static create(properties?: google.cloud.billing.v1.ISku): google.cloud.billing.v1.Sku; + + /** + * Encodes the specified Sku message. Does not implicitly {@link google.cloud.billing.v1.Sku.verify|verify} messages. + * @param message Sku message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.ISku, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Sku message, length delimited. Does not implicitly {@link google.cloud.billing.v1.Sku.verify|verify} messages. + * @param message Sku message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.ISku, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Sku message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Sku + * @throws {Error} If the payload is not 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.billing.v1.Sku; + + /** + * Decodes a Sku message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Sku + * @throws {Error} If the payload 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.billing.v1.Sku; + + /** + * Verifies a Sku message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Sku message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Sku + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.Sku; + + /** + * Creates a plain object from a Sku message. Also converts values to other types if specified. + * @param message Sku + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.Sku, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Sku to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Category. */ + interface ICategory { + + /** Category serviceDisplayName */ + serviceDisplayName?: (string|null); + + /** Category resourceFamily */ + resourceFamily?: (string|null); + + /** Category resourceGroup */ + resourceGroup?: (string|null); + + /** Category usageType */ + usageType?: (string|null); + } + + /** Represents a Category. */ + class Category implements ICategory { + + /** + * Constructs a new Category. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.ICategory); + + /** Category serviceDisplayName. */ + public serviceDisplayName: string; + + /** Category resourceFamily. */ + public resourceFamily: string; + + /** Category resourceGroup. */ + public resourceGroup: string; + + /** Category usageType. */ + public usageType: string; + + /** + * Creates a new Category instance using the specified properties. + * @param [properties] Properties to set + * @returns Category instance + */ + public static create(properties?: google.cloud.billing.v1.ICategory): google.cloud.billing.v1.Category; + + /** + * Encodes the specified Category message. Does not implicitly {@link google.cloud.billing.v1.Category.verify|verify} messages. + * @param message Category message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.ICategory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Category message, length delimited. Does not implicitly {@link google.cloud.billing.v1.Category.verify|verify} messages. + * @param message Category message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.ICategory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Category message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Category + * @throws {Error} If the payload is not 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.billing.v1.Category; + + /** + * Decodes a Category message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Category + * @throws {Error} If the payload 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.billing.v1.Category; + + /** + * Verifies a Category message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Category message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Category + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.Category; + + /** + * Creates a plain object from a Category message. Also converts values to other types if specified. + * @param message Category + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.Category, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Category to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PricingInfo. */ + interface IPricingInfo { + + /** PricingInfo effectiveTime */ + effectiveTime?: (google.protobuf.ITimestamp|null); + + /** PricingInfo summary */ + summary?: (string|null); + + /** PricingInfo pricingExpression */ + pricingExpression?: (google.cloud.billing.v1.IPricingExpression|null); + + /** PricingInfo aggregationInfo */ + aggregationInfo?: (google.cloud.billing.v1.IAggregationInfo|null); + + /** PricingInfo currencyConversionRate */ + currencyConversionRate?: (number|null); + } + + /** Represents a PricingInfo. */ + class PricingInfo implements IPricingInfo { + + /** + * Constructs a new PricingInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IPricingInfo); + + /** PricingInfo effectiveTime. */ + public effectiveTime?: (google.protobuf.ITimestamp|null); + + /** PricingInfo summary. */ + public summary: string; + + /** PricingInfo pricingExpression. */ + public pricingExpression?: (google.cloud.billing.v1.IPricingExpression|null); + + /** PricingInfo aggregationInfo. */ + public aggregationInfo?: (google.cloud.billing.v1.IAggregationInfo|null); + + /** PricingInfo currencyConversionRate. */ + public currencyConversionRate: number; + + /** + * Creates a new PricingInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns PricingInfo instance + */ + public static create(properties?: google.cloud.billing.v1.IPricingInfo): google.cloud.billing.v1.PricingInfo; + + /** + * Encodes the specified PricingInfo message. Does not implicitly {@link google.cloud.billing.v1.PricingInfo.verify|verify} messages. + * @param message PricingInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IPricingInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PricingInfo message, length delimited. Does not implicitly {@link google.cloud.billing.v1.PricingInfo.verify|verify} messages. + * @param message PricingInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IPricingInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PricingInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PricingInfo + * @throws {Error} If the payload is not 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.billing.v1.PricingInfo; + + /** + * Decodes a PricingInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PricingInfo + * @throws {Error} If the payload 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.billing.v1.PricingInfo; + + /** + * Verifies a PricingInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PricingInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PricingInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.PricingInfo; + + /** + * Creates a plain object from a PricingInfo message. Also converts values to other types if specified. + * @param message PricingInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.PricingInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PricingInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PricingExpression. */ + interface IPricingExpression { + + /** PricingExpression usageUnit */ + usageUnit?: (string|null); + + /** PricingExpression usageUnitDescription */ + usageUnitDescription?: (string|null); + + /** PricingExpression baseUnit */ + baseUnit?: (string|null); + + /** PricingExpression baseUnitDescription */ + baseUnitDescription?: (string|null); + + /** PricingExpression baseUnitConversionFactor */ + baseUnitConversionFactor?: (number|null); + + /** PricingExpression displayQuantity */ + displayQuantity?: (number|null); + + /** PricingExpression tieredRates */ + tieredRates?: (google.cloud.billing.v1.PricingExpression.ITierRate[]|null); + } + + /** Represents a PricingExpression. */ + class PricingExpression implements IPricingExpression { + + /** + * Constructs a new PricingExpression. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IPricingExpression); + + /** PricingExpression usageUnit. */ + public usageUnit: string; + + /** PricingExpression usageUnitDescription. */ + public usageUnitDescription: string; + + /** PricingExpression baseUnit. */ + public baseUnit: string; + + /** PricingExpression baseUnitDescription. */ + public baseUnitDescription: string; + + /** PricingExpression baseUnitConversionFactor. */ + public baseUnitConversionFactor: number; + + /** PricingExpression displayQuantity. */ + public displayQuantity: number; + + /** PricingExpression tieredRates. */ + public tieredRates: google.cloud.billing.v1.PricingExpression.ITierRate[]; + + /** + * Creates a new PricingExpression instance using the specified properties. + * @param [properties] Properties to set + * @returns PricingExpression instance + */ + public static create(properties?: google.cloud.billing.v1.IPricingExpression): google.cloud.billing.v1.PricingExpression; + + /** + * Encodes the specified PricingExpression message. Does not implicitly {@link google.cloud.billing.v1.PricingExpression.verify|verify} messages. + * @param message PricingExpression message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IPricingExpression, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PricingExpression message, length delimited. Does not implicitly {@link google.cloud.billing.v1.PricingExpression.verify|verify} messages. + * @param message PricingExpression message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IPricingExpression, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PricingExpression message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PricingExpression + * @throws {Error} If the payload is not 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.billing.v1.PricingExpression; + + /** + * Decodes a PricingExpression message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PricingExpression + * @throws {Error} If the payload 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.billing.v1.PricingExpression; + + /** + * Verifies a PricingExpression message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PricingExpression message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PricingExpression + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.PricingExpression; + + /** + * Creates a plain object from a PricingExpression message. Also converts values to other types if specified. + * @param message PricingExpression + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.PricingExpression, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PricingExpression to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace PricingExpression { + + /** Properties of a TierRate. */ + interface ITierRate { + + /** TierRate startUsageAmount */ + startUsageAmount?: (number|null); + + /** TierRate unitPrice */ + unitPrice?: (google.type.IMoney|null); + } + + /** Represents a TierRate. */ + class TierRate implements ITierRate { + + /** + * Constructs a new TierRate. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.PricingExpression.ITierRate); + + /** TierRate startUsageAmount. */ + public startUsageAmount: number; + + /** TierRate unitPrice. */ + public unitPrice?: (google.type.IMoney|null); + + /** + * Creates a new TierRate instance using the specified properties. + * @param [properties] Properties to set + * @returns TierRate instance + */ + public static create(properties?: google.cloud.billing.v1.PricingExpression.ITierRate): google.cloud.billing.v1.PricingExpression.TierRate; + + /** + * Encodes the specified TierRate message. Does not implicitly {@link google.cloud.billing.v1.PricingExpression.TierRate.verify|verify} messages. + * @param message TierRate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.PricingExpression.ITierRate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TierRate message, length delimited. Does not implicitly {@link google.cloud.billing.v1.PricingExpression.TierRate.verify|verify} messages. + * @param message TierRate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.PricingExpression.ITierRate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TierRate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TierRate + * @throws {Error} If the payload is not 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.billing.v1.PricingExpression.TierRate; + + /** + * Decodes a TierRate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TierRate + * @throws {Error} If the payload 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.billing.v1.PricingExpression.TierRate; + + /** + * Verifies a TierRate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TierRate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TierRate + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.PricingExpression.TierRate; + + /** + * Creates a plain object from a TierRate message. Also converts values to other types if specified. + * @param message TierRate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.PricingExpression.TierRate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TierRate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an AggregationInfo. */ + interface IAggregationInfo { + + /** AggregationInfo aggregationLevel */ + aggregationLevel?: (google.cloud.billing.v1.AggregationInfo.AggregationLevel|keyof typeof google.cloud.billing.v1.AggregationInfo.AggregationLevel|null); + + /** AggregationInfo aggregationInterval */ + aggregationInterval?: (google.cloud.billing.v1.AggregationInfo.AggregationInterval|keyof typeof google.cloud.billing.v1.AggregationInfo.AggregationInterval|null); + + /** AggregationInfo aggregationCount */ + aggregationCount?: (number|null); + } + + /** Represents an AggregationInfo. */ + class AggregationInfo implements IAggregationInfo { + + /** + * Constructs a new AggregationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IAggregationInfo); + + /** AggregationInfo aggregationLevel. */ + public aggregationLevel: (google.cloud.billing.v1.AggregationInfo.AggregationLevel|keyof typeof google.cloud.billing.v1.AggregationInfo.AggregationLevel); + + /** AggregationInfo aggregationInterval. */ + public aggregationInterval: (google.cloud.billing.v1.AggregationInfo.AggregationInterval|keyof typeof google.cloud.billing.v1.AggregationInfo.AggregationInterval); + + /** AggregationInfo aggregationCount. */ + public aggregationCount: number; + + /** + * Creates a new AggregationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns AggregationInfo instance + */ + public static create(properties?: google.cloud.billing.v1.IAggregationInfo): google.cloud.billing.v1.AggregationInfo; + + /** + * Encodes the specified AggregationInfo message. Does not implicitly {@link google.cloud.billing.v1.AggregationInfo.verify|verify} messages. + * @param message AggregationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IAggregationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AggregationInfo message, length delimited. Does not implicitly {@link google.cloud.billing.v1.AggregationInfo.verify|verify} messages. + * @param message AggregationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IAggregationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AggregationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AggregationInfo + * @throws {Error} If the payload is not 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.billing.v1.AggregationInfo; + + /** + * Decodes an AggregationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AggregationInfo + * @throws {Error} If the payload 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.billing.v1.AggregationInfo; + + /** + * Verifies an AggregationInfo message. + * @param message Plain 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 AggregationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AggregationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.AggregationInfo; + + /** + * Creates a plain object from an AggregationInfo message. Also converts values to other types if specified. + * @param message AggregationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.AggregationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AggregationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace AggregationInfo { + + /** AggregationLevel enum. */ + enum AggregationLevel { + AGGREGATION_LEVEL_UNSPECIFIED = 0, + ACCOUNT = 1, + PROJECT = 2 + } + + /** AggregationInterval enum. */ + enum AggregationInterval { + AGGREGATION_INTERVAL_UNSPECIFIED = 0, + DAILY = 1, + MONTHLY = 2 + } + } + + /** Properties of a ListServicesRequest. */ + interface IListServicesRequest { + + /** ListServicesRequest pageSize */ + pageSize?: (number|null); + + /** ListServicesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListServicesRequest. */ + class ListServicesRequest implements IListServicesRequest { + + /** + * Constructs a new ListServicesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IListServicesRequest); + + /** ListServicesRequest pageSize. */ + public pageSize: number; + + /** ListServicesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListServicesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServicesRequest instance + */ + public static create(properties?: google.cloud.billing.v1.IListServicesRequest): google.cloud.billing.v1.ListServicesRequest; + + /** + * Encodes the specified ListServicesRequest message. Does not implicitly {@link google.cloud.billing.v1.ListServicesRequest.verify|verify} messages. + * @param message ListServicesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IListServicesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListServicesRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListServicesRequest.verify|verify} messages. + * @param message ListServicesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IListServicesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListServicesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServicesRequest + * @throws {Error} If the payload is not 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.billing.v1.ListServicesRequest; + + /** + * Decodes a ListServicesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServicesRequest + * @throws {Error} If the payload 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.billing.v1.ListServicesRequest; + + /** + * Verifies a ListServicesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListServicesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServicesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ListServicesRequest; + + /** + * Creates a plain object from a ListServicesRequest message. Also converts values to other types if specified. + * @param message ListServicesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ListServicesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListServicesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListServicesResponse. */ + interface IListServicesResponse { + + /** ListServicesResponse services */ + services?: (google.cloud.billing.v1.IService[]|null); + + /** ListServicesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListServicesResponse. */ + class ListServicesResponse implements IListServicesResponse { + + /** + * Constructs a new ListServicesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IListServicesResponse); + + /** ListServicesResponse services. */ + public services: google.cloud.billing.v1.IService[]; + + /** ListServicesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListServicesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServicesResponse instance + */ + public static create(properties?: google.cloud.billing.v1.IListServicesResponse): google.cloud.billing.v1.ListServicesResponse; + + /** + * Encodes the specified ListServicesResponse message. Does not implicitly {@link google.cloud.billing.v1.ListServicesResponse.verify|verify} messages. + * @param message ListServicesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IListServicesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListServicesResponse message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListServicesResponse.verify|verify} messages. + * @param message ListServicesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IListServicesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListServicesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServicesResponse + * @throws {Error} If the payload is not 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.billing.v1.ListServicesResponse; + + /** + * Decodes a ListServicesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServicesResponse + * @throws {Error} If the payload 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.billing.v1.ListServicesResponse; + + /** + * Verifies a ListServicesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListServicesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServicesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ListServicesResponse; + + /** + * Creates a plain object from a ListServicesResponse message. Also converts values to other types if specified. + * @param message ListServicesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ListServicesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListServicesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListSkusRequest. */ + interface IListSkusRequest { + + /** ListSkusRequest parent */ + parent?: (string|null); + + /** ListSkusRequest startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** ListSkusRequest endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** ListSkusRequest currencyCode */ + currencyCode?: (string|null); + + /** ListSkusRequest pageSize */ + pageSize?: (number|null); + + /** ListSkusRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListSkusRequest. */ + class ListSkusRequest implements IListSkusRequest { + + /** + * Constructs a new ListSkusRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IListSkusRequest); + + /** ListSkusRequest parent. */ + public parent: string; + + /** ListSkusRequest startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** ListSkusRequest endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** ListSkusRequest currencyCode. */ + public currencyCode: string; + + /** ListSkusRequest pageSize. */ + public pageSize: number; + + /** ListSkusRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListSkusRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSkusRequest instance + */ + public static create(properties?: google.cloud.billing.v1.IListSkusRequest): google.cloud.billing.v1.ListSkusRequest; + + /** + * Encodes the specified ListSkusRequest message. Does not implicitly {@link google.cloud.billing.v1.ListSkusRequest.verify|verify} messages. + * @param message ListSkusRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IListSkusRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSkusRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListSkusRequest.verify|verify} messages. + * @param message ListSkusRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IListSkusRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSkusRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSkusRequest + * @throws {Error} If the payload is not 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.billing.v1.ListSkusRequest; + + /** + * Decodes a ListSkusRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSkusRequest + * @throws {Error} If the payload 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.billing.v1.ListSkusRequest; + + /** + * Verifies a ListSkusRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSkusRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSkusRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ListSkusRequest; + + /** + * Creates a plain object from a ListSkusRequest message. Also converts values to other types if specified. + * @param message ListSkusRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ListSkusRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSkusRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListSkusResponse. */ + interface IListSkusResponse { + + /** ListSkusResponse skus */ + skus?: (google.cloud.billing.v1.ISku[]|null); + + /** ListSkusResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListSkusResponse. */ + class ListSkusResponse implements IListSkusResponse { + + /** + * Constructs a new ListSkusResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.billing.v1.IListSkusResponse); + + /** ListSkusResponse skus. */ + public skus: google.cloud.billing.v1.ISku[]; + + /** ListSkusResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListSkusResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSkusResponse instance + */ + public static create(properties?: google.cloud.billing.v1.IListSkusResponse): google.cloud.billing.v1.ListSkusResponse; + + /** + * Encodes the specified ListSkusResponse message. Does not implicitly {@link google.cloud.billing.v1.ListSkusResponse.verify|verify} messages. + * @param message ListSkusResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.billing.v1.IListSkusResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSkusResponse message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListSkusResponse.verify|verify} messages. + * @param message ListSkusResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.billing.v1.IListSkusResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSkusResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSkusResponse + * @throws {Error} If the payload is not 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.billing.v1.ListSkusResponse; + + /** + * Decodes a ListSkusResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSkusResponse + * @throws {Error} If the payload 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.billing.v1.ListSkusResponse; + + /** + * Verifies a ListSkusResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSkusResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSkusResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.billing.v1.ListSkusResponse; + + /** + * Creates a plain object from a ListSkusResponse message. Also converts values to other types if specified. + * @param message ListSkusResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.billing.v1.ListSkusResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSkusResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: (google.api.IHttpRule[]|null); + + /** Http fullyDecodeReservedExpansion */ + fullyDecodeReservedExpansion?: (boolean|null); + } + + /** Represents a Http. */ + class Http implements IHttp { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** Http fullyDecodeReservedExpansion. */ + public fullyDecodeReservedExpansion: boolean; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HttpRule. */ + interface IHttpRule { + + /** HttpRule selector */ + selector?: (string|null); + + /** HttpRule get */ + get?: (string|null); + + /** HttpRule put */ + put?: (string|null); + + /** HttpRule post */ + post?: (string|null); + + /** HttpRule delete */ + "delete"?: (string|null); + + /** HttpRule patch */ + patch?: (string|null); + + /** HttpRule custom */ + custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body */ + body?: (string|null); + + /** HttpRule responseBody */ + responseBody?: (string|null); + + /** HttpRule additionalBindings */ + additionalBindings?: (google.api.IHttpRule[]|null); + } + + /** Represents a HttpRule. */ + class HttpRule implements IHttpRule { + + /** + * Constructs a new HttpRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpRule); + + /** HttpRule selector. */ + public selector: string; + + /** HttpRule get. */ + public get: string; + + /** HttpRule put. */ + public put: string; + + /** HttpRule post. */ + public post: string; + + /** HttpRule delete. */ + public delete: string; + + /** HttpRule patch. */ + public patch: string; + + /** HttpRule custom. */ + public custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body. */ + public body: string; + + /** HttpRule responseBody. */ + public responseBody: string; + + /** HttpRule additionalBindings. */ + public additionalBindings: google.api.IHttpRule[]; + + /** HttpRule pattern. */ + public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); + + /** + * Creates a new HttpRule instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpRule instance + */ + public static create(properties?: google.api.IHttpRule): google.api.HttpRule; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; + + /** + * Verifies a HttpRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpRule + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpRule; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @param message HttpRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CustomHttpPattern. */ + interface ICustomHttpPattern { + + /** CustomHttpPattern kind */ + kind?: (string|null); + + /** CustomHttpPattern path */ + path?: (string|null); + } + + /** Represents a CustomHttpPattern. */ + class CustomHttpPattern implements ICustomHttpPattern { + + /** + * Constructs a new CustomHttpPattern. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICustomHttpPattern); + + /** CustomHttpPattern kind. */ + public kind: string; + + /** CustomHttpPattern path. */ + public path: string; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomHttpPattern instance + */ + public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; + + /** + * Verifies a CustomHttpPattern message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomHttpPattern + */ + public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @param message CustomHttpPattern + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomHttpPattern to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace protobuf. */ + namespace protobuf { + + /** Properties of a FileDescriptorSet. */ + interface IFileDescriptorSet { + + /** FileDescriptorSet file */ + file?: (google.protobuf.IFileDescriptorProto[]|null); + } + + /** Represents a FileDescriptorSet. */ + class FileDescriptorSet implements IFileDescriptorSet { + + /** + * Constructs a new FileDescriptorSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorSet); + + /** FileDescriptorSet file. */ + public file: google.protobuf.IFileDescriptorProto[]; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorSet instance + */ + public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + + /** + * Verifies a FileDescriptorSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @param message FileDescriptorSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FileDescriptorProto. */ + interface IFileDescriptorProto { + + /** FileDescriptorProto name */ + name?: (string|null); + + /** FileDescriptorProto package */ + "package"?: (string|null); + + /** FileDescriptorProto dependency */ + dependency?: (string[]|null); + + /** FileDescriptorProto publicDependency */ + publicDependency?: (number[]|null); + + /** FileDescriptorProto weakDependency */ + weakDependency?: (number[]|null); + + /** FileDescriptorProto messageType */ + messageType?: (google.protobuf.IDescriptorProto[]|null); + + /** FileDescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** FileDescriptorProto service */ + service?: (google.protobuf.IServiceDescriptorProto[]|null); + + /** FileDescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** FileDescriptorProto options */ + options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo */ + sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax */ + syntax?: (string|null); + } + + /** Represents a FileDescriptorProto. */ + class FileDescriptorProto implements IFileDescriptorProto { + + /** + * Constructs a new FileDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorProto); + + /** FileDescriptorProto name. */ + public name: string; + + /** FileDescriptorProto package. */ + public package: string; + + /** FileDescriptorProto dependency. */ + public dependency: string[]; + + /** FileDescriptorProto publicDependency. */ + public publicDependency: number[]; + + /** FileDescriptorProto weakDependency. */ + public weakDependency: number[]; + + /** FileDescriptorProto messageType. */ + public messageType: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service. */ + public service: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options. */ + public options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo. */ + public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax. */ + public syntax: string; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + + /** + * Verifies a FileDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @param message FileDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DescriptorProto. */ + interface IDescriptorProto { + + /** DescriptorProto name */ + name?: (string|null); + + /** DescriptorProto field */ + field?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto nestedType */ + nestedType?: (google.protobuf.IDescriptorProto[]|null); + + /** DescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** DescriptorProto extensionRange */ + extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); + + /** DescriptorProto oneofDecl */ + oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); + + /** DescriptorProto options */ + options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange */ + reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); + + /** DescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents a DescriptorProto. */ + class DescriptorProto implements IDescriptorProto { + + /** + * Constructs a new DescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDescriptorProto); + + /** DescriptorProto name. */ + public name: string; + + /** DescriptorProto field. */ + public field: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType. */ + public nestedType: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange. */ + public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl. */ + public oneofDecl: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options. */ + public options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange. */ + public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns DescriptorProto instance + */ + public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + + /** + * Verifies a DescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @param message DescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DescriptorProto { + + /** Properties of an ExtensionRange. */ + interface IExtensionRange { + + /** ExtensionRange start */ + start?: (number|null); + + /** ExtensionRange end */ + end?: (number|null); + + /** ExtensionRange options */ + options?: (google.protobuf.IExtensionRangeOptions|null); + } + + /** Represents an ExtensionRange. */ + class ExtensionRange implements IExtensionRange { + + /** + * Constructs a new ExtensionRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); + + /** ExtensionRange start. */ + public start: number; + + /** ExtensionRange end. */ + public end: number; + + /** ExtensionRange options. */ + public options?: (google.protobuf.IExtensionRangeOptions|null); + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Verifies an ExtensionRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @param message ExtensionRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ReservedRange. */ + interface IReservedRange { + + /** ReservedRange start */ + start?: (number|null); + + /** ReservedRange end */ + end?: (number|null); + } + + /** Represents a ReservedRange. */ + class ReservedRange implements IReservedRange { + + /** + * Constructs a new ReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); + + /** ReservedRange start. */ + public start: number; + + /** ReservedRange end. */ + public end: number; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ReservedRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Verifies a ReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @param message ReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an ExtensionRangeOptions. */ + interface IExtensionRangeOptions { + + /** ExtensionRangeOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an ExtensionRangeOptions. */ + class ExtensionRangeOptions implements IExtensionRangeOptions { + + /** + * Constructs a new ExtensionRangeOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IExtensionRangeOptions); + + /** ExtensionRangeOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRangeOptions instance + */ + public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions; + + /** + * Verifies an ExtensionRangeOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRangeOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @param message ExtensionRangeOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldDescriptorProto. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: (string|null); + + /** FieldDescriptorProto number */ + number?: (number|null); + + /** FieldDescriptorProto label */ + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + + /** FieldDescriptorProto type */ + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + + /** FieldDescriptorProto typeName */ + typeName?: (string|null); + + /** FieldDescriptorProto extendee */ + extendee?: (string|null); + + /** FieldDescriptorProto defaultValue */ + defaultValue?: (string|null); + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: (number|null); + + /** FieldDescriptorProto jsonName */ + jsonName?: (string|null); + + /** FieldDescriptorProto options */ + options?: (google.protobuf.IFieldOptions|null); + } + + /** 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); + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FieldDescriptorProto { + + /** Type enum. */ + enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18 + } + + /** Label enum. */ + enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3 + } + } + + /** Properties of an OneofDescriptorProto. */ + interface IOneofDescriptorProto { + + /** OneofDescriptorProto name */ + name?: (string|null); + + /** OneofDescriptorProto options */ + options?: (google.protobuf.IOneofOptions|null); + } + + /** Represents an OneofDescriptorProto. */ + class OneofDescriptorProto implements IOneofDescriptorProto { + + /** + * Constructs a new OneofDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofDescriptorProto); + + /** OneofDescriptorProto name. */ + public name: string; + + /** OneofDescriptorProto options. */ + public options?: (google.protobuf.IOneofOptions|null); + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofDescriptorProto instance + */ + public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + + /** + * Verifies an OneofDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @param message OneofDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumDescriptorProto. */ + interface IEnumDescriptorProto { + + /** EnumDescriptorProto name */ + name?: (string|null); + + /** EnumDescriptorProto value */ + value?: (google.protobuf.IEnumValueDescriptorProto[]|null); + + /** EnumDescriptorProto options */ + options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange */ + reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); + + /** EnumDescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents an EnumDescriptorProto. */ + class EnumDescriptorProto implements IEnumDescriptorProto { + + /** + * Constructs a new EnumDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumDescriptorProto); + + /** EnumDescriptorProto name. */ + public name: string; + + /** EnumDescriptorProto value. */ + public value: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options. */ + public options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange. */ + public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; + + /** EnumDescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + + /** + * Verifies an EnumDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @param message EnumDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace EnumDescriptorProto { + + /** Properties of an EnumReservedRange. */ + interface IEnumReservedRange { + + /** EnumReservedRange start */ + start?: (number|null); + + /** EnumReservedRange end */ + end?: (number|null); + } + + /** Represents an EnumReservedRange. */ + class EnumReservedRange implements IEnumReservedRange { + + /** + * Constructs a new EnumReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); + + /** EnumReservedRange start. */ + public start: number; + + /** EnumReservedRange end. */ + public end: number; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumReservedRange instance + */ + public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Verifies an EnumReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @param message EnumReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of an EnumValueDescriptorProto. */ + interface IEnumValueDescriptorProto { + + /** EnumValueDescriptorProto name */ + name?: (string|null); + + /** EnumValueDescriptorProto number */ + number?: (number|null); + + /** EnumValueDescriptorProto options */ + options?: (google.protobuf.IEnumValueOptions|null); + } + + /** Represents an EnumValueDescriptorProto. */ + class EnumValueDescriptorProto implements IEnumValueDescriptorProto { + + /** + * Constructs a new EnumValueDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueDescriptorProto); + + /** EnumValueDescriptorProto name. */ + public name: string; + + /** EnumValueDescriptorProto number. */ + public number: number; + + /** EnumValueDescriptorProto options. */ + public options?: (google.protobuf.IEnumValueOptions|null); + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + + /** + * Verifies an EnumValueDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @param message EnumValueDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceDescriptorProto. */ + interface IServiceDescriptorProto { + + /** ServiceDescriptorProto name */ + name?: (string|null); + + /** ServiceDescriptorProto method */ + method?: (google.protobuf.IMethodDescriptorProto[]|null); + + /** ServiceDescriptorProto options */ + options?: (google.protobuf.IServiceOptions|null); + } + + /** Represents a ServiceDescriptorProto. */ + class ServiceDescriptorProto implements IServiceDescriptorProto { + + /** + * Constructs a new ServiceDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceDescriptorProto); + + /** ServiceDescriptorProto name. */ + public name: string; + + /** ServiceDescriptorProto method. */ + public method: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options. */ + public options?: (google.protobuf.IServiceOptions|null); + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceDescriptorProto instance + */ + public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + + /** + * Verifies a ServiceDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @param message ServiceDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MethodDescriptorProto. */ + interface IMethodDescriptorProto { + + /** MethodDescriptorProto name */ + name?: (string|null); + + /** MethodDescriptorProto inputType */ + inputType?: (string|null); + + /** MethodDescriptorProto outputType */ + outputType?: (string|null); + + /** MethodDescriptorProto options */ + options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming */ + clientStreaming?: (boolean|null); + + /** MethodDescriptorProto serverStreaming */ + serverStreaming?: (boolean|null); + } + + /** Represents a MethodDescriptorProto. */ + class MethodDescriptorProto implements IMethodDescriptorProto { + + /** + * Constructs a new MethodDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodDescriptorProto); + + /** MethodDescriptorProto name. */ + public name: string; + + /** MethodDescriptorProto inputType. */ + public inputType: string; + + /** MethodDescriptorProto outputType. */ + public outputType: string; + + /** MethodDescriptorProto options. */ + public options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming. */ + public clientStreaming: boolean; + + /** MethodDescriptorProto serverStreaming. */ + public serverStreaming: boolean; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodDescriptorProto instance + */ + public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + + /** + * Verifies a MethodDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @param message MethodDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FileOptions. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: (string|null); + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: (string|null); + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: (boolean|null); + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: (boolean|null); + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: (boolean|null); + + /** FileOptions optimizeFor */ + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + + /** FileOptions goPackage */ + goPackage?: (string|null); + + /** FileOptions ccGenericServices */ + ccGenericServices?: (boolean|null); + + /** FileOptions javaGenericServices */ + javaGenericServices?: (boolean|null); + + /** FileOptions pyGenericServices */ + pyGenericServices?: (boolean|null); + + /** FileOptions phpGenericServices */ + phpGenericServices?: (boolean|null); + + /** FileOptions deprecated */ + deprecated?: (boolean|null); + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: (boolean|null); + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: (string|null); + + /** FileOptions csharpNamespace */ + csharpNamespace?: (string|null); + + /** FileOptions swiftPrefix */ + swiftPrefix?: (string|null); + + /** FileOptions phpClassPrefix */ + phpClassPrefix?: (string|null); + + /** FileOptions phpNamespace */ + phpNamespace?: (string|null); + + /** FileOptions phpMetadataNamespace */ + phpMetadataNamespace?: (string|null); + + /** FileOptions rubyPackage */ + rubyPackage?: (string|null); + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); + } + + /** Represents a FileOptions. */ + class FileOptions implements IFileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions phpGenericServices. */ + public phpGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions swiftPrefix. */ + public swiftPrefix: string; + + /** FileOptions phpClassPrefix. */ + public phpClassPrefix: string; + + /** FileOptions phpNamespace. */ + public phpNamespace: string; + + /** FileOptions phpMetadataNamespace. */ + public phpMetadataNamespace: string; + + /** FileOptions rubyPackage. */ + public rubyPackage: string; + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FileOptions { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: (boolean|null); + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: (boolean|null); + + /** MessageOptions deprecated */ + deprecated?: (boolean|null); + + /** MessageOptions mapEntry */ + mapEntry?: (boolean|null); + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); + } + + /** Represents a MessageOptions. */ + class MessageOptions implements IMessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FieldOptions. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + + /** FieldOptions lazy */ + lazy?: (boolean|null); + + /** FieldOptions deprecated */ + deprecated?: (boolean|null); + + /** FieldOptions weak */ + weak?: (boolean|null); + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FieldOptions .google.api.fieldBehavior */ + ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); + } + + /** Represents a FieldOptions. */ + class FieldOptions implements IFieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions deprecated. */ + public deprecated: boolean; + + /** FieldOptions weak. */ + public weak: boolean; + + /** FieldOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOptions instance + */ + public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + + /** + * Verifies a FieldOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @param message FieldOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace FieldOptions { + + /** CType enum. */ + enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2 + } + + /** JSType enum. */ + enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2 + } + } + + /** Properties of an OneofOptions. */ + interface IOneofOptions { + + /** OneofOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an OneofOptions. */ + class OneofOptions implements IOneofOptions { + + /** + * Constructs a new OneofOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofOptions); + + /** OneofOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofOptions instance + */ + public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + + /** + * Verifies an OneofOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @param message OneofOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumOptions. */ + interface IEnumOptions { + + /** EnumOptions allowAlias */ + allowAlias?: (boolean|null); + + /** EnumOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumOptions. */ + class EnumOptions implements IEnumOptions { + + /** + * Constructs a new EnumOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumOptions); + + /** EnumOptions allowAlias. */ + public allowAlias: boolean; + + /** EnumOptions deprecated. */ + public deprecated: boolean; + + /** EnumOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumOptions instance + */ + public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + + /** + * Verifies an EnumOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @param message EnumOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnumValueOptions. */ + interface IEnumValueOptions { + + /** EnumValueOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumValueOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumValueOptions. */ + class EnumValueOptions implements IEnumValueOptions { + + /** + * Constructs a new EnumValueOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueOptions); + + /** EnumValueOptions deprecated. */ + public deprecated: boolean; + + /** EnumValueOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueOptions instance + */ + public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + + /** + * Verifies an EnumValueOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @param message EnumValueOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ServiceOptions. */ + interface IServiceOptions { + + /** ServiceOptions deprecated */ + deprecated?: (boolean|null); + + /** ServiceOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ServiceOptions .google.api.defaultHost */ + ".google.api.defaultHost"?: (string|null); + + /** ServiceOptions .google.api.oauthScopes */ + ".google.api.oauthScopes"?: (string|null); + } + + /** Represents a ServiceOptions. */ + class ServiceOptions implements IServiceOptions { + + /** + * Constructs a new ServiceOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceOptions); + + /** ServiceOptions deprecated. */ + public deprecated: boolean; + + /** ServiceOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceOptions instance + */ + public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + + /** + * Verifies a ServiceOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @param message ServiceOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a MethodOptions. */ + interface IMethodOptions { + + /** MethodOptions deprecated */ + deprecated?: (boolean|null); + + /** MethodOptions idempotencyLevel */ + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + + /** MethodOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MethodOptions .google.api.http */ + ".google.api.http"?: (google.api.IHttpRule|null); + + /** MethodOptions .google.api.methodSignature */ + ".google.api.methodSignature"?: (string[]|null); + } + + /** Represents a MethodOptions. */ + class MethodOptions implements IMethodOptions { + + /** + * Constructs a new MethodOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodOptions); + + /** MethodOptions deprecated. */ + public deprecated: boolean; + + /** MethodOptions idempotencyLevel. */ + public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); + + /** MethodOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodOptions instance + */ + public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + + /** + * Verifies a MethodOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @param message MethodOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace MethodOptions { + + /** IdempotencyLevel enum. */ + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2 + } + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + + /** UninterpretedOption identifierValue */ + identifierValue?: (string|null); + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long|string|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|string|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|string|null); + + /** UninterpretedOption aggregateValue */ + aggregateValue?: (string|null); + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption implements IUninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long|string); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long|string); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: (Uint8Array|string); + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace UninterpretedOption { + + /** Properties of a NamePart. */ + interface INamePart { + + /** NamePart namePart */ + namePart: string; + + /** NamePart isExtension */ + isExtension: boolean; + } + + /** Represents a NamePart. */ + class NamePart implements INamePart { + + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + + /** NamePart namePart. */ + public namePart: string; + + /** NamePart isExtension. */ + public isExtension: boolean; + + /** + * Creates a new NamePart instance using the specified properties. + * @param [properties] Properties to set + * @returns NamePart instance + */ + public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + + /** + * Verifies a NamePart message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NamePart + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @param message NamePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NamePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo implements ISourceCodeInfo { + + /** + * Constructs a new SourceCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ISourceCodeInfo); + + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceCodeInfo instance + */ + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + + /** + * Verifies a SourceCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @param message SourceCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace SourceCodeInfo { + + /** Properties of a Location. */ + interface ILocation { + + /** Location path */ + path?: (number[]|null); + + /** Location span */ + span?: (number[]|null); + + /** Location leadingComments */ + leadingComments?: (string|null); + + /** Location trailingComments */ + trailingComments?: (string|null); + + /** Location leadingDetachedComments */ + leadingDetachedComments?: (string[]|null); + } + + /** Represents a Location. */ + class Location implements ILocation { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + + /** Location path. */ + public path: number[]; + + /** Location span. */ + public span: number[]; + + /** Location leadingComments. */ + public leadingComments: string; + + /** Location trailingComments. */ + public trailingComments: string; + + /** Location leadingDetachedComments. */ + public leadingDetachedComments: string[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { + + /** GeneratedCodeInfo annotation */ + annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); + } + + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo implements IGeneratedCodeInfo { + + /** + * Constructs a new GeneratedCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IGeneratedCodeInfo); + + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratedCodeInfo instance + */ + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + + /** + * Verifies a GeneratedCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratedCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @param message GeneratedCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace GeneratedCodeInfo { + + /** Properties of an Annotation. */ + interface IAnnotation { + + /** Annotation path */ + path?: (number[]|null); + + /** Annotation sourceFile */ + sourceFile?: (string|null); + + /** Annotation begin */ + begin?: (number|null); + + /** Annotation end */ + end?: (number|null); + } + + /** Represents an Annotation. */ + class Annotation implements IAnnotation { + + /** + * Constructs a new Annotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + + /** Annotation path. */ + public path: number[]; + + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; + + /** + * Creates a new Annotation instance using the specified properties. + * @param [properties] Properties to set + * @returns Annotation instance + */ + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Verifies an Annotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Annotation + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @param message Annotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Annotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } + + /** Namespace iam. */ + namespace iam { + + /** Namespace v1. */ + namespace v1 { + + /** Represents a IAMPolicy */ + class IAMPolicy extends $protobuf.rpc.Service { + + /** + * Constructs a new IAMPolicy service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new IAMPolicy service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): IAMPolicy; + + /** + * Calls SetIamPolicy. + * @param request SetIamPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Policy + */ + public setIamPolicy(request: google.iam.v1.ISetIamPolicyRequest, callback: google.iam.v1.IAMPolicy.SetIamPolicyCallback): void; + + /** + * Calls SetIamPolicy. + * @param request SetIamPolicyRequest message or plain object + * @returns Promise + */ + public setIamPolicy(request: google.iam.v1.ISetIamPolicyRequest): Promise; + + /** + * Calls GetIamPolicy. + * @param request GetIamPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Policy + */ + public getIamPolicy(request: google.iam.v1.IGetIamPolicyRequest, callback: google.iam.v1.IAMPolicy.GetIamPolicyCallback): void; + + /** + * Calls GetIamPolicy. + * @param request GetIamPolicyRequest message or plain object + * @returns Promise + */ + public getIamPolicy(request: google.iam.v1.IGetIamPolicyRequest): Promise; + + /** + * Calls TestIamPermissions. + * @param request TestIamPermissionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TestIamPermissionsResponse + */ + public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest, callback: google.iam.v1.IAMPolicy.TestIamPermissionsCallback): void; + + /** + * Calls TestIamPermissions. + * @param request TestIamPermissionsRequest message or plain object + * @returns Promise + */ + public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest): Promise; + } + + namespace IAMPolicy { + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * @param error Error, if any + * @param [response] Policy + */ + type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * @param error Error, if any + * @param [response] Policy + */ + type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * @param error Error, if any + * @param [response] TestIamPermissionsResponse + */ + type TestIamPermissionsCallback = (error: (Error|null), response?: google.iam.v1.TestIamPermissionsResponse) => void; + } + + /** Properties of a SetIamPolicyRequest. */ + interface ISetIamPolicyRequest { + + /** SetIamPolicyRequest resource */ + resource?: (string|null); + + /** SetIamPolicyRequest policy */ + policy?: (google.iam.v1.IPolicy|null); + } + + /** Represents a SetIamPolicyRequest. */ + class SetIamPolicyRequest implements ISetIamPolicyRequest { + + /** + * Constructs a new SetIamPolicyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.ISetIamPolicyRequest); + + /** SetIamPolicyRequest resource. */ + public resource: string; + + /** SetIamPolicyRequest policy. */ + public policy?: (google.iam.v1.IPolicy|null); + + /** + * Creates a new SetIamPolicyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetIamPolicyRequest instance + */ + public static create(properties?: google.iam.v1.ISetIamPolicyRequest): google.iam.v1.SetIamPolicyRequest; + + /** + * Encodes the specified SetIamPolicyRequest message. Does not implicitly {@link google.iam.v1.SetIamPolicyRequest.verify|verify} messages. + * @param message SetIamPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.ISetIamPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetIamPolicyRequest message, length delimited. Does not implicitly {@link google.iam.v1.SetIamPolicyRequest.verify|verify} messages. + * @param message SetIamPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.ISetIamPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetIamPolicyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.SetIamPolicyRequest; + + /** + * Decodes a SetIamPolicyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.SetIamPolicyRequest; + + /** + * Verifies a SetIamPolicyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetIamPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetIamPolicyRequest + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.SetIamPolicyRequest; + + /** + * Creates a plain object from a SetIamPolicyRequest message. Also converts values to other types if specified. + * @param message SetIamPolicyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.SetIamPolicyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetIamPolicyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetIamPolicyRequest. */ + interface IGetIamPolicyRequest { + + /** GetIamPolicyRequest resource */ + resource?: (string|null); + + /** GetIamPolicyRequest options */ + options?: (google.iam.v1.IGetPolicyOptions|null); + } + + /** Represents a GetIamPolicyRequest. */ + class GetIamPolicyRequest implements IGetIamPolicyRequest { + + /** + * Constructs a new GetIamPolicyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IGetIamPolicyRequest); + + /** GetIamPolicyRequest resource. */ + public resource: string; + + /** GetIamPolicyRequest options. */ + public options?: (google.iam.v1.IGetPolicyOptions|null); + + /** + * Creates a new GetIamPolicyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetIamPolicyRequest instance + */ + public static create(properties?: google.iam.v1.IGetIamPolicyRequest): google.iam.v1.GetIamPolicyRequest; + + /** + * Encodes the specified GetIamPolicyRequest message. Does not implicitly {@link google.iam.v1.GetIamPolicyRequest.verify|verify} messages. + * @param message GetIamPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IGetIamPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetIamPolicyRequest message, length delimited. Does not implicitly {@link google.iam.v1.GetIamPolicyRequest.verify|verify} messages. + * @param message GetIamPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IGetIamPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetIamPolicyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.GetIamPolicyRequest; + + /** + * Decodes a GetIamPolicyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.GetIamPolicyRequest; + + /** + * Verifies a GetIamPolicyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetIamPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetIamPolicyRequest + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.GetIamPolicyRequest; + + /** + * Creates a plain object from a GetIamPolicyRequest message. Also converts values to other types if specified. + * @param message GetIamPolicyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.GetIamPolicyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetIamPolicyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TestIamPermissionsRequest. */ + interface ITestIamPermissionsRequest { + + /** TestIamPermissionsRequest resource */ + resource?: (string|null); + + /** TestIamPermissionsRequest permissions */ + permissions?: (string[]|null); + } + + /** Represents a TestIamPermissionsRequest. */ + class TestIamPermissionsRequest implements ITestIamPermissionsRequest { + + /** + * Constructs a new TestIamPermissionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.ITestIamPermissionsRequest); + + /** TestIamPermissionsRequest resource. */ + public resource: string; + + /** TestIamPermissionsRequest permissions. */ + public permissions: string[]; + + /** + * Creates a new TestIamPermissionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TestIamPermissionsRequest instance + */ + public static create(properties?: google.iam.v1.ITestIamPermissionsRequest): google.iam.v1.TestIamPermissionsRequest; + + /** + * Encodes the specified TestIamPermissionsRequest message. Does not implicitly {@link google.iam.v1.TestIamPermissionsRequest.verify|verify} messages. + * @param message TestIamPermissionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.ITestIamPermissionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TestIamPermissionsRequest message, length delimited. Does not implicitly {@link google.iam.v1.TestIamPermissionsRequest.verify|verify} messages. + * @param message TestIamPermissionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.ITestIamPermissionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TestIamPermissionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TestIamPermissionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.TestIamPermissionsRequest; + + /** + * Decodes a TestIamPermissionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TestIamPermissionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.TestIamPermissionsRequest; + + /** + * Verifies a TestIamPermissionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TestIamPermissionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TestIamPermissionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.TestIamPermissionsRequest; + + /** + * Creates a plain object from a TestIamPermissionsRequest message. Also converts values to other types if specified. + * @param message TestIamPermissionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.TestIamPermissionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TestIamPermissionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a TestIamPermissionsResponse. */ + interface ITestIamPermissionsResponse { + + /** TestIamPermissionsResponse permissions */ + permissions?: (string[]|null); + } + + /** Represents a TestIamPermissionsResponse. */ + class TestIamPermissionsResponse implements ITestIamPermissionsResponse { + + /** + * Constructs a new TestIamPermissionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.ITestIamPermissionsResponse); + + /** TestIamPermissionsResponse permissions. */ + public permissions: string[]; + + /** + * Creates a new TestIamPermissionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TestIamPermissionsResponse instance + */ + public static create(properties?: google.iam.v1.ITestIamPermissionsResponse): google.iam.v1.TestIamPermissionsResponse; + + /** + * Encodes the specified TestIamPermissionsResponse message. Does not implicitly {@link google.iam.v1.TestIamPermissionsResponse.verify|verify} messages. + * @param message TestIamPermissionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.ITestIamPermissionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TestIamPermissionsResponse message, length delimited. Does not implicitly {@link google.iam.v1.TestIamPermissionsResponse.verify|verify} messages. + * @param message TestIamPermissionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.ITestIamPermissionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TestIamPermissionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TestIamPermissionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.TestIamPermissionsResponse; + + /** + * Decodes a TestIamPermissionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TestIamPermissionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.TestIamPermissionsResponse; + + /** + * Verifies a TestIamPermissionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TestIamPermissionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TestIamPermissionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.TestIamPermissionsResponse; + + /** + * Creates a plain object from a TestIamPermissionsResponse message. Also converts values to other types if specified. + * @param message TestIamPermissionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.TestIamPermissionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TestIamPermissionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetPolicyOptions. */ + interface IGetPolicyOptions { + + /** GetPolicyOptions requestedPolicyVersion */ + requestedPolicyVersion?: (number|null); + } + + /** Represents a GetPolicyOptions. */ + class GetPolicyOptions implements IGetPolicyOptions { + + /** + * Constructs a new GetPolicyOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IGetPolicyOptions); + + /** GetPolicyOptions requestedPolicyVersion. */ + public requestedPolicyVersion: number; + + /** + * Creates a new GetPolicyOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns GetPolicyOptions instance + */ + public static create(properties?: google.iam.v1.IGetPolicyOptions): google.iam.v1.GetPolicyOptions; + + /** + * Encodes the specified GetPolicyOptions message. Does not implicitly {@link google.iam.v1.GetPolicyOptions.verify|verify} messages. + * @param message GetPolicyOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IGetPolicyOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetPolicyOptions message, length delimited. Does not implicitly {@link google.iam.v1.GetPolicyOptions.verify|verify} messages. + * @param message GetPolicyOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IGetPolicyOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetPolicyOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetPolicyOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.GetPolicyOptions; + + /** + * Decodes a GetPolicyOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetPolicyOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.GetPolicyOptions; + + /** + * Verifies a GetPolicyOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetPolicyOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetPolicyOptions + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.GetPolicyOptions; + + /** + * Creates a plain object from a GetPolicyOptions message. Also converts values to other types if specified. + * @param message GetPolicyOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.GetPolicyOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetPolicyOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Policy. */ + interface IPolicy { + + /** Policy version */ + version?: (number|null); + + /** Policy bindings */ + bindings?: (google.iam.v1.IBinding[]|null); + + /** Policy etag */ + etag?: (Uint8Array|string|null); + } + + /** Represents a Policy. */ + class Policy implements IPolicy { + + /** + * Constructs a new Policy. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IPolicy); + + /** Policy version. */ + public version: number; + + /** Policy bindings. */ + public bindings: google.iam.v1.IBinding[]; + + /** Policy etag. */ + public etag: (Uint8Array|string); + + /** + * Creates a new Policy instance using the specified properties. + * @param [properties] Properties to set + * @returns Policy instance + */ + public static create(properties?: google.iam.v1.IPolicy): google.iam.v1.Policy; + + /** + * Encodes the specified Policy message. Does not implicitly {@link google.iam.v1.Policy.verify|verify} messages. + * @param message Policy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Policy message, length delimited. Does not implicitly {@link google.iam.v1.Policy.verify|verify} messages. + * @param message Policy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Policy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Policy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.Policy; + + /** + * Decodes a Policy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Policy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.Policy; + + /** + * Verifies a Policy message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Policy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Policy + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.Policy; + + /** + * Creates a plain object from a Policy message. Also converts values to other types if specified. + * @param message Policy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.Policy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Policy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Binding. */ + interface IBinding { + + /** Binding role */ + role?: (string|null); + + /** Binding members */ + members?: (string[]|null); + + /** Binding condition */ + condition?: (google.type.IExpr|null); + } + + /** Represents a Binding. */ + class Binding implements IBinding { + + /** + * Constructs a new Binding. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IBinding); + + /** Binding role. */ + public role: string; + + /** Binding members. */ + public members: string[]; + + /** Binding condition. */ + public condition?: (google.type.IExpr|null); + + /** + * Creates a new Binding instance using the specified properties. + * @param [properties] Properties to set + * @returns Binding instance + */ + public static create(properties?: google.iam.v1.IBinding): google.iam.v1.Binding; + + /** + * Encodes the specified Binding message. Does not implicitly {@link google.iam.v1.Binding.verify|verify} messages. + * @param message Binding message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IBinding, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Binding message, length delimited. Does not implicitly {@link google.iam.v1.Binding.verify|verify} messages. + * @param message Binding message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IBinding, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Binding message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Binding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.Binding; + + /** + * Decodes a Binding message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Binding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.Binding; + + /** + * Verifies a Binding message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Binding message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Binding + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.Binding; + + /** + * Creates a plain object from a Binding message. Also converts values to other types if specified. + * @param message Binding + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.Binding, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Binding to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a PolicyDelta. */ + interface IPolicyDelta { + + /** PolicyDelta bindingDeltas */ + bindingDeltas?: (google.iam.v1.IBindingDelta[]|null); + + /** PolicyDelta auditConfigDeltas */ + auditConfigDeltas?: (google.iam.v1.IAuditConfigDelta[]|null); + } + + /** Represents a PolicyDelta. */ + class PolicyDelta implements IPolicyDelta { + + /** + * Constructs a new PolicyDelta. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IPolicyDelta); + + /** PolicyDelta bindingDeltas. */ + public bindingDeltas: google.iam.v1.IBindingDelta[]; + + /** PolicyDelta auditConfigDeltas. */ + public auditConfigDeltas: google.iam.v1.IAuditConfigDelta[]; + + /** + * Creates a new PolicyDelta instance using the specified properties. + * @param [properties] Properties to set + * @returns PolicyDelta instance + */ + public static create(properties?: google.iam.v1.IPolicyDelta): google.iam.v1.PolicyDelta; + + /** + * Encodes the specified PolicyDelta message. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * @param message PolicyDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IPolicyDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PolicyDelta message, length delimited. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * @param message PolicyDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IPolicyDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PolicyDelta message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PolicyDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.PolicyDelta; + + /** + * Decodes a PolicyDelta message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PolicyDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.PolicyDelta; + + /** + * Verifies a PolicyDelta message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PolicyDelta message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PolicyDelta + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.PolicyDelta; + + /** + * Creates a plain object from a PolicyDelta message. Also converts values to other types if specified. + * @param message PolicyDelta + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.PolicyDelta, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PolicyDelta to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BindingDelta. */ + interface IBindingDelta { + + /** BindingDelta action */ + action?: (google.iam.v1.BindingDelta.Action|keyof typeof google.iam.v1.BindingDelta.Action|null); + + /** BindingDelta role */ + role?: (string|null); + + /** BindingDelta member */ + member?: (string|null); + + /** BindingDelta condition */ + condition?: (google.type.IExpr|null); + } + + /** Represents a BindingDelta. */ + class BindingDelta implements IBindingDelta { + + /** + * Constructs a new BindingDelta. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IBindingDelta); + + /** BindingDelta action. */ + public action: (google.iam.v1.BindingDelta.Action|keyof typeof google.iam.v1.BindingDelta.Action); + + /** BindingDelta role. */ + public role: string; + + /** BindingDelta member. */ + public member: string; + + /** BindingDelta condition. */ + public condition?: (google.type.IExpr|null); + + /** + * Creates a new BindingDelta instance using the specified properties. + * @param [properties] Properties to set + * @returns BindingDelta instance + */ + public static create(properties?: google.iam.v1.IBindingDelta): google.iam.v1.BindingDelta; + + /** + * Encodes the specified BindingDelta message. Does not implicitly {@link google.iam.v1.BindingDelta.verify|verify} messages. + * @param message BindingDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IBindingDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BindingDelta message, length delimited. Does not implicitly {@link google.iam.v1.BindingDelta.verify|verify} messages. + * @param message BindingDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IBindingDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BindingDelta message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BindingDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.BindingDelta; + + /** + * Decodes a BindingDelta message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BindingDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.BindingDelta; + + /** + * Verifies a BindingDelta message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BindingDelta message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BindingDelta + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.BindingDelta; + + /** + * Creates a plain object from a BindingDelta message. Also converts values to other types if specified. + * @param message BindingDelta + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.BindingDelta, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BindingDelta to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BindingDelta { + + /** Action enum. */ + enum Action { + ACTION_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2 + } + } + + /** Properties of an AuditConfigDelta. */ + interface IAuditConfigDelta { + + /** AuditConfigDelta action */ + action?: (google.iam.v1.AuditConfigDelta.Action|keyof typeof google.iam.v1.AuditConfigDelta.Action|null); + + /** AuditConfigDelta service */ + service?: (string|null); + + /** AuditConfigDelta exemptedMember */ + exemptedMember?: (string|null); + + /** AuditConfigDelta logType */ + logType?: (string|null); + } + + /** Represents an AuditConfigDelta. */ + class AuditConfigDelta implements IAuditConfigDelta { + + /** + * Constructs a new AuditConfigDelta. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IAuditConfigDelta); + + /** AuditConfigDelta action. */ + public action: (google.iam.v1.AuditConfigDelta.Action|keyof typeof google.iam.v1.AuditConfigDelta.Action); + + /** AuditConfigDelta service. */ + public service: string; + + /** AuditConfigDelta exemptedMember. */ + public exemptedMember: string; + + /** AuditConfigDelta logType. */ + public logType: string; + + /** + * Creates a new AuditConfigDelta instance using the specified properties. + * @param [properties] Properties to set + * @returns AuditConfigDelta instance + */ + public static create(properties?: google.iam.v1.IAuditConfigDelta): google.iam.v1.AuditConfigDelta; + + /** + * Encodes the specified AuditConfigDelta message. Does not implicitly {@link google.iam.v1.AuditConfigDelta.verify|verify} messages. + * @param message AuditConfigDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IAuditConfigDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AuditConfigDelta message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfigDelta.verify|verify} messages. + * @param message AuditConfigDelta message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IAuditConfigDelta, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AuditConfigDelta message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AuditConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.AuditConfigDelta; + + /** + * Decodes an AuditConfigDelta message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AuditConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.AuditConfigDelta; + + /** + * Verifies an AuditConfigDelta message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AuditConfigDelta message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AuditConfigDelta + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.AuditConfigDelta; + + /** + * Creates a plain object from an AuditConfigDelta message. Also converts values to other types if specified. + * @param message AuditConfigDelta + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.AuditConfigDelta, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AuditConfigDelta to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace AuditConfigDelta { + + /** Action enum. */ + enum Action { + ACTION_UNSPECIFIED = 0, + ADD = 1, + REMOVE = 2 + } + } + } + } + + /** Namespace type. */ + namespace type { + + /** Properties of an Expr. */ + interface IExpr { + + /** Expr expression */ + expression?: (string|null); + + /** Expr title */ + title?: (string|null); + + /** Expr description */ + description?: (string|null); + + /** Expr location */ + location?: (string|null); + } + + /** Represents an Expr. */ + class Expr implements IExpr { + + /** + * Constructs a new Expr. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IExpr); + + /** Expr expression. */ + public expression: string; + + /** Expr title. */ + public title: string; + + /** Expr description. */ + public description: string; + + /** Expr location. */ + public location: string; + + /** + * Creates a new Expr instance using the specified properties. + * @param [properties] Properties to set + * @returns Expr instance + */ + public static create(properties?: google.type.IExpr): google.type.Expr; + + /** + * Encodes the specified Expr message. Does not implicitly {@link google.type.Expr.verify|verify} messages. + * @param message Expr message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.type.IExpr, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Expr message, length delimited. Does not implicitly {@link google.type.Expr.verify|verify} messages. + * @param message Expr message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.type.IExpr, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Expr message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Expr + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.Expr; + + /** + * Decodes an Expr message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Expr + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.Expr; + + /** + * Verifies an Expr message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Expr message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Expr + */ + public static fromObject(object: { [k: string]: any }): google.type.Expr; + + /** + * Creates a plain object from an Expr message. Also converts values to other types if specified. + * @param message Expr + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.type.Expr, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Expr to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Money. */ + interface IMoney { + + /** Money currencyCode */ + currencyCode?: (string|null); + + /** Money units */ + units?: (number|Long|string|null); + + /** Money nanos */ + nanos?: (number|null); + } + + /** Represents a Money. */ + class Money implements IMoney { + + /** + * Constructs a new Money. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IMoney); + + /** Money currencyCode. */ + public currencyCode: string; + + /** Money units. */ + public units: (number|Long|string); + + /** Money nanos. */ + public nanos: number; + + /** + * Creates a new Money instance using the specified properties. + * @param [properties] Properties to set + * @returns Money instance + */ + public static create(properties?: google.type.IMoney): google.type.Money; + + /** + * Encodes the specified Money message. Does not implicitly {@link google.type.Money.verify|verify} messages. + * @param message Money message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.type.IMoney, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Money message, length delimited. Does not implicitly {@link google.type.Money.verify|verify} messages. + * @param message Money message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.type.IMoney, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Money message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Money + * @throws {Error} If the payload is not 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.Money; + + /** + * Decodes a Money message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Money + * @throws {Error} If the payload 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.Money; + + /** + * Verifies a Money message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Money message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Money + */ + public static fromObject(object: { [k: string]: any }): google.type.Money; + + /** + * Creates a plain object from a Money message. Also converts values to other types if specified. + * @param message Money + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.type.Money, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Money to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + } +} diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js new file mode 100644 index 00000000000..4ae995e9d2f --- /dev/null +++ b/packages/google-cloud-billing/protos/protos.js @@ -0,0 +1,19660 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +(function(global, factory) { /* global define, require, module */ + + /* AMD */ if (typeof define === 'function' && define.amd) + define(["protobufjs/minimal"], factory); + + /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) + module.exports = factory(require("protobufjs/minimal")); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.billing = (function() { + + /** + * Namespace billing. + * @memberof google.cloud + * @namespace + */ + var billing = {}; + + billing.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.billing + * @namespace + */ + var v1 = {}; + + v1.CloudBilling = (function() { + + /** + * Constructs a new CloudBilling service. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a CloudBilling + * @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 CloudBilling(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CloudBilling.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CloudBilling; + + /** + * Creates new CloudBilling service using the specified rpc implementation. + * @function create + * @memberof google.cloud.billing.v1.CloudBilling + * @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 {CloudBilling} RPC service. Useful where requests and/or responses are streamed. + */ + CloudBilling.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getBillingAccount}. + * @memberof google.cloud.billing.v1.CloudBilling + * @typedef GetBillingAccountCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.BillingAccount} [response] BillingAccount + */ + + /** + * Calls GetBillingAccount. + * @function getBillingAccount + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IGetBillingAccountRequest} request GetBillingAccountRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.GetBillingAccountCallback} callback Node-style callback called with the error, if any, and BillingAccount + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.prototype.getBillingAccount = function getBillingAccount(request, callback) { + return this.rpcCall(getBillingAccount, $root.google.cloud.billing.v1.GetBillingAccountRequest, $root.google.cloud.billing.v1.BillingAccount, request, callback); + }, "name", { value: "GetBillingAccount" }); + + /** + * Calls GetBillingAccount. + * @function getBillingAccount + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IGetBillingAccountRequest} request GetBillingAccountRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#listBillingAccounts}. + * @memberof google.cloud.billing.v1.CloudBilling + * @typedef ListBillingAccountsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.ListBillingAccountsResponse} [response] ListBillingAccountsResponse + */ + + /** + * Calls ListBillingAccounts. + * @function listBillingAccounts + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IListBillingAccountsRequest} request ListBillingAccountsRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.ListBillingAccountsCallback} callback Node-style callback called with the error, if any, and ListBillingAccountsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.prototype.listBillingAccounts = function listBillingAccounts(request, callback) { + return this.rpcCall(listBillingAccounts, $root.google.cloud.billing.v1.ListBillingAccountsRequest, $root.google.cloud.billing.v1.ListBillingAccountsResponse, request, callback); + }, "name", { value: "ListBillingAccounts" }); + + /** + * Calls ListBillingAccounts. + * @function listBillingAccounts + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IListBillingAccountsRequest} request ListBillingAccountsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#updateBillingAccount}. + * @memberof google.cloud.billing.v1.CloudBilling + * @typedef UpdateBillingAccountCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.BillingAccount} [response] BillingAccount + */ + + /** + * Calls UpdateBillingAccount. + * @function updateBillingAccount + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IUpdateBillingAccountRequest} request UpdateBillingAccountRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.UpdateBillingAccountCallback} callback Node-style callback called with the error, if any, and BillingAccount + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.prototype.updateBillingAccount = function updateBillingAccount(request, callback) { + return this.rpcCall(updateBillingAccount, $root.google.cloud.billing.v1.UpdateBillingAccountRequest, $root.google.cloud.billing.v1.BillingAccount, request, callback); + }, "name", { value: "UpdateBillingAccount" }); + + /** + * Calls UpdateBillingAccount. + * @function updateBillingAccount + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IUpdateBillingAccountRequest} request UpdateBillingAccountRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#createBillingAccount}. + * @memberof google.cloud.billing.v1.CloudBilling + * @typedef CreateBillingAccountCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.BillingAccount} [response] BillingAccount + */ + + /** + * Calls CreateBillingAccount. + * @function createBillingAccount + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.ICreateBillingAccountRequest} request CreateBillingAccountRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.CreateBillingAccountCallback} callback Node-style callback called with the error, if any, and BillingAccount + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.prototype.createBillingAccount = function createBillingAccount(request, callback) { + return this.rpcCall(createBillingAccount, $root.google.cloud.billing.v1.CreateBillingAccountRequest, $root.google.cloud.billing.v1.BillingAccount, request, callback); + }, "name", { value: "CreateBillingAccount" }); + + /** + * Calls CreateBillingAccount. + * @function createBillingAccount + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.ICreateBillingAccountRequest} request CreateBillingAccountRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#listProjectBillingInfo}. + * @memberof google.cloud.billing.v1.CloudBilling + * @typedef ListProjectBillingInfoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.ListProjectBillingInfoResponse} [response] ListProjectBillingInfoResponse + */ + + /** + * Calls ListProjectBillingInfo. + * @function listProjectBillingInfo + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IListProjectBillingInfoRequest} request ListProjectBillingInfoRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.ListProjectBillingInfoCallback} callback Node-style callback called with the error, if any, and ListProjectBillingInfoResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.prototype.listProjectBillingInfo = function listProjectBillingInfo(request, callback) { + return this.rpcCall(listProjectBillingInfo, $root.google.cloud.billing.v1.ListProjectBillingInfoRequest, $root.google.cloud.billing.v1.ListProjectBillingInfoResponse, request, callback); + }, "name", { value: "ListProjectBillingInfo" }); + + /** + * Calls ListProjectBillingInfo. + * @function listProjectBillingInfo + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IListProjectBillingInfoRequest} request ListProjectBillingInfoRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getProjectBillingInfo}. + * @memberof google.cloud.billing.v1.CloudBilling + * @typedef GetProjectBillingInfoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.ProjectBillingInfo} [response] ProjectBillingInfo + */ + + /** + * Calls GetProjectBillingInfo. + * @function getProjectBillingInfo + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IGetProjectBillingInfoRequest} request GetProjectBillingInfoRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.GetProjectBillingInfoCallback} callback Node-style callback called with the error, if any, and ProjectBillingInfo + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.prototype.getProjectBillingInfo = function getProjectBillingInfo(request, callback) { + return this.rpcCall(getProjectBillingInfo, $root.google.cloud.billing.v1.GetProjectBillingInfoRequest, $root.google.cloud.billing.v1.ProjectBillingInfo, request, callback); + }, "name", { value: "GetProjectBillingInfo" }); + + /** + * Calls GetProjectBillingInfo. + * @function getProjectBillingInfo + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IGetProjectBillingInfoRequest} request GetProjectBillingInfoRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#updateProjectBillingInfo}. + * @memberof google.cloud.billing.v1.CloudBilling + * @typedef UpdateProjectBillingInfoCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.ProjectBillingInfo} [response] ProjectBillingInfo + */ + + /** + * Calls UpdateProjectBillingInfo. + * @function updateProjectBillingInfo + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IUpdateProjectBillingInfoRequest} request UpdateProjectBillingInfoRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfoCallback} callback Node-style callback called with the error, if any, and ProjectBillingInfo + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.prototype.updateProjectBillingInfo = function updateProjectBillingInfo(request, callback) { + return this.rpcCall(updateProjectBillingInfo, $root.google.cloud.billing.v1.UpdateProjectBillingInfoRequest, $root.google.cloud.billing.v1.ProjectBillingInfo, request, callback); + }, "name", { value: "UpdateProjectBillingInfo" }); + + /** + * Calls UpdateProjectBillingInfo. + * @function updateProjectBillingInfo + * @memberof google.cloud.billing.v1.CloudBilling + * @instance + * @param {google.cloud.billing.v1.IUpdateProjectBillingInfoRequest} request UpdateProjectBillingInfoRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getIamPolicy}. + * @memberof google.cloud.billing.v1.CloudBilling + * @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.billing.v1.CloudBilling + * @instance + * @param {google.iam.v1.IGetIamPolicyRequest} request GetIamPolicyRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.GetIamPolicyCallback} callback Node-style callback called with the error, if any, and Policy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.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.billing.v1.CloudBilling + * @instance + * @param {google.iam.v1.IGetIamPolicyRequest} request GetIamPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#setIamPolicy}. + * @memberof google.cloud.billing.v1.CloudBilling + * @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.billing.v1.CloudBilling + * @instance + * @param {google.iam.v1.ISetIamPolicyRequest} request SetIamPolicyRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.SetIamPolicyCallback} callback Node-style callback called with the error, if any, and Policy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.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.billing.v1.CloudBilling + * @instance + * @param {google.iam.v1.ISetIamPolicyRequest} request SetIamPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudBilling#testIamPermissions}. + * @memberof google.cloud.billing.v1.CloudBilling + * @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.billing.v1.CloudBilling + * @instance + * @param {google.iam.v1.ITestIamPermissionsRequest} request TestIamPermissionsRequest message or plain object + * @param {google.cloud.billing.v1.CloudBilling.TestIamPermissionsCallback} callback Node-style callback called with the error, if any, and TestIamPermissionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudBilling.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.billing.v1.CloudBilling + * @instance + * @param {google.iam.v1.ITestIamPermissionsRequest} request TestIamPermissionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CloudBilling; + })(); + + v1.BillingAccount = (function() { + + /** + * Properties of a BillingAccount. + * @memberof google.cloud.billing.v1 + * @interface IBillingAccount + * @property {string|null} [name] BillingAccount name + * @property {boolean|null} [open] BillingAccount open + * @property {string|null} [displayName] BillingAccount displayName + * @property {string|null} [masterBillingAccount] BillingAccount masterBillingAccount + */ + + /** + * Constructs a new BillingAccount. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a BillingAccount. + * @implements IBillingAccount + * @constructor + * @param {google.cloud.billing.v1.IBillingAccount=} [properties] Properties to set + */ + function BillingAccount(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]]; + } + + /** + * BillingAccount name. + * @member {string} name + * @memberof google.cloud.billing.v1.BillingAccount + * @instance + */ + BillingAccount.prototype.name = ""; + + /** + * BillingAccount open. + * @member {boolean} open + * @memberof google.cloud.billing.v1.BillingAccount + * @instance + */ + BillingAccount.prototype.open = false; + + /** + * BillingAccount displayName. + * @member {string} displayName + * @memberof google.cloud.billing.v1.BillingAccount + * @instance + */ + BillingAccount.prototype.displayName = ""; + + /** + * BillingAccount masterBillingAccount. + * @member {string} masterBillingAccount + * @memberof google.cloud.billing.v1.BillingAccount + * @instance + */ + BillingAccount.prototype.masterBillingAccount = ""; + + /** + * Creates a new BillingAccount instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {google.cloud.billing.v1.IBillingAccount=} [properties] Properties to set + * @returns {google.cloud.billing.v1.BillingAccount} BillingAccount instance + */ + BillingAccount.create = function create(properties) { + return new BillingAccount(properties); + }; + + /** + * Encodes the specified BillingAccount message. Does not implicitly {@link google.cloud.billing.v1.BillingAccount.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {google.cloud.billing.v1.IBillingAccount} message BillingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BillingAccount.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.open != null && message.hasOwnProperty("open")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.open); + if (message.displayName != null && message.hasOwnProperty("displayName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); + if (message.masterBillingAccount != null && message.hasOwnProperty("masterBillingAccount")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.masterBillingAccount); + return writer; + }; + + /** + * Encodes the specified BillingAccount message, length delimited. Does not implicitly {@link google.cloud.billing.v1.BillingAccount.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {google.cloud.billing.v1.IBillingAccount} message BillingAccount message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BillingAccount.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BillingAccount message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.BillingAccount} BillingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BillingAccount.decode = function 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.billing.v1.BillingAccount(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.open = reader.bool(); + break; + case 3: + message.displayName = reader.string(); + break; + case 4: + message.masterBillingAccount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BillingAccount message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.BillingAccount} BillingAccount + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BillingAccount.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BillingAccount message. + * @function verify + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BillingAccount.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.open != null && message.hasOwnProperty("open")) + if (typeof message.open !== "boolean") + return "open: boolean expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.masterBillingAccount != null && message.hasOwnProperty("masterBillingAccount")) + if (!$util.isString(message.masterBillingAccount)) + return "masterBillingAccount: string expected"; + return null; + }; + + /** + * Creates a BillingAccount message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.BillingAccount} BillingAccount + */ + BillingAccount.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.BillingAccount) + return object; + var message = new $root.google.cloud.billing.v1.BillingAccount(); + if (object.name != null) + message.name = String(object.name); + if (object.open != null) + message.open = Boolean(object.open); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.masterBillingAccount != null) + message.masterBillingAccount = String(object.masterBillingAccount); + return message; + }; + + /** + * Creates a plain object from a BillingAccount message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {google.cloud.billing.v1.BillingAccount} message BillingAccount + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BillingAccount.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.open = false; + object.displayName = ""; + object.masterBillingAccount = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.open != null && message.hasOwnProperty("open")) + object.open = message.open; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.masterBillingAccount != null && message.hasOwnProperty("masterBillingAccount")) + object.masterBillingAccount = message.masterBillingAccount; + return object; + }; + + /** + * Converts this BillingAccount to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.BillingAccount + * @instance + * @returns {Object.} JSON object + */ + BillingAccount.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BillingAccount; + })(); + + v1.ProjectBillingInfo = (function() { + + /** + * Properties of a ProjectBillingInfo. + * @memberof google.cloud.billing.v1 + * @interface IProjectBillingInfo + * @property {string|null} [name] ProjectBillingInfo name + * @property {string|null} [projectId] ProjectBillingInfo projectId + * @property {string|null} [billingAccountName] ProjectBillingInfo billingAccountName + * @property {boolean|null} [billingEnabled] ProjectBillingInfo billingEnabled + */ + + /** + * Constructs a new ProjectBillingInfo. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ProjectBillingInfo. + * @implements IProjectBillingInfo + * @constructor + * @param {google.cloud.billing.v1.IProjectBillingInfo=} [properties] Properties to set + */ + function ProjectBillingInfo(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]]; + } + + /** + * ProjectBillingInfo name. + * @member {string} name + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @instance + */ + ProjectBillingInfo.prototype.name = ""; + + /** + * ProjectBillingInfo projectId. + * @member {string} projectId + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @instance + */ + ProjectBillingInfo.prototype.projectId = ""; + + /** + * ProjectBillingInfo billingAccountName. + * @member {string} billingAccountName + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @instance + */ + ProjectBillingInfo.prototype.billingAccountName = ""; + + /** + * ProjectBillingInfo billingEnabled. + * @member {boolean} billingEnabled + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @instance + */ + ProjectBillingInfo.prototype.billingEnabled = false; + + /** + * Creates a new ProjectBillingInfo instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {google.cloud.billing.v1.IProjectBillingInfo=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ProjectBillingInfo} ProjectBillingInfo instance + */ + ProjectBillingInfo.create = function create(properties) { + return new ProjectBillingInfo(properties); + }; + + /** + * Encodes the specified ProjectBillingInfo message. Does not implicitly {@link google.cloud.billing.v1.ProjectBillingInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {google.cloud.billing.v1.IProjectBillingInfo} message ProjectBillingInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProjectBillingInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.projectId != null && message.hasOwnProperty("projectId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); + if (message.billingAccountName != null && message.hasOwnProperty("billingAccountName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.billingAccountName); + if (message.billingEnabled != null && message.hasOwnProperty("billingEnabled")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.billingEnabled); + return writer; + }; + + /** + * Encodes the specified ProjectBillingInfo message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ProjectBillingInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {google.cloud.billing.v1.IProjectBillingInfo} message ProjectBillingInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProjectBillingInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProjectBillingInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ProjectBillingInfo} ProjectBillingInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProjectBillingInfo.decode = function 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.billing.v1.ProjectBillingInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.projectId = reader.string(); + break; + case 3: + message.billingAccountName = reader.string(); + break; + case 4: + message.billingEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProjectBillingInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ProjectBillingInfo} ProjectBillingInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProjectBillingInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProjectBillingInfo message. + * @function verify + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProjectBillingInfo.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.projectId != null && message.hasOwnProperty("projectId")) + if (!$util.isString(message.projectId)) + return "projectId: string expected"; + if (message.billingAccountName != null && message.hasOwnProperty("billingAccountName")) + if (!$util.isString(message.billingAccountName)) + return "billingAccountName: string expected"; + if (message.billingEnabled != null && message.hasOwnProperty("billingEnabled")) + if (typeof message.billingEnabled !== "boolean") + return "billingEnabled: boolean expected"; + return null; + }; + + /** + * Creates a ProjectBillingInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ProjectBillingInfo} ProjectBillingInfo + */ + ProjectBillingInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ProjectBillingInfo) + return object; + var message = new $root.google.cloud.billing.v1.ProjectBillingInfo(); + if (object.name != null) + message.name = String(object.name); + if (object.projectId != null) + message.projectId = String(object.projectId); + if (object.billingAccountName != null) + message.billingAccountName = String(object.billingAccountName); + if (object.billingEnabled != null) + message.billingEnabled = Boolean(object.billingEnabled); + return message; + }; + + /** + * Creates a plain object from a ProjectBillingInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {google.cloud.billing.v1.ProjectBillingInfo} message ProjectBillingInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProjectBillingInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.projectId = ""; + object.billingAccountName = ""; + object.billingEnabled = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.projectId != null && message.hasOwnProperty("projectId")) + object.projectId = message.projectId; + if (message.billingAccountName != null && message.hasOwnProperty("billingAccountName")) + object.billingAccountName = message.billingAccountName; + if (message.billingEnabled != null && message.hasOwnProperty("billingEnabled")) + object.billingEnabled = message.billingEnabled; + return object; + }; + + /** + * Converts this ProjectBillingInfo to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @instance + * @returns {Object.} JSON object + */ + ProjectBillingInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ProjectBillingInfo; + })(); + + v1.GetBillingAccountRequest = (function() { + + /** + * Properties of a GetBillingAccountRequest. + * @memberof google.cloud.billing.v1 + * @interface IGetBillingAccountRequest + * @property {string|null} [name] GetBillingAccountRequest name + */ + + /** + * Constructs a new GetBillingAccountRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a GetBillingAccountRequest. + * @implements IGetBillingAccountRequest + * @constructor + * @param {google.cloud.billing.v1.IGetBillingAccountRequest=} [properties] Properties to set + */ + function GetBillingAccountRequest(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]]; + } + + /** + * GetBillingAccountRequest name. + * @member {string} name + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @instance + */ + GetBillingAccountRequest.prototype.name = ""; + + /** + * Creates a new GetBillingAccountRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.IGetBillingAccountRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.GetBillingAccountRequest} GetBillingAccountRequest instance + */ + GetBillingAccountRequest.create = function create(properties) { + return new GetBillingAccountRequest(properties); + }; + + /** + * Encodes the specified GetBillingAccountRequest message. Does not implicitly {@link google.cloud.billing.v1.GetBillingAccountRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.IGetBillingAccountRequest} message GetBillingAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBillingAccountRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetBillingAccountRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.GetBillingAccountRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.IGetBillingAccountRequest} message GetBillingAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBillingAccountRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBillingAccountRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.GetBillingAccountRequest} GetBillingAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBillingAccountRequest.decode = function 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.billing.v1.GetBillingAccountRequest(); + 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 GetBillingAccountRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.GetBillingAccountRequest} GetBillingAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBillingAccountRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBillingAccountRequest message. + * @function verify + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBillingAccountRequest.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 GetBillingAccountRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.GetBillingAccountRequest} GetBillingAccountRequest + */ + GetBillingAccountRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.GetBillingAccountRequest) + return object; + var message = new $root.google.cloud.billing.v1.GetBillingAccountRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetBillingAccountRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.GetBillingAccountRequest} message GetBillingAccountRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBillingAccountRequest.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 GetBillingAccountRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @instance + * @returns {Object.} JSON object + */ + GetBillingAccountRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetBillingAccountRequest; + })(); + + v1.ListBillingAccountsRequest = (function() { + + /** + * Properties of a ListBillingAccountsRequest. + * @memberof google.cloud.billing.v1 + * @interface IListBillingAccountsRequest + * @property {number|null} [pageSize] ListBillingAccountsRequest pageSize + * @property {string|null} [pageToken] ListBillingAccountsRequest pageToken + * @property {string|null} [filter] ListBillingAccountsRequest filter + */ + + /** + * Constructs a new ListBillingAccountsRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ListBillingAccountsRequest. + * @implements IListBillingAccountsRequest + * @constructor + * @param {google.cloud.billing.v1.IListBillingAccountsRequest=} [properties] Properties to set + */ + function ListBillingAccountsRequest(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]]; + } + + /** + * ListBillingAccountsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @instance + */ + ListBillingAccountsRequest.prototype.pageSize = 0; + + /** + * ListBillingAccountsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @instance + */ + ListBillingAccountsRequest.prototype.pageToken = ""; + + /** + * ListBillingAccountsRequest filter. + * @member {string} filter + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @instance + */ + ListBillingAccountsRequest.prototype.filter = ""; + + /** + * Creates a new ListBillingAccountsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {google.cloud.billing.v1.IListBillingAccountsRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ListBillingAccountsRequest} ListBillingAccountsRequest instance + */ + ListBillingAccountsRequest.create = function create(properties) { + return new ListBillingAccountsRequest(properties); + }; + + /** + * Encodes the specified ListBillingAccountsRequest message. Does not implicitly {@link google.cloud.billing.v1.ListBillingAccountsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {google.cloud.billing.v1.IListBillingAccountsRequest} message ListBillingAccountsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBillingAccountsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageSize); + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + if (message.filter != null && message.hasOwnProperty("filter")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListBillingAccountsRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListBillingAccountsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {google.cloud.billing.v1.IListBillingAccountsRequest} message ListBillingAccountsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBillingAccountsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBillingAccountsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ListBillingAccountsRequest} ListBillingAccountsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBillingAccountsRequest.decode = function 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.billing.v1.ListBillingAccountsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageSize = reader.int32(); + break; + case 2: + message.pageToken = reader.string(); + break; + case 3: + message.filter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBillingAccountsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ListBillingAccountsRequest} ListBillingAccountsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBillingAccountsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBillingAccountsRequest message. + * @function verify + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBillingAccountsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object 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"; + return null; + }; + + /** + * Creates a ListBillingAccountsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ListBillingAccountsRequest} ListBillingAccountsRequest + */ + ListBillingAccountsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ListBillingAccountsRequest) + return object; + var message = new $root.google.cloud.billing.v1.ListBillingAccountsRequest(); + 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); + return message; + }; + + /** + * Creates a plain object from a ListBillingAccountsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {google.cloud.billing.v1.ListBillingAccountsRequest} message ListBillingAccountsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBillingAccountsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageSize = 0; + object.pageToken = ""; + object.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.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListBillingAccountsRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @instance + * @returns {Object.} JSON object + */ + ListBillingAccountsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListBillingAccountsRequest; + })(); + + v1.ListBillingAccountsResponse = (function() { + + /** + * Properties of a ListBillingAccountsResponse. + * @memberof google.cloud.billing.v1 + * @interface IListBillingAccountsResponse + * @property {Array.|null} [billingAccounts] ListBillingAccountsResponse billingAccounts + * @property {string|null} [nextPageToken] ListBillingAccountsResponse nextPageToken + */ + + /** + * Constructs a new ListBillingAccountsResponse. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ListBillingAccountsResponse. + * @implements IListBillingAccountsResponse + * @constructor + * @param {google.cloud.billing.v1.IListBillingAccountsResponse=} [properties] Properties to set + */ + function ListBillingAccountsResponse(properties) { + this.billingAccounts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBillingAccountsResponse billingAccounts. + * @member {Array.} billingAccounts + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @instance + */ + ListBillingAccountsResponse.prototype.billingAccounts = $util.emptyArray; + + /** + * ListBillingAccountsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @instance + */ + ListBillingAccountsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListBillingAccountsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {google.cloud.billing.v1.IListBillingAccountsResponse=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ListBillingAccountsResponse} ListBillingAccountsResponse instance + */ + ListBillingAccountsResponse.create = function create(properties) { + return new ListBillingAccountsResponse(properties); + }; + + /** + * Encodes the specified ListBillingAccountsResponse message. Does not implicitly {@link google.cloud.billing.v1.ListBillingAccountsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {google.cloud.billing.v1.IListBillingAccountsResponse} message ListBillingAccountsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBillingAccountsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.billingAccounts != null && message.billingAccounts.length) + for (var i = 0; i < message.billingAccounts.length; ++i) + $root.google.cloud.billing.v1.BillingAccount.encode(message.billingAccounts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListBillingAccountsResponse message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListBillingAccountsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {google.cloud.billing.v1.IListBillingAccountsResponse} message ListBillingAccountsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBillingAccountsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBillingAccountsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ListBillingAccountsResponse} ListBillingAccountsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBillingAccountsResponse.decode = function 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.billing.v1.ListBillingAccountsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.billingAccounts && message.billingAccounts.length)) + message.billingAccounts = []; + message.billingAccounts.push($root.google.cloud.billing.v1.BillingAccount.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBillingAccountsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ListBillingAccountsResponse} ListBillingAccountsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBillingAccountsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBillingAccountsResponse message. + * @function verify + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBillingAccountsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.billingAccounts != null && message.hasOwnProperty("billingAccounts")) { + if (!Array.isArray(message.billingAccounts)) + return "billingAccounts: array expected"; + for (var i = 0; i < message.billingAccounts.length; ++i) { + var error = $root.google.cloud.billing.v1.BillingAccount.verify(message.billingAccounts[i]); + if (error) + return "billingAccounts." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListBillingAccountsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ListBillingAccountsResponse} ListBillingAccountsResponse + */ + ListBillingAccountsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ListBillingAccountsResponse) + return object; + var message = new $root.google.cloud.billing.v1.ListBillingAccountsResponse(); + if (object.billingAccounts) { + if (!Array.isArray(object.billingAccounts)) + throw TypeError(".google.cloud.billing.v1.ListBillingAccountsResponse.billingAccounts: array expected"); + message.billingAccounts = []; + for (var i = 0; i < object.billingAccounts.length; ++i) { + if (typeof object.billingAccounts[i] !== "object") + throw TypeError(".google.cloud.billing.v1.ListBillingAccountsResponse.billingAccounts: object expected"); + message.billingAccounts[i] = $root.google.cloud.billing.v1.BillingAccount.fromObject(object.billingAccounts[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListBillingAccountsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {google.cloud.billing.v1.ListBillingAccountsResponse} message ListBillingAccountsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBillingAccountsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.billingAccounts = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.billingAccounts && message.billingAccounts.length) { + object.billingAccounts = []; + for (var j = 0; j < message.billingAccounts.length; ++j) + object.billingAccounts[j] = $root.google.cloud.billing.v1.BillingAccount.toObject(message.billingAccounts[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListBillingAccountsResponse to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @instance + * @returns {Object.} JSON object + */ + ListBillingAccountsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListBillingAccountsResponse; + })(); + + v1.CreateBillingAccountRequest = (function() { + + /** + * Properties of a CreateBillingAccountRequest. + * @memberof google.cloud.billing.v1 + * @interface ICreateBillingAccountRequest + * @property {google.cloud.billing.v1.IBillingAccount|null} [billingAccount] CreateBillingAccountRequest billingAccount + */ + + /** + * Constructs a new CreateBillingAccountRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a CreateBillingAccountRequest. + * @implements ICreateBillingAccountRequest + * @constructor + * @param {google.cloud.billing.v1.ICreateBillingAccountRequest=} [properties] Properties to set + */ + function CreateBillingAccountRequest(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]]; + } + + /** + * CreateBillingAccountRequest billingAccount. + * @member {google.cloud.billing.v1.IBillingAccount|null|undefined} billingAccount + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @instance + */ + CreateBillingAccountRequest.prototype.billingAccount = null; + + /** + * Creates a new CreateBillingAccountRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.ICreateBillingAccountRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.CreateBillingAccountRequest} CreateBillingAccountRequest instance + */ + CreateBillingAccountRequest.create = function create(properties) { + return new CreateBillingAccountRequest(properties); + }; + + /** + * Encodes the specified CreateBillingAccountRequest message. Does not implicitly {@link google.cloud.billing.v1.CreateBillingAccountRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.ICreateBillingAccountRequest} message CreateBillingAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBillingAccountRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.billingAccount != null && message.hasOwnProperty("billingAccount")) + $root.google.cloud.billing.v1.BillingAccount.encode(message.billingAccount, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateBillingAccountRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.CreateBillingAccountRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.ICreateBillingAccountRequest} message CreateBillingAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBillingAccountRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateBillingAccountRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.CreateBillingAccountRequest} CreateBillingAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBillingAccountRequest.decode = function 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.billing.v1.CreateBillingAccountRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.billingAccount = $root.google.cloud.billing.v1.BillingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateBillingAccountRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.CreateBillingAccountRequest} CreateBillingAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBillingAccountRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateBillingAccountRequest message. + * @function verify + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateBillingAccountRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.billingAccount != null && message.hasOwnProperty("billingAccount")) { + var error = $root.google.cloud.billing.v1.BillingAccount.verify(message.billingAccount); + if (error) + return "billingAccount." + error; + } + return null; + }; + + /** + * Creates a CreateBillingAccountRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.CreateBillingAccountRequest} CreateBillingAccountRequest + */ + CreateBillingAccountRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.CreateBillingAccountRequest) + return object; + var message = new $root.google.cloud.billing.v1.CreateBillingAccountRequest(); + if (object.billingAccount != null) { + if (typeof object.billingAccount !== "object") + throw TypeError(".google.cloud.billing.v1.CreateBillingAccountRequest.billingAccount: object expected"); + message.billingAccount = $root.google.cloud.billing.v1.BillingAccount.fromObject(object.billingAccount); + } + return message; + }; + + /** + * Creates a plain object from a CreateBillingAccountRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.CreateBillingAccountRequest} message CreateBillingAccountRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateBillingAccountRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.billingAccount = null; + if (message.billingAccount != null && message.hasOwnProperty("billingAccount")) + object.billingAccount = $root.google.cloud.billing.v1.BillingAccount.toObject(message.billingAccount, options); + return object; + }; + + /** + * Converts this CreateBillingAccountRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @instance + * @returns {Object.} JSON object + */ + CreateBillingAccountRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateBillingAccountRequest; + })(); + + v1.UpdateBillingAccountRequest = (function() { + + /** + * Properties of an UpdateBillingAccountRequest. + * @memberof google.cloud.billing.v1 + * @interface IUpdateBillingAccountRequest + * @property {string|null} [name] UpdateBillingAccountRequest name + * @property {google.cloud.billing.v1.IBillingAccount|null} [account] UpdateBillingAccountRequest account + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateBillingAccountRequest updateMask + */ + + /** + * Constructs a new UpdateBillingAccountRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents an UpdateBillingAccountRequest. + * @implements IUpdateBillingAccountRequest + * @constructor + * @param {google.cloud.billing.v1.IUpdateBillingAccountRequest=} [properties] Properties to set + */ + function UpdateBillingAccountRequest(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]]; + } + + /** + * UpdateBillingAccountRequest name. + * @member {string} name + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @instance + */ + UpdateBillingAccountRequest.prototype.name = ""; + + /** + * UpdateBillingAccountRequest account. + * @member {google.cloud.billing.v1.IBillingAccount|null|undefined} account + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @instance + */ + UpdateBillingAccountRequest.prototype.account = null; + + /** + * UpdateBillingAccountRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @instance + */ + UpdateBillingAccountRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateBillingAccountRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.IUpdateBillingAccountRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.UpdateBillingAccountRequest} UpdateBillingAccountRequest instance + */ + UpdateBillingAccountRequest.create = function create(properties) { + return new UpdateBillingAccountRequest(properties); + }; + + /** + * Encodes the specified UpdateBillingAccountRequest message. Does not implicitly {@link google.cloud.billing.v1.UpdateBillingAccountRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.IUpdateBillingAccountRequest} message UpdateBillingAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBillingAccountRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.account != null && message.hasOwnProperty("account")) + $root.google.cloud.billing.v1.BillingAccount.encode(message.account, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateBillingAccountRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.UpdateBillingAccountRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.IUpdateBillingAccountRequest} message UpdateBillingAccountRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBillingAccountRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateBillingAccountRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.UpdateBillingAccountRequest} UpdateBillingAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBillingAccountRequest.decode = function 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.billing.v1.UpdateBillingAccountRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.account = $root.google.cloud.billing.v1.BillingAccount.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 an UpdateBillingAccountRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.UpdateBillingAccountRequest} UpdateBillingAccountRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBillingAccountRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateBillingAccountRequest message. + * @function verify + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateBillingAccountRequest.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.account != null && message.hasOwnProperty("account")) { + var error = $root.google.cloud.billing.v1.BillingAccount.verify(message.account); + if (error) + return "account." + 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 UpdateBillingAccountRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.UpdateBillingAccountRequest} UpdateBillingAccountRequest + */ + UpdateBillingAccountRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.UpdateBillingAccountRequest) + return object; + var message = new $root.google.cloud.billing.v1.UpdateBillingAccountRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.account != null) { + if (typeof object.account !== "object") + throw TypeError(".google.cloud.billing.v1.UpdateBillingAccountRequest.account: object expected"); + message.account = $root.google.cloud.billing.v1.BillingAccount.fromObject(object.account); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.billing.v1.UpdateBillingAccountRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateBillingAccountRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {google.cloud.billing.v1.UpdateBillingAccountRequest} message UpdateBillingAccountRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateBillingAccountRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.account = null; + object.updateMask = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.account != null && message.hasOwnProperty("account")) + object.account = $root.google.cloud.billing.v1.BillingAccount.toObject(message.account, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateBillingAccountRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateBillingAccountRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateBillingAccountRequest; + })(); + + v1.ListProjectBillingInfoRequest = (function() { + + /** + * Properties of a ListProjectBillingInfoRequest. + * @memberof google.cloud.billing.v1 + * @interface IListProjectBillingInfoRequest + * @property {string|null} [name] ListProjectBillingInfoRequest name + * @property {number|null} [pageSize] ListProjectBillingInfoRequest pageSize + * @property {string|null} [pageToken] ListProjectBillingInfoRequest pageToken + */ + + /** + * Constructs a new ListProjectBillingInfoRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ListProjectBillingInfoRequest. + * @implements IListProjectBillingInfoRequest + * @constructor + * @param {google.cloud.billing.v1.IListProjectBillingInfoRequest=} [properties] Properties to set + */ + function ListProjectBillingInfoRequest(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]]; + } + + /** + * ListProjectBillingInfoRequest name. + * @member {string} name + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @instance + */ + ListProjectBillingInfoRequest.prototype.name = ""; + + /** + * ListProjectBillingInfoRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @instance + */ + ListProjectBillingInfoRequest.prototype.pageSize = 0; + + /** + * ListProjectBillingInfoRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @instance + */ + ListProjectBillingInfoRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProjectBillingInfoRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IListProjectBillingInfoRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ListProjectBillingInfoRequest} ListProjectBillingInfoRequest instance + */ + ListProjectBillingInfoRequest.create = function create(properties) { + return new ListProjectBillingInfoRequest(properties); + }; + + /** + * Encodes the specified ListProjectBillingInfoRequest message. Does not implicitly {@link google.cloud.billing.v1.ListProjectBillingInfoRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IListProjectBillingInfoRequest} message ListProjectBillingInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProjectBillingInfoRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListProjectBillingInfoRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListProjectBillingInfoRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IListProjectBillingInfoRequest} message ListProjectBillingInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProjectBillingInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProjectBillingInfoRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ListProjectBillingInfoRequest} ListProjectBillingInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProjectBillingInfoRequest.decode = function 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.billing.v1.ListProjectBillingInfoRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = 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 ListProjectBillingInfoRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ListProjectBillingInfoRequest} ListProjectBillingInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProjectBillingInfoRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProjectBillingInfoRequest message. + * @function verify + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProjectBillingInfoRequest.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.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 ListProjectBillingInfoRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ListProjectBillingInfoRequest} ListProjectBillingInfoRequest + */ + ListProjectBillingInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ListProjectBillingInfoRequest) + return object; + var message = new $root.google.cloud.billing.v1.ListProjectBillingInfoRequest(); + if (object.name != null) + message.name = String(object.name); + 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 ListProjectBillingInfoRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.ListProjectBillingInfoRequest} message ListProjectBillingInfoRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProjectBillingInfoRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + 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 ListProjectBillingInfoRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @instance + * @returns {Object.} JSON object + */ + ListProjectBillingInfoRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProjectBillingInfoRequest; + })(); + + v1.ListProjectBillingInfoResponse = (function() { + + /** + * Properties of a ListProjectBillingInfoResponse. + * @memberof google.cloud.billing.v1 + * @interface IListProjectBillingInfoResponse + * @property {Array.|null} [projectBillingInfo] ListProjectBillingInfoResponse projectBillingInfo + * @property {string|null} [nextPageToken] ListProjectBillingInfoResponse nextPageToken + */ + + /** + * Constructs a new ListProjectBillingInfoResponse. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ListProjectBillingInfoResponse. + * @implements IListProjectBillingInfoResponse + * @constructor + * @param {google.cloud.billing.v1.IListProjectBillingInfoResponse=} [properties] Properties to set + */ + function ListProjectBillingInfoResponse(properties) { + this.projectBillingInfo = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListProjectBillingInfoResponse projectBillingInfo. + * @member {Array.} projectBillingInfo + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @instance + */ + ListProjectBillingInfoResponse.prototype.projectBillingInfo = $util.emptyArray; + + /** + * ListProjectBillingInfoResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @instance + */ + ListProjectBillingInfoResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProjectBillingInfoResponse instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {google.cloud.billing.v1.IListProjectBillingInfoResponse=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ListProjectBillingInfoResponse} ListProjectBillingInfoResponse instance + */ + ListProjectBillingInfoResponse.create = function create(properties) { + return new ListProjectBillingInfoResponse(properties); + }; + + /** + * Encodes the specified ListProjectBillingInfoResponse message. Does not implicitly {@link google.cloud.billing.v1.ListProjectBillingInfoResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {google.cloud.billing.v1.IListProjectBillingInfoResponse} message ListProjectBillingInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProjectBillingInfoResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.projectBillingInfo != null && message.projectBillingInfo.length) + for (var i = 0; i < message.projectBillingInfo.length; ++i) + $root.google.cloud.billing.v1.ProjectBillingInfo.encode(message.projectBillingInfo[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListProjectBillingInfoResponse message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListProjectBillingInfoResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {google.cloud.billing.v1.IListProjectBillingInfoResponse} message ListProjectBillingInfoResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProjectBillingInfoResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProjectBillingInfoResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ListProjectBillingInfoResponse} ListProjectBillingInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProjectBillingInfoResponse.decode = function 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.billing.v1.ListProjectBillingInfoResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.projectBillingInfo && message.projectBillingInfo.length)) + message.projectBillingInfo = []; + message.projectBillingInfo.push($root.google.cloud.billing.v1.ProjectBillingInfo.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProjectBillingInfoResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ListProjectBillingInfoResponse} ListProjectBillingInfoResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProjectBillingInfoResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProjectBillingInfoResponse message. + * @function verify + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProjectBillingInfoResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.projectBillingInfo != null && message.hasOwnProperty("projectBillingInfo")) { + if (!Array.isArray(message.projectBillingInfo)) + return "projectBillingInfo: array expected"; + for (var i = 0; i < message.projectBillingInfo.length; ++i) { + var error = $root.google.cloud.billing.v1.ProjectBillingInfo.verify(message.projectBillingInfo[i]); + if (error) + return "projectBillingInfo." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProjectBillingInfoResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ListProjectBillingInfoResponse} ListProjectBillingInfoResponse + */ + ListProjectBillingInfoResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ListProjectBillingInfoResponse) + return object; + var message = new $root.google.cloud.billing.v1.ListProjectBillingInfoResponse(); + if (object.projectBillingInfo) { + if (!Array.isArray(object.projectBillingInfo)) + throw TypeError(".google.cloud.billing.v1.ListProjectBillingInfoResponse.projectBillingInfo: array expected"); + message.projectBillingInfo = []; + for (var i = 0; i < object.projectBillingInfo.length; ++i) { + if (typeof object.projectBillingInfo[i] !== "object") + throw TypeError(".google.cloud.billing.v1.ListProjectBillingInfoResponse.projectBillingInfo: object expected"); + message.projectBillingInfo[i] = $root.google.cloud.billing.v1.ProjectBillingInfo.fromObject(object.projectBillingInfo[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProjectBillingInfoResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {google.cloud.billing.v1.ListProjectBillingInfoResponse} message ListProjectBillingInfoResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProjectBillingInfoResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.projectBillingInfo = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.projectBillingInfo && message.projectBillingInfo.length) { + object.projectBillingInfo = []; + for (var j = 0; j < message.projectBillingInfo.length; ++j) + object.projectBillingInfo[j] = $root.google.cloud.billing.v1.ProjectBillingInfo.toObject(message.projectBillingInfo[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProjectBillingInfoResponse to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @instance + * @returns {Object.} JSON object + */ + ListProjectBillingInfoResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProjectBillingInfoResponse; + })(); + + v1.GetProjectBillingInfoRequest = (function() { + + /** + * Properties of a GetProjectBillingInfoRequest. + * @memberof google.cloud.billing.v1 + * @interface IGetProjectBillingInfoRequest + * @property {string|null} [name] GetProjectBillingInfoRequest name + */ + + /** + * Constructs a new GetProjectBillingInfoRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a GetProjectBillingInfoRequest. + * @implements IGetProjectBillingInfoRequest + * @constructor + * @param {google.cloud.billing.v1.IGetProjectBillingInfoRequest=} [properties] Properties to set + */ + function GetProjectBillingInfoRequest(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]]; + } + + /** + * GetProjectBillingInfoRequest name. + * @member {string} name + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @instance + */ + GetProjectBillingInfoRequest.prototype.name = ""; + + /** + * Creates a new GetProjectBillingInfoRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IGetProjectBillingInfoRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.GetProjectBillingInfoRequest} GetProjectBillingInfoRequest instance + */ + GetProjectBillingInfoRequest.create = function create(properties) { + return new GetProjectBillingInfoRequest(properties); + }; + + /** + * Encodes the specified GetProjectBillingInfoRequest message. Does not implicitly {@link google.cloud.billing.v1.GetProjectBillingInfoRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IGetProjectBillingInfoRequest} message GetProjectBillingInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProjectBillingInfoRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetProjectBillingInfoRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.GetProjectBillingInfoRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IGetProjectBillingInfoRequest} message GetProjectBillingInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProjectBillingInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProjectBillingInfoRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.GetProjectBillingInfoRequest} GetProjectBillingInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProjectBillingInfoRequest.decode = function 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.billing.v1.GetProjectBillingInfoRequest(); + 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 GetProjectBillingInfoRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.GetProjectBillingInfoRequest} GetProjectBillingInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProjectBillingInfoRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProjectBillingInfoRequest message. + * @function verify + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProjectBillingInfoRequest.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 GetProjectBillingInfoRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.GetProjectBillingInfoRequest} GetProjectBillingInfoRequest + */ + GetProjectBillingInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.GetProjectBillingInfoRequest) + return object; + var message = new $root.google.cloud.billing.v1.GetProjectBillingInfoRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProjectBillingInfoRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.GetProjectBillingInfoRequest} message GetProjectBillingInfoRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProjectBillingInfoRequest.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 GetProjectBillingInfoRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @instance + * @returns {Object.} JSON object + */ + GetProjectBillingInfoRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProjectBillingInfoRequest; + })(); + + v1.UpdateProjectBillingInfoRequest = (function() { + + /** + * Properties of an UpdateProjectBillingInfoRequest. + * @memberof google.cloud.billing.v1 + * @interface IUpdateProjectBillingInfoRequest + * @property {string|null} [name] UpdateProjectBillingInfoRequest name + * @property {google.cloud.billing.v1.IProjectBillingInfo|null} [projectBillingInfo] UpdateProjectBillingInfoRequest projectBillingInfo + */ + + /** + * Constructs a new UpdateProjectBillingInfoRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents an UpdateProjectBillingInfoRequest. + * @implements IUpdateProjectBillingInfoRequest + * @constructor + * @param {google.cloud.billing.v1.IUpdateProjectBillingInfoRequest=} [properties] Properties to set + */ + function UpdateProjectBillingInfoRequest(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]]; + } + + /** + * UpdateProjectBillingInfoRequest name. + * @member {string} name + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @instance + */ + UpdateProjectBillingInfoRequest.prototype.name = ""; + + /** + * UpdateProjectBillingInfoRequest projectBillingInfo. + * @member {google.cloud.billing.v1.IProjectBillingInfo|null|undefined} projectBillingInfo + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @instance + */ + UpdateProjectBillingInfoRequest.prototype.projectBillingInfo = null; + + /** + * Creates a new UpdateProjectBillingInfoRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IUpdateProjectBillingInfoRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.UpdateProjectBillingInfoRequest} UpdateProjectBillingInfoRequest instance + */ + UpdateProjectBillingInfoRequest.create = function create(properties) { + return new UpdateProjectBillingInfoRequest(properties); + }; + + /** + * Encodes the specified UpdateProjectBillingInfoRequest message. Does not implicitly {@link google.cloud.billing.v1.UpdateProjectBillingInfoRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IUpdateProjectBillingInfoRequest} message UpdateProjectBillingInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProjectBillingInfoRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.projectBillingInfo != null && message.hasOwnProperty("projectBillingInfo")) + $root.google.cloud.billing.v1.ProjectBillingInfo.encode(message.projectBillingInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateProjectBillingInfoRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.UpdateProjectBillingInfoRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.IUpdateProjectBillingInfoRequest} message UpdateProjectBillingInfoRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateProjectBillingInfoRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateProjectBillingInfoRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.UpdateProjectBillingInfoRequest} UpdateProjectBillingInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProjectBillingInfoRequest.decode = function 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.billing.v1.UpdateProjectBillingInfoRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.projectBillingInfo = $root.google.cloud.billing.v1.ProjectBillingInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateProjectBillingInfoRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.UpdateProjectBillingInfoRequest} UpdateProjectBillingInfoRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateProjectBillingInfoRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateProjectBillingInfoRequest message. + * @function verify + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateProjectBillingInfoRequest.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.projectBillingInfo != null && message.hasOwnProperty("projectBillingInfo")) { + var error = $root.google.cloud.billing.v1.ProjectBillingInfo.verify(message.projectBillingInfo); + if (error) + return "projectBillingInfo." + error; + } + return null; + }; + + /** + * Creates an UpdateProjectBillingInfoRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.UpdateProjectBillingInfoRequest} UpdateProjectBillingInfoRequest + */ + UpdateProjectBillingInfoRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.UpdateProjectBillingInfoRequest) + return object; + var message = new $root.google.cloud.billing.v1.UpdateProjectBillingInfoRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.projectBillingInfo != null) { + if (typeof object.projectBillingInfo !== "object") + throw TypeError(".google.cloud.billing.v1.UpdateProjectBillingInfoRequest.projectBillingInfo: object expected"); + message.projectBillingInfo = $root.google.cloud.billing.v1.ProjectBillingInfo.fromObject(object.projectBillingInfo); + } + return message; + }; + + /** + * Creates a plain object from an UpdateProjectBillingInfoRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {google.cloud.billing.v1.UpdateProjectBillingInfoRequest} message UpdateProjectBillingInfoRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateProjectBillingInfoRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.projectBillingInfo = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.projectBillingInfo != null && message.hasOwnProperty("projectBillingInfo")) + object.projectBillingInfo = $root.google.cloud.billing.v1.ProjectBillingInfo.toObject(message.projectBillingInfo, options); + return object; + }; + + /** + * Converts this UpdateProjectBillingInfoRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateProjectBillingInfoRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UpdateProjectBillingInfoRequest; + })(); + + v1.CloudCatalog = (function() { + + /** + * Constructs a new CloudCatalog service. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a CloudCatalog + * @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 CloudCatalog(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CloudCatalog.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CloudCatalog; + + /** + * Creates new CloudCatalog service using the specified rpc implementation. + * @function create + * @memberof google.cloud.billing.v1.CloudCatalog + * @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 {CloudCatalog} RPC service. Useful where requests and/or responses are streamed. + */ + CloudCatalog.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudCatalog#listServices}. + * @memberof google.cloud.billing.v1.CloudCatalog + * @typedef ListServicesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.ListServicesResponse} [response] ListServicesResponse + */ + + /** + * Calls ListServices. + * @function listServices + * @memberof google.cloud.billing.v1.CloudCatalog + * @instance + * @param {google.cloud.billing.v1.IListServicesRequest} request ListServicesRequest message or plain object + * @param {google.cloud.billing.v1.CloudCatalog.ListServicesCallback} callback Node-style callback called with the error, if any, and ListServicesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudCatalog.prototype.listServices = function listServices(request, callback) { + return this.rpcCall(listServices, $root.google.cloud.billing.v1.ListServicesRequest, $root.google.cloud.billing.v1.ListServicesResponse, request, callback); + }, "name", { value: "ListServices" }); + + /** + * Calls ListServices. + * @function listServices + * @memberof google.cloud.billing.v1.CloudCatalog + * @instance + * @param {google.cloud.billing.v1.IListServicesRequest} request ListServicesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.billing.v1.CloudCatalog#listSkus}. + * @memberof google.cloud.billing.v1.CloudCatalog + * @typedef ListSkusCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.billing.v1.ListSkusResponse} [response] ListSkusResponse + */ + + /** + * Calls ListSkus. + * @function listSkus + * @memberof google.cloud.billing.v1.CloudCatalog + * @instance + * @param {google.cloud.billing.v1.IListSkusRequest} request ListSkusRequest message or plain object + * @param {google.cloud.billing.v1.CloudCatalog.ListSkusCallback} callback Node-style callback called with the error, if any, and ListSkusResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudCatalog.prototype.listSkus = function listSkus(request, callback) { + return this.rpcCall(listSkus, $root.google.cloud.billing.v1.ListSkusRequest, $root.google.cloud.billing.v1.ListSkusResponse, request, callback); + }, "name", { value: "ListSkus" }); + + /** + * Calls ListSkus. + * @function listSkus + * @memberof google.cloud.billing.v1.CloudCatalog + * @instance + * @param {google.cloud.billing.v1.IListSkusRequest} request ListSkusRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CloudCatalog; + })(); + + v1.Service = (function() { + + /** + * Properties of a Service. + * @memberof google.cloud.billing.v1 + * @interface IService + * @property {string|null} [name] Service name + * @property {string|null} [serviceId] Service serviceId + * @property {string|null} [displayName] Service displayName + * @property {string|null} [businessEntityName] Service businessEntityName + */ + + /** + * Constructs a new Service. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a Service. + * @implements IService + * @constructor + * @param {google.cloud.billing.v1.IService=} [properties] Properties to set + */ + function Service(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]]; + } + + /** + * Service name. + * @member {string} name + * @memberof google.cloud.billing.v1.Service + * @instance + */ + Service.prototype.name = ""; + + /** + * Service serviceId. + * @member {string} serviceId + * @memberof google.cloud.billing.v1.Service + * @instance + */ + Service.prototype.serviceId = ""; + + /** + * Service displayName. + * @member {string} displayName + * @memberof google.cloud.billing.v1.Service + * @instance + */ + Service.prototype.displayName = ""; + + /** + * Service businessEntityName. + * @member {string} businessEntityName + * @memberof google.cloud.billing.v1.Service + * @instance + */ + Service.prototype.businessEntityName = ""; + + /** + * Creates a new Service instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.Service + * @static + * @param {google.cloud.billing.v1.IService=} [properties] Properties to set + * @returns {google.cloud.billing.v1.Service} Service instance + */ + Service.create = function create(properties) { + return new Service(properties); + }; + + /** + * Encodes the specified Service message. Does not implicitly {@link google.cloud.billing.v1.Service.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.Service + * @static + * @param {google.cloud.billing.v1.IService} message Service message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Service.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.serviceId != null && message.hasOwnProperty("serviceId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.serviceId); + if (message.displayName != null && message.hasOwnProperty("displayName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); + if (message.businessEntityName != null && message.hasOwnProperty("businessEntityName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.businessEntityName); + return writer; + }; + + /** + * Encodes the specified Service message, length delimited. Does not implicitly {@link google.cloud.billing.v1.Service.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.Service + * @static + * @param {google.cloud.billing.v1.IService} message Service message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Service.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Service message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.Service + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.Service} Service + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Service.decode = function 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.billing.v1.Service(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.serviceId = reader.string(); + break; + case 3: + message.displayName = reader.string(); + break; + case 4: + message.businessEntityName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Service message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.Service + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.Service} Service + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Service.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Service message. + * @function verify + * @memberof google.cloud.billing.v1.Service + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Service.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.serviceId != null && message.hasOwnProperty("serviceId")) + if (!$util.isString(message.serviceId)) + return "serviceId: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.businessEntityName != null && message.hasOwnProperty("businessEntityName")) + if (!$util.isString(message.businessEntityName)) + return "businessEntityName: string expected"; + return null; + }; + + /** + * Creates a Service message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.Service + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.Service} Service + */ + Service.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.Service) + return object; + var message = new $root.google.cloud.billing.v1.Service(); + if (object.name != null) + message.name = String(object.name); + if (object.serviceId != null) + message.serviceId = String(object.serviceId); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.businessEntityName != null) + message.businessEntityName = String(object.businessEntityName); + return message; + }; + + /** + * Creates a plain object from a Service message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.Service + * @static + * @param {google.cloud.billing.v1.Service} message Service + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Service.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.serviceId = ""; + object.displayName = ""; + object.businessEntityName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.serviceId != null && message.hasOwnProperty("serviceId")) + object.serviceId = message.serviceId; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.businessEntityName != null && message.hasOwnProperty("businessEntityName")) + object.businessEntityName = message.businessEntityName; + return object; + }; + + /** + * Converts this Service to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.Service + * @instance + * @returns {Object.} JSON object + */ + Service.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Service; + })(); + + v1.Sku = (function() { + + /** + * Properties of a Sku. + * @memberof google.cloud.billing.v1 + * @interface ISku + * @property {string|null} [name] Sku name + * @property {string|null} [skuId] Sku skuId + * @property {string|null} [description] Sku description + * @property {google.cloud.billing.v1.ICategory|null} [category] Sku category + * @property {Array.|null} [serviceRegions] Sku serviceRegions + * @property {Array.|null} [pricingInfo] Sku pricingInfo + * @property {string|null} [serviceProviderName] Sku serviceProviderName + */ + + /** + * Constructs a new Sku. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a Sku. + * @implements ISku + * @constructor + * @param {google.cloud.billing.v1.ISku=} [properties] Properties to set + */ + function Sku(properties) { + this.serviceRegions = []; + this.pricingInfo = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Sku name. + * @member {string} name + * @memberof google.cloud.billing.v1.Sku + * @instance + */ + Sku.prototype.name = ""; + + /** + * Sku skuId. + * @member {string} skuId + * @memberof google.cloud.billing.v1.Sku + * @instance + */ + Sku.prototype.skuId = ""; + + /** + * Sku description. + * @member {string} description + * @memberof google.cloud.billing.v1.Sku + * @instance + */ + Sku.prototype.description = ""; + + /** + * Sku category. + * @member {google.cloud.billing.v1.ICategory|null|undefined} category + * @memberof google.cloud.billing.v1.Sku + * @instance + */ + Sku.prototype.category = null; + + /** + * Sku serviceRegions. + * @member {Array.} serviceRegions + * @memberof google.cloud.billing.v1.Sku + * @instance + */ + Sku.prototype.serviceRegions = $util.emptyArray; + + /** + * Sku pricingInfo. + * @member {Array.} pricingInfo + * @memberof google.cloud.billing.v1.Sku + * @instance + */ + Sku.prototype.pricingInfo = $util.emptyArray; + + /** + * Sku serviceProviderName. + * @member {string} serviceProviderName + * @memberof google.cloud.billing.v1.Sku + * @instance + */ + Sku.prototype.serviceProviderName = ""; + + /** + * Creates a new Sku instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {google.cloud.billing.v1.ISku=} [properties] Properties to set + * @returns {google.cloud.billing.v1.Sku} Sku instance + */ + Sku.create = function create(properties) { + return new Sku(properties); + }; + + /** + * Encodes the specified Sku message. Does not implicitly {@link google.cloud.billing.v1.Sku.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {google.cloud.billing.v1.ISku} message Sku message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sku.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.skuId != null && message.hasOwnProperty("skuId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.skuId); + if (message.description != null && message.hasOwnProperty("description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.category != null && message.hasOwnProperty("category")) + $root.google.cloud.billing.v1.Category.encode(message.category, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.serviceRegions != null && message.serviceRegions.length) + for (var i = 0; i < message.serviceRegions.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.serviceRegions[i]); + if (message.pricingInfo != null && message.pricingInfo.length) + for (var i = 0; i < message.pricingInfo.length; ++i) + $root.google.cloud.billing.v1.PricingInfo.encode(message.pricingInfo[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.serviceProviderName != null && message.hasOwnProperty("serviceProviderName")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.serviceProviderName); + return writer; + }; + + /** + * Encodes the specified Sku message, length delimited. Does not implicitly {@link google.cloud.billing.v1.Sku.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {google.cloud.billing.v1.ISku} message Sku message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sku.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Sku message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.Sku} Sku + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sku.decode = function 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.billing.v1.Sku(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.skuId = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.category = $root.google.cloud.billing.v1.Category.decode(reader, reader.uint32()); + break; + case 5: + if (!(message.serviceRegions && message.serviceRegions.length)) + message.serviceRegions = []; + message.serviceRegions.push(reader.string()); + break; + case 6: + if (!(message.pricingInfo && message.pricingInfo.length)) + message.pricingInfo = []; + message.pricingInfo.push($root.google.cloud.billing.v1.PricingInfo.decode(reader, reader.uint32())); + break; + case 7: + message.serviceProviderName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Sku message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.Sku} Sku + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sku.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Sku message. + * @function verify + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Sku.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.skuId != null && message.hasOwnProperty("skuId")) + if (!$util.isString(message.skuId)) + return "skuId: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.category != null && message.hasOwnProperty("category")) { + var error = $root.google.cloud.billing.v1.Category.verify(message.category); + if (error) + return "category." + error; + } + if (message.serviceRegions != null && message.hasOwnProperty("serviceRegions")) { + if (!Array.isArray(message.serviceRegions)) + return "serviceRegions: array expected"; + for (var i = 0; i < message.serviceRegions.length; ++i) + if (!$util.isString(message.serviceRegions[i])) + return "serviceRegions: string[] expected"; + } + if (message.pricingInfo != null && message.hasOwnProperty("pricingInfo")) { + if (!Array.isArray(message.pricingInfo)) + return "pricingInfo: array expected"; + for (var i = 0; i < message.pricingInfo.length; ++i) { + var error = $root.google.cloud.billing.v1.PricingInfo.verify(message.pricingInfo[i]); + if (error) + return "pricingInfo." + error; + } + } + if (message.serviceProviderName != null && message.hasOwnProperty("serviceProviderName")) + if (!$util.isString(message.serviceProviderName)) + return "serviceProviderName: string expected"; + return null; + }; + + /** + * Creates a Sku message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.Sku} Sku + */ + Sku.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.Sku) + return object; + var message = new $root.google.cloud.billing.v1.Sku(); + if (object.name != null) + message.name = String(object.name); + if (object.skuId != null) + message.skuId = String(object.skuId); + if (object.description != null) + message.description = String(object.description); + if (object.category != null) { + if (typeof object.category !== "object") + throw TypeError(".google.cloud.billing.v1.Sku.category: object expected"); + message.category = $root.google.cloud.billing.v1.Category.fromObject(object.category); + } + if (object.serviceRegions) { + if (!Array.isArray(object.serviceRegions)) + throw TypeError(".google.cloud.billing.v1.Sku.serviceRegions: array expected"); + message.serviceRegions = []; + for (var i = 0; i < object.serviceRegions.length; ++i) + message.serviceRegions[i] = String(object.serviceRegions[i]); + } + if (object.pricingInfo) { + if (!Array.isArray(object.pricingInfo)) + throw TypeError(".google.cloud.billing.v1.Sku.pricingInfo: array expected"); + message.pricingInfo = []; + for (var i = 0; i < object.pricingInfo.length; ++i) { + if (typeof object.pricingInfo[i] !== "object") + throw TypeError(".google.cloud.billing.v1.Sku.pricingInfo: object expected"); + message.pricingInfo[i] = $root.google.cloud.billing.v1.PricingInfo.fromObject(object.pricingInfo[i]); + } + } + if (object.serviceProviderName != null) + message.serviceProviderName = String(object.serviceProviderName); + return message; + }; + + /** + * Creates a plain object from a Sku message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {google.cloud.billing.v1.Sku} message Sku + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Sku.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.serviceRegions = []; + object.pricingInfo = []; + } + if (options.defaults) { + object.name = ""; + object.skuId = ""; + object.description = ""; + object.category = null; + object.serviceProviderName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.skuId != null && message.hasOwnProperty("skuId")) + object.skuId = message.skuId; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.category != null && message.hasOwnProperty("category")) + object.category = $root.google.cloud.billing.v1.Category.toObject(message.category, options); + if (message.serviceRegions && message.serviceRegions.length) { + object.serviceRegions = []; + for (var j = 0; j < message.serviceRegions.length; ++j) + object.serviceRegions[j] = message.serviceRegions[j]; + } + if (message.pricingInfo && message.pricingInfo.length) { + object.pricingInfo = []; + for (var j = 0; j < message.pricingInfo.length; ++j) + object.pricingInfo[j] = $root.google.cloud.billing.v1.PricingInfo.toObject(message.pricingInfo[j], options); + } + if (message.serviceProviderName != null && message.hasOwnProperty("serviceProviderName")) + object.serviceProviderName = message.serviceProviderName; + return object; + }; + + /** + * Converts this Sku to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.Sku + * @instance + * @returns {Object.} JSON object + */ + Sku.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Sku; + })(); + + v1.Category = (function() { + + /** + * Properties of a Category. + * @memberof google.cloud.billing.v1 + * @interface ICategory + * @property {string|null} [serviceDisplayName] Category serviceDisplayName + * @property {string|null} [resourceFamily] Category resourceFamily + * @property {string|null} [resourceGroup] Category resourceGroup + * @property {string|null} [usageType] Category usageType + */ + + /** + * Constructs a new Category. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a Category. + * @implements ICategory + * @constructor + * @param {google.cloud.billing.v1.ICategory=} [properties] Properties to set + */ + function Category(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]]; + } + + /** + * Category serviceDisplayName. + * @member {string} serviceDisplayName + * @memberof google.cloud.billing.v1.Category + * @instance + */ + Category.prototype.serviceDisplayName = ""; + + /** + * Category resourceFamily. + * @member {string} resourceFamily + * @memberof google.cloud.billing.v1.Category + * @instance + */ + Category.prototype.resourceFamily = ""; + + /** + * Category resourceGroup. + * @member {string} resourceGroup + * @memberof google.cloud.billing.v1.Category + * @instance + */ + Category.prototype.resourceGroup = ""; + + /** + * Category usageType. + * @member {string} usageType + * @memberof google.cloud.billing.v1.Category + * @instance + */ + Category.prototype.usageType = ""; + + /** + * Creates a new Category instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.Category + * @static + * @param {google.cloud.billing.v1.ICategory=} [properties] Properties to set + * @returns {google.cloud.billing.v1.Category} Category instance + */ + Category.create = function create(properties) { + return new Category(properties); + }; + + /** + * Encodes the specified Category message. Does not implicitly {@link google.cloud.billing.v1.Category.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.Category + * @static + * @param {google.cloud.billing.v1.ICategory} message Category message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Category.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.serviceDisplayName != null && message.hasOwnProperty("serviceDisplayName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.serviceDisplayName); + if (message.resourceFamily != null && message.hasOwnProperty("resourceFamily")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.resourceFamily); + if (message.resourceGroup != null && message.hasOwnProperty("resourceGroup")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.resourceGroup); + if (message.usageType != null && message.hasOwnProperty("usageType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.usageType); + return writer; + }; + + /** + * Encodes the specified Category message, length delimited. Does not implicitly {@link google.cloud.billing.v1.Category.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.Category + * @static + * @param {google.cloud.billing.v1.ICategory} message Category message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Category.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Category message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.Category + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.Category} Category + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Category.decode = function 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.billing.v1.Category(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.serviceDisplayName = reader.string(); + break; + case 2: + message.resourceFamily = reader.string(); + break; + case 3: + message.resourceGroup = reader.string(); + break; + case 4: + message.usageType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Category message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.Category + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.Category} Category + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Category.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Category message. + * @function verify + * @memberof google.cloud.billing.v1.Category + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Category.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.serviceDisplayName != null && message.hasOwnProperty("serviceDisplayName")) + if (!$util.isString(message.serviceDisplayName)) + return "serviceDisplayName: string expected"; + if (message.resourceFamily != null && message.hasOwnProperty("resourceFamily")) + if (!$util.isString(message.resourceFamily)) + return "resourceFamily: string expected"; + if (message.resourceGroup != null && message.hasOwnProperty("resourceGroup")) + if (!$util.isString(message.resourceGroup)) + return "resourceGroup: string expected"; + if (message.usageType != null && message.hasOwnProperty("usageType")) + if (!$util.isString(message.usageType)) + return "usageType: string expected"; + return null; + }; + + /** + * Creates a Category message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.Category + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.Category} Category + */ + Category.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.Category) + return object; + var message = new $root.google.cloud.billing.v1.Category(); + if (object.serviceDisplayName != null) + message.serviceDisplayName = String(object.serviceDisplayName); + if (object.resourceFamily != null) + message.resourceFamily = String(object.resourceFamily); + if (object.resourceGroup != null) + message.resourceGroup = String(object.resourceGroup); + if (object.usageType != null) + message.usageType = String(object.usageType); + return message; + }; + + /** + * Creates a plain object from a Category message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.Category + * @static + * @param {google.cloud.billing.v1.Category} message Category + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Category.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.serviceDisplayName = ""; + object.resourceFamily = ""; + object.resourceGroup = ""; + object.usageType = ""; + } + if (message.serviceDisplayName != null && message.hasOwnProperty("serviceDisplayName")) + object.serviceDisplayName = message.serviceDisplayName; + if (message.resourceFamily != null && message.hasOwnProperty("resourceFamily")) + object.resourceFamily = message.resourceFamily; + if (message.resourceGroup != null && message.hasOwnProperty("resourceGroup")) + object.resourceGroup = message.resourceGroup; + if (message.usageType != null && message.hasOwnProperty("usageType")) + object.usageType = message.usageType; + return object; + }; + + /** + * Converts this Category to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.Category + * @instance + * @returns {Object.} JSON object + */ + Category.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Category; + })(); + + v1.PricingInfo = (function() { + + /** + * Properties of a PricingInfo. + * @memberof google.cloud.billing.v1 + * @interface IPricingInfo + * @property {google.protobuf.ITimestamp|null} [effectiveTime] PricingInfo effectiveTime + * @property {string|null} [summary] PricingInfo summary + * @property {google.cloud.billing.v1.IPricingExpression|null} [pricingExpression] PricingInfo pricingExpression + * @property {google.cloud.billing.v1.IAggregationInfo|null} [aggregationInfo] PricingInfo aggregationInfo + * @property {number|null} [currencyConversionRate] PricingInfo currencyConversionRate + */ + + /** + * Constructs a new PricingInfo. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a PricingInfo. + * @implements IPricingInfo + * @constructor + * @param {google.cloud.billing.v1.IPricingInfo=} [properties] Properties to set + */ + function PricingInfo(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]]; + } + + /** + * PricingInfo effectiveTime. + * @member {google.protobuf.ITimestamp|null|undefined} effectiveTime + * @memberof google.cloud.billing.v1.PricingInfo + * @instance + */ + PricingInfo.prototype.effectiveTime = null; + + /** + * PricingInfo summary. + * @member {string} summary + * @memberof google.cloud.billing.v1.PricingInfo + * @instance + */ + PricingInfo.prototype.summary = ""; + + /** + * PricingInfo pricingExpression. + * @member {google.cloud.billing.v1.IPricingExpression|null|undefined} pricingExpression + * @memberof google.cloud.billing.v1.PricingInfo + * @instance + */ + PricingInfo.prototype.pricingExpression = null; + + /** + * PricingInfo aggregationInfo. + * @member {google.cloud.billing.v1.IAggregationInfo|null|undefined} aggregationInfo + * @memberof google.cloud.billing.v1.PricingInfo + * @instance + */ + PricingInfo.prototype.aggregationInfo = null; + + /** + * PricingInfo currencyConversionRate. + * @member {number} currencyConversionRate + * @memberof google.cloud.billing.v1.PricingInfo + * @instance + */ + PricingInfo.prototype.currencyConversionRate = 0; + + /** + * Creates a new PricingInfo instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {google.cloud.billing.v1.IPricingInfo=} [properties] Properties to set + * @returns {google.cloud.billing.v1.PricingInfo} PricingInfo instance + */ + PricingInfo.create = function create(properties) { + return new PricingInfo(properties); + }; + + /** + * Encodes the specified PricingInfo message. Does not implicitly {@link google.cloud.billing.v1.PricingInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {google.cloud.billing.v1.IPricingInfo} message PricingInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PricingInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.effectiveTime != null && message.hasOwnProperty("effectiveTime")) + $root.google.protobuf.Timestamp.encode(message.effectiveTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.summary != null && message.hasOwnProperty("summary")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.summary); + if (message.pricingExpression != null && message.hasOwnProperty("pricingExpression")) + $root.google.cloud.billing.v1.PricingExpression.encode(message.pricingExpression, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.aggregationInfo != null && message.hasOwnProperty("aggregationInfo")) + $root.google.cloud.billing.v1.AggregationInfo.encode(message.aggregationInfo, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.currencyConversionRate != null && message.hasOwnProperty("currencyConversionRate")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.currencyConversionRate); + return writer; + }; + + /** + * Encodes the specified PricingInfo message, length delimited. Does not implicitly {@link google.cloud.billing.v1.PricingInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {google.cloud.billing.v1.IPricingInfo} message PricingInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PricingInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PricingInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.PricingInfo} PricingInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PricingInfo.decode = function 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.billing.v1.PricingInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.effectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.summary = reader.string(); + break; + case 3: + message.pricingExpression = $root.google.cloud.billing.v1.PricingExpression.decode(reader, reader.uint32()); + break; + case 4: + message.aggregationInfo = $root.google.cloud.billing.v1.AggregationInfo.decode(reader, reader.uint32()); + break; + case 5: + message.currencyConversionRate = reader.double(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PricingInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.PricingInfo} PricingInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PricingInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PricingInfo message. + * @function verify + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PricingInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.effectiveTime != null && message.hasOwnProperty("effectiveTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.effectiveTime); + if (error) + return "effectiveTime." + error; + } + if (message.summary != null && message.hasOwnProperty("summary")) + if (!$util.isString(message.summary)) + return "summary: string expected"; + if (message.pricingExpression != null && message.hasOwnProperty("pricingExpression")) { + var error = $root.google.cloud.billing.v1.PricingExpression.verify(message.pricingExpression); + if (error) + return "pricingExpression." + error; + } + if (message.aggregationInfo != null && message.hasOwnProperty("aggregationInfo")) { + var error = $root.google.cloud.billing.v1.AggregationInfo.verify(message.aggregationInfo); + if (error) + return "aggregationInfo." + error; + } + if (message.currencyConversionRate != null && message.hasOwnProperty("currencyConversionRate")) + if (typeof message.currencyConversionRate !== "number") + return "currencyConversionRate: number expected"; + return null; + }; + + /** + * Creates a PricingInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.PricingInfo} PricingInfo + */ + PricingInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.PricingInfo) + return object; + var message = new $root.google.cloud.billing.v1.PricingInfo(); + if (object.effectiveTime != null) { + if (typeof object.effectiveTime !== "object") + throw TypeError(".google.cloud.billing.v1.PricingInfo.effectiveTime: object expected"); + message.effectiveTime = $root.google.protobuf.Timestamp.fromObject(object.effectiveTime); + } + if (object.summary != null) + message.summary = String(object.summary); + if (object.pricingExpression != null) { + if (typeof object.pricingExpression !== "object") + throw TypeError(".google.cloud.billing.v1.PricingInfo.pricingExpression: object expected"); + message.pricingExpression = $root.google.cloud.billing.v1.PricingExpression.fromObject(object.pricingExpression); + } + if (object.aggregationInfo != null) { + if (typeof object.aggregationInfo !== "object") + throw TypeError(".google.cloud.billing.v1.PricingInfo.aggregationInfo: object expected"); + message.aggregationInfo = $root.google.cloud.billing.v1.AggregationInfo.fromObject(object.aggregationInfo); + } + if (object.currencyConversionRate != null) + message.currencyConversionRate = Number(object.currencyConversionRate); + return message; + }; + + /** + * Creates a plain object from a PricingInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {google.cloud.billing.v1.PricingInfo} message PricingInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PricingInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.effectiveTime = null; + object.summary = ""; + object.pricingExpression = null; + object.aggregationInfo = null; + object.currencyConversionRate = 0; + } + if (message.effectiveTime != null && message.hasOwnProperty("effectiveTime")) + object.effectiveTime = $root.google.protobuf.Timestamp.toObject(message.effectiveTime, options); + if (message.summary != null && message.hasOwnProperty("summary")) + object.summary = message.summary; + if (message.pricingExpression != null && message.hasOwnProperty("pricingExpression")) + object.pricingExpression = $root.google.cloud.billing.v1.PricingExpression.toObject(message.pricingExpression, options); + if (message.aggregationInfo != null && message.hasOwnProperty("aggregationInfo")) + object.aggregationInfo = $root.google.cloud.billing.v1.AggregationInfo.toObject(message.aggregationInfo, options); + if (message.currencyConversionRate != null && message.hasOwnProperty("currencyConversionRate")) + object.currencyConversionRate = options.json && !isFinite(message.currencyConversionRate) ? String(message.currencyConversionRate) : message.currencyConversionRate; + return object; + }; + + /** + * Converts this PricingInfo to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.PricingInfo + * @instance + * @returns {Object.} JSON object + */ + PricingInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PricingInfo; + })(); + + v1.PricingExpression = (function() { + + /** + * Properties of a PricingExpression. + * @memberof google.cloud.billing.v1 + * @interface IPricingExpression + * @property {string|null} [usageUnit] PricingExpression usageUnit + * @property {string|null} [usageUnitDescription] PricingExpression usageUnitDescription + * @property {string|null} [baseUnit] PricingExpression baseUnit + * @property {string|null} [baseUnitDescription] PricingExpression baseUnitDescription + * @property {number|null} [baseUnitConversionFactor] PricingExpression baseUnitConversionFactor + * @property {number|null} [displayQuantity] PricingExpression displayQuantity + * @property {Array.|null} [tieredRates] PricingExpression tieredRates + */ + + /** + * Constructs a new PricingExpression. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a PricingExpression. + * @implements IPricingExpression + * @constructor + * @param {google.cloud.billing.v1.IPricingExpression=} [properties] Properties to set + */ + function PricingExpression(properties) { + this.tieredRates = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PricingExpression usageUnit. + * @member {string} usageUnit + * @memberof google.cloud.billing.v1.PricingExpression + * @instance + */ + PricingExpression.prototype.usageUnit = ""; + + /** + * PricingExpression usageUnitDescription. + * @member {string} usageUnitDescription + * @memberof google.cloud.billing.v1.PricingExpression + * @instance + */ + PricingExpression.prototype.usageUnitDescription = ""; + + /** + * PricingExpression baseUnit. + * @member {string} baseUnit + * @memberof google.cloud.billing.v1.PricingExpression + * @instance + */ + PricingExpression.prototype.baseUnit = ""; + + /** + * PricingExpression baseUnitDescription. + * @member {string} baseUnitDescription + * @memberof google.cloud.billing.v1.PricingExpression + * @instance + */ + PricingExpression.prototype.baseUnitDescription = ""; + + /** + * PricingExpression baseUnitConversionFactor. + * @member {number} baseUnitConversionFactor + * @memberof google.cloud.billing.v1.PricingExpression + * @instance + */ + PricingExpression.prototype.baseUnitConversionFactor = 0; + + /** + * PricingExpression displayQuantity. + * @member {number} displayQuantity + * @memberof google.cloud.billing.v1.PricingExpression + * @instance + */ + PricingExpression.prototype.displayQuantity = 0; + + /** + * PricingExpression tieredRates. + * @member {Array.} tieredRates + * @memberof google.cloud.billing.v1.PricingExpression + * @instance + */ + PricingExpression.prototype.tieredRates = $util.emptyArray; + + /** + * Creates a new PricingExpression instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {google.cloud.billing.v1.IPricingExpression=} [properties] Properties to set + * @returns {google.cloud.billing.v1.PricingExpression} PricingExpression instance + */ + PricingExpression.create = function create(properties) { + return new PricingExpression(properties); + }; + + /** + * Encodes the specified PricingExpression message. Does not implicitly {@link google.cloud.billing.v1.PricingExpression.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {google.cloud.billing.v1.IPricingExpression} message PricingExpression message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PricingExpression.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.usageUnit != null && message.hasOwnProperty("usageUnit")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.usageUnit); + if (message.displayQuantity != null && message.hasOwnProperty("displayQuantity")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.displayQuantity); + if (message.tieredRates != null && message.tieredRates.length) + for (var i = 0; i < message.tieredRates.length; ++i) + $root.google.cloud.billing.v1.PricingExpression.TierRate.encode(message.tieredRates[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.usageUnitDescription != null && message.hasOwnProperty("usageUnitDescription")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.usageUnitDescription); + if (message.baseUnit != null && message.hasOwnProperty("baseUnit")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.baseUnit); + if (message.baseUnitDescription != null && message.hasOwnProperty("baseUnitDescription")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.baseUnitDescription); + if (message.baseUnitConversionFactor != null && message.hasOwnProperty("baseUnitConversionFactor")) + writer.uint32(/* id 7, wireType 1 =*/57).double(message.baseUnitConversionFactor); + return writer; + }; + + /** + * Encodes the specified PricingExpression message, length delimited. Does not implicitly {@link google.cloud.billing.v1.PricingExpression.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {google.cloud.billing.v1.IPricingExpression} message PricingExpression message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PricingExpression.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PricingExpression message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.PricingExpression} PricingExpression + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PricingExpression.decode = function 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.billing.v1.PricingExpression(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.usageUnit = reader.string(); + break; + case 4: + message.usageUnitDescription = reader.string(); + break; + case 5: + message.baseUnit = reader.string(); + break; + case 6: + message.baseUnitDescription = reader.string(); + break; + case 7: + message.baseUnitConversionFactor = reader.double(); + break; + case 2: + message.displayQuantity = reader.double(); + break; + case 3: + if (!(message.tieredRates && message.tieredRates.length)) + message.tieredRates = []; + message.tieredRates.push($root.google.cloud.billing.v1.PricingExpression.TierRate.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PricingExpression message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.PricingExpression} PricingExpression + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PricingExpression.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PricingExpression message. + * @function verify + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PricingExpression.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.usageUnit != null && message.hasOwnProperty("usageUnit")) + if (!$util.isString(message.usageUnit)) + return "usageUnit: string expected"; + if (message.usageUnitDescription != null && message.hasOwnProperty("usageUnitDescription")) + if (!$util.isString(message.usageUnitDescription)) + return "usageUnitDescription: string expected"; + if (message.baseUnit != null && message.hasOwnProperty("baseUnit")) + if (!$util.isString(message.baseUnit)) + return "baseUnit: string expected"; + if (message.baseUnitDescription != null && message.hasOwnProperty("baseUnitDescription")) + if (!$util.isString(message.baseUnitDescription)) + return "baseUnitDescription: string expected"; + if (message.baseUnitConversionFactor != null && message.hasOwnProperty("baseUnitConversionFactor")) + if (typeof message.baseUnitConversionFactor !== "number") + return "baseUnitConversionFactor: number expected"; + if (message.displayQuantity != null && message.hasOwnProperty("displayQuantity")) + if (typeof message.displayQuantity !== "number") + return "displayQuantity: number expected"; + if (message.tieredRates != null && message.hasOwnProperty("tieredRates")) { + if (!Array.isArray(message.tieredRates)) + return "tieredRates: array expected"; + for (var i = 0; i < message.tieredRates.length; ++i) { + var error = $root.google.cloud.billing.v1.PricingExpression.TierRate.verify(message.tieredRates[i]); + if (error) + return "tieredRates." + error; + } + } + return null; + }; + + /** + * Creates a PricingExpression message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.PricingExpression} PricingExpression + */ + PricingExpression.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.PricingExpression) + return object; + var message = new $root.google.cloud.billing.v1.PricingExpression(); + if (object.usageUnit != null) + message.usageUnit = String(object.usageUnit); + if (object.usageUnitDescription != null) + message.usageUnitDescription = String(object.usageUnitDescription); + if (object.baseUnit != null) + message.baseUnit = String(object.baseUnit); + if (object.baseUnitDescription != null) + message.baseUnitDescription = String(object.baseUnitDescription); + if (object.baseUnitConversionFactor != null) + message.baseUnitConversionFactor = Number(object.baseUnitConversionFactor); + if (object.displayQuantity != null) + message.displayQuantity = Number(object.displayQuantity); + if (object.tieredRates) { + if (!Array.isArray(object.tieredRates)) + throw TypeError(".google.cloud.billing.v1.PricingExpression.tieredRates: array expected"); + message.tieredRates = []; + for (var i = 0; i < object.tieredRates.length; ++i) { + if (typeof object.tieredRates[i] !== "object") + throw TypeError(".google.cloud.billing.v1.PricingExpression.tieredRates: object expected"); + message.tieredRates[i] = $root.google.cloud.billing.v1.PricingExpression.TierRate.fromObject(object.tieredRates[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PricingExpression message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {google.cloud.billing.v1.PricingExpression} message PricingExpression + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PricingExpression.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.tieredRates = []; + if (options.defaults) { + object.usageUnit = ""; + object.displayQuantity = 0; + object.usageUnitDescription = ""; + object.baseUnit = ""; + object.baseUnitDescription = ""; + object.baseUnitConversionFactor = 0; + } + if (message.usageUnit != null && message.hasOwnProperty("usageUnit")) + object.usageUnit = message.usageUnit; + if (message.displayQuantity != null && message.hasOwnProperty("displayQuantity")) + object.displayQuantity = options.json && !isFinite(message.displayQuantity) ? String(message.displayQuantity) : message.displayQuantity; + if (message.tieredRates && message.tieredRates.length) { + object.tieredRates = []; + for (var j = 0; j < message.tieredRates.length; ++j) + object.tieredRates[j] = $root.google.cloud.billing.v1.PricingExpression.TierRate.toObject(message.tieredRates[j], options); + } + if (message.usageUnitDescription != null && message.hasOwnProperty("usageUnitDescription")) + object.usageUnitDescription = message.usageUnitDescription; + if (message.baseUnit != null && message.hasOwnProperty("baseUnit")) + object.baseUnit = message.baseUnit; + if (message.baseUnitDescription != null && message.hasOwnProperty("baseUnitDescription")) + object.baseUnitDescription = message.baseUnitDescription; + if (message.baseUnitConversionFactor != null && message.hasOwnProperty("baseUnitConversionFactor")) + object.baseUnitConversionFactor = options.json && !isFinite(message.baseUnitConversionFactor) ? String(message.baseUnitConversionFactor) : message.baseUnitConversionFactor; + return object; + }; + + /** + * Converts this PricingExpression to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.PricingExpression + * @instance + * @returns {Object.} JSON object + */ + PricingExpression.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + PricingExpression.TierRate = (function() { + + /** + * Properties of a TierRate. + * @memberof google.cloud.billing.v1.PricingExpression + * @interface ITierRate + * @property {number|null} [startUsageAmount] TierRate startUsageAmount + * @property {google.type.IMoney|null} [unitPrice] TierRate unitPrice + */ + + /** + * Constructs a new TierRate. + * @memberof google.cloud.billing.v1.PricingExpression + * @classdesc Represents a TierRate. + * @implements ITierRate + * @constructor + * @param {google.cloud.billing.v1.PricingExpression.ITierRate=} [properties] Properties to set + */ + function TierRate(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]]; + } + + /** + * TierRate startUsageAmount. + * @member {number} startUsageAmount + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @instance + */ + TierRate.prototype.startUsageAmount = 0; + + /** + * TierRate unitPrice. + * @member {google.type.IMoney|null|undefined} unitPrice + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @instance + */ + TierRate.prototype.unitPrice = null; + + /** + * Creates a new TierRate instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {google.cloud.billing.v1.PricingExpression.ITierRate=} [properties] Properties to set + * @returns {google.cloud.billing.v1.PricingExpression.TierRate} TierRate instance + */ + TierRate.create = function create(properties) { + return new TierRate(properties); + }; + + /** + * Encodes the specified TierRate message. Does not implicitly {@link google.cloud.billing.v1.PricingExpression.TierRate.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {google.cloud.billing.v1.PricingExpression.ITierRate} message TierRate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TierRate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startUsageAmount != null && message.hasOwnProperty("startUsageAmount")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.startUsageAmount); + if (message.unitPrice != null && message.hasOwnProperty("unitPrice")) + $root.google.type.Money.encode(message.unitPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TierRate message, length delimited. Does not implicitly {@link google.cloud.billing.v1.PricingExpression.TierRate.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {google.cloud.billing.v1.PricingExpression.ITierRate} message TierRate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TierRate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TierRate message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.PricingExpression.TierRate} TierRate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TierRate.decode = function 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.billing.v1.PricingExpression.TierRate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.startUsageAmount = reader.double(); + break; + case 2: + message.unitPrice = $root.google.type.Money.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TierRate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.PricingExpression.TierRate} TierRate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TierRate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TierRate message. + * @function verify + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TierRate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startUsageAmount != null && message.hasOwnProperty("startUsageAmount")) + if (typeof message.startUsageAmount !== "number") + return "startUsageAmount: number expected"; + if (message.unitPrice != null && message.hasOwnProperty("unitPrice")) { + var error = $root.google.type.Money.verify(message.unitPrice); + if (error) + return "unitPrice." + error; + } + return null; + }; + + /** + * Creates a TierRate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.PricingExpression.TierRate} TierRate + */ + TierRate.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.PricingExpression.TierRate) + return object; + var message = new $root.google.cloud.billing.v1.PricingExpression.TierRate(); + if (object.startUsageAmount != null) + message.startUsageAmount = Number(object.startUsageAmount); + if (object.unitPrice != null) { + if (typeof object.unitPrice !== "object") + throw TypeError(".google.cloud.billing.v1.PricingExpression.TierRate.unitPrice: object expected"); + message.unitPrice = $root.google.type.Money.fromObject(object.unitPrice); + } + return message; + }; + + /** + * Creates a plain object from a TierRate message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {google.cloud.billing.v1.PricingExpression.TierRate} message TierRate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TierRate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startUsageAmount = 0; + object.unitPrice = null; + } + if (message.startUsageAmount != null && message.hasOwnProperty("startUsageAmount")) + object.startUsageAmount = options.json && !isFinite(message.startUsageAmount) ? String(message.startUsageAmount) : message.startUsageAmount; + if (message.unitPrice != null && message.hasOwnProperty("unitPrice")) + object.unitPrice = $root.google.type.Money.toObject(message.unitPrice, options); + return object; + }; + + /** + * Converts this TierRate to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @instance + * @returns {Object.} JSON object + */ + TierRate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TierRate; + })(); + + return PricingExpression; + })(); + + v1.AggregationInfo = (function() { + + /** + * Properties of an AggregationInfo. + * @memberof google.cloud.billing.v1 + * @interface IAggregationInfo + * @property {google.cloud.billing.v1.AggregationInfo.AggregationLevel|null} [aggregationLevel] AggregationInfo aggregationLevel + * @property {google.cloud.billing.v1.AggregationInfo.AggregationInterval|null} [aggregationInterval] AggregationInfo aggregationInterval + * @property {number|null} [aggregationCount] AggregationInfo aggregationCount + */ + + /** + * Constructs a new AggregationInfo. + * @memberof google.cloud.billing.v1 + * @classdesc Represents an AggregationInfo. + * @implements IAggregationInfo + * @constructor + * @param {google.cloud.billing.v1.IAggregationInfo=} [properties] Properties to set + */ + function AggregationInfo(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]]; + } + + /** + * AggregationInfo aggregationLevel. + * @member {google.cloud.billing.v1.AggregationInfo.AggregationLevel} aggregationLevel + * @memberof google.cloud.billing.v1.AggregationInfo + * @instance + */ + AggregationInfo.prototype.aggregationLevel = 0; + + /** + * AggregationInfo aggregationInterval. + * @member {google.cloud.billing.v1.AggregationInfo.AggregationInterval} aggregationInterval + * @memberof google.cloud.billing.v1.AggregationInfo + * @instance + */ + AggregationInfo.prototype.aggregationInterval = 0; + + /** + * AggregationInfo aggregationCount. + * @member {number} aggregationCount + * @memberof google.cloud.billing.v1.AggregationInfo + * @instance + */ + AggregationInfo.prototype.aggregationCount = 0; + + /** + * Creates a new AggregationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {google.cloud.billing.v1.IAggregationInfo=} [properties] Properties to set + * @returns {google.cloud.billing.v1.AggregationInfo} AggregationInfo instance + */ + AggregationInfo.create = function create(properties) { + return new AggregationInfo(properties); + }; + + /** + * Encodes the specified AggregationInfo message. Does not implicitly {@link google.cloud.billing.v1.AggregationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {google.cloud.billing.v1.IAggregationInfo} message AggregationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AggregationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.aggregationLevel != null && message.hasOwnProperty("aggregationLevel")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.aggregationLevel); + if (message.aggregationInterval != null && message.hasOwnProperty("aggregationInterval")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.aggregationInterval); + if (message.aggregationCount != null && message.hasOwnProperty("aggregationCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.aggregationCount); + return writer; + }; + + /** + * Encodes the specified AggregationInfo message, length delimited. Does not implicitly {@link google.cloud.billing.v1.AggregationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {google.cloud.billing.v1.IAggregationInfo} message AggregationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AggregationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AggregationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.AggregationInfo} AggregationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AggregationInfo.decode = function 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.billing.v1.AggregationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aggregationLevel = reader.int32(); + break; + case 2: + message.aggregationInterval = reader.int32(); + break; + case 3: + message.aggregationCount = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AggregationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.AggregationInfo} AggregationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AggregationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AggregationInfo message. + * @function verify + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AggregationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.aggregationLevel != null && message.hasOwnProperty("aggregationLevel")) + switch (message.aggregationLevel) { + default: + return "aggregationLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.aggregationInterval != null && message.hasOwnProperty("aggregationInterval")) + switch (message.aggregationInterval) { + default: + return "aggregationInterval: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.aggregationCount != null && message.hasOwnProperty("aggregationCount")) + if (!$util.isInteger(message.aggregationCount)) + return "aggregationCount: integer expected"; + return null; + }; + + /** + * Creates an AggregationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.AggregationInfo} AggregationInfo + */ + AggregationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.AggregationInfo) + return object; + var message = new $root.google.cloud.billing.v1.AggregationInfo(); + switch (object.aggregationLevel) { + case "AGGREGATION_LEVEL_UNSPECIFIED": + case 0: + message.aggregationLevel = 0; + break; + case "ACCOUNT": + case 1: + message.aggregationLevel = 1; + break; + case "PROJECT": + case 2: + message.aggregationLevel = 2; + break; + } + switch (object.aggregationInterval) { + case "AGGREGATION_INTERVAL_UNSPECIFIED": + case 0: + message.aggregationInterval = 0; + break; + case "DAILY": + case 1: + message.aggregationInterval = 1; + break; + case "MONTHLY": + case 2: + message.aggregationInterval = 2; + break; + } + if (object.aggregationCount != null) + message.aggregationCount = object.aggregationCount | 0; + return message; + }; + + /** + * Creates a plain object from an AggregationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {google.cloud.billing.v1.AggregationInfo} message AggregationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AggregationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.aggregationLevel = options.enums === String ? "AGGREGATION_LEVEL_UNSPECIFIED" : 0; + object.aggregationInterval = options.enums === String ? "AGGREGATION_INTERVAL_UNSPECIFIED" : 0; + object.aggregationCount = 0; + } + if (message.aggregationLevel != null && message.hasOwnProperty("aggregationLevel")) + object.aggregationLevel = options.enums === String ? $root.google.cloud.billing.v1.AggregationInfo.AggregationLevel[message.aggregationLevel] : message.aggregationLevel; + if (message.aggregationInterval != null && message.hasOwnProperty("aggregationInterval")) + object.aggregationInterval = options.enums === String ? $root.google.cloud.billing.v1.AggregationInfo.AggregationInterval[message.aggregationInterval] : message.aggregationInterval; + if (message.aggregationCount != null && message.hasOwnProperty("aggregationCount")) + object.aggregationCount = message.aggregationCount; + return object; + }; + + /** + * Converts this AggregationInfo to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.AggregationInfo + * @instance + * @returns {Object.} JSON object + */ + AggregationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * AggregationLevel enum. + * @name google.cloud.billing.v1.AggregationInfo.AggregationLevel + * @enum {string} + * @property {number} AGGREGATION_LEVEL_UNSPECIFIED=0 AGGREGATION_LEVEL_UNSPECIFIED value + * @property {number} ACCOUNT=1 ACCOUNT value + * @property {number} PROJECT=2 PROJECT value + */ + AggregationInfo.AggregationLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AGGREGATION_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACCOUNT"] = 1; + values[valuesById[2] = "PROJECT"] = 2; + return values; + })(); + + /** + * AggregationInterval enum. + * @name google.cloud.billing.v1.AggregationInfo.AggregationInterval + * @enum {string} + * @property {number} AGGREGATION_INTERVAL_UNSPECIFIED=0 AGGREGATION_INTERVAL_UNSPECIFIED value + * @property {number} DAILY=1 DAILY value + * @property {number} MONTHLY=2 MONTHLY value + */ + AggregationInfo.AggregationInterval = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AGGREGATION_INTERVAL_UNSPECIFIED"] = 0; + values[valuesById[1] = "DAILY"] = 1; + values[valuesById[2] = "MONTHLY"] = 2; + return values; + })(); + + return AggregationInfo; + })(); + + v1.ListServicesRequest = (function() { + + /** + * Properties of a ListServicesRequest. + * @memberof google.cloud.billing.v1 + * @interface IListServicesRequest + * @property {number|null} [pageSize] ListServicesRequest pageSize + * @property {string|null} [pageToken] ListServicesRequest pageToken + */ + + /** + * Constructs a new ListServicesRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ListServicesRequest. + * @implements IListServicesRequest + * @constructor + * @param {google.cloud.billing.v1.IListServicesRequest=} [properties] Properties to set + */ + function ListServicesRequest(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]]; + } + + /** + * ListServicesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.billing.v1.ListServicesRequest + * @instance + */ + ListServicesRequest.prototype.pageSize = 0; + + /** + * ListServicesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.billing.v1.ListServicesRequest + * @instance + */ + ListServicesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListServicesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {google.cloud.billing.v1.IListServicesRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ListServicesRequest} ListServicesRequest instance + */ + ListServicesRequest.create = function create(properties) { + return new ListServicesRequest(properties); + }; + + /** + * Encodes the specified ListServicesRequest message. Does not implicitly {@link google.cloud.billing.v1.ListServicesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {google.cloud.billing.v1.IListServicesRequest} message ListServicesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServicesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageSize); + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListServicesRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListServicesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {google.cloud.billing.v1.IListServicesRequest} message ListServicesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServicesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListServicesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ListServicesRequest} ListServicesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServicesRequest.decode = function 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.billing.v1.ListServicesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pageSize = reader.int32(); + break; + case 2: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListServicesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ListServicesRequest} ListServicesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServicesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListServicesRequest message. + * @function verify + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServicesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object 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 ListServicesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ListServicesRequest} ListServicesRequest + */ + ListServicesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ListServicesRequest) + return object; + var message = new $root.google.cloud.billing.v1.ListServicesRequest(); + 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 ListServicesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {google.cloud.billing.v1.ListServicesRequest} message ListServicesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServicesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageSize = 0; + object.pageToken = ""; + } + 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 ListServicesRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ListServicesRequest + * @instance + * @returns {Object.} JSON object + */ + ListServicesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListServicesRequest; + })(); + + v1.ListServicesResponse = (function() { + + /** + * Properties of a ListServicesResponse. + * @memberof google.cloud.billing.v1 + * @interface IListServicesResponse + * @property {Array.|null} [services] ListServicesResponse services + * @property {string|null} [nextPageToken] ListServicesResponse nextPageToken + */ + + /** + * Constructs a new ListServicesResponse. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ListServicesResponse. + * @implements IListServicesResponse + * @constructor + * @param {google.cloud.billing.v1.IListServicesResponse=} [properties] Properties to set + */ + function ListServicesResponse(properties) { + this.services = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListServicesResponse services. + * @member {Array.} services + * @memberof google.cloud.billing.v1.ListServicesResponse + * @instance + */ + ListServicesResponse.prototype.services = $util.emptyArray; + + /** + * ListServicesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.billing.v1.ListServicesResponse + * @instance + */ + ListServicesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListServicesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {google.cloud.billing.v1.IListServicesResponse=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ListServicesResponse} ListServicesResponse instance + */ + ListServicesResponse.create = function create(properties) { + return new ListServicesResponse(properties); + }; + + /** + * Encodes the specified ListServicesResponse message. Does not implicitly {@link google.cloud.billing.v1.ListServicesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {google.cloud.billing.v1.IListServicesResponse} message ListServicesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServicesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.services != null && message.services.length) + for (var i = 0; i < message.services.length; ++i) + $root.google.cloud.billing.v1.Service.encode(message.services[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListServicesResponse message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListServicesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {google.cloud.billing.v1.IListServicesResponse} message ListServicesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServicesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListServicesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ListServicesResponse} ListServicesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServicesResponse.decode = function 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.billing.v1.ListServicesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.services && message.services.length)) + message.services = []; + message.services.push($root.google.cloud.billing.v1.Service.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListServicesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ListServicesResponse} ListServicesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServicesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListServicesResponse message. + * @function verify + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServicesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.services != null && message.hasOwnProperty("services")) { + if (!Array.isArray(message.services)) + return "services: array expected"; + for (var i = 0; i < message.services.length; ++i) { + var error = $root.google.cloud.billing.v1.Service.verify(message.services[i]); + if (error) + return "services." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListServicesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ListServicesResponse} ListServicesResponse + */ + ListServicesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ListServicesResponse) + return object; + var message = new $root.google.cloud.billing.v1.ListServicesResponse(); + if (object.services) { + if (!Array.isArray(object.services)) + throw TypeError(".google.cloud.billing.v1.ListServicesResponse.services: array expected"); + message.services = []; + for (var i = 0; i < object.services.length; ++i) { + if (typeof object.services[i] !== "object") + throw TypeError(".google.cloud.billing.v1.ListServicesResponse.services: object expected"); + message.services[i] = $root.google.cloud.billing.v1.Service.fromObject(object.services[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListServicesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {google.cloud.billing.v1.ListServicesResponse} message ListServicesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServicesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.services = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.services && message.services.length) { + object.services = []; + for (var j = 0; j < message.services.length; ++j) + object.services[j] = $root.google.cloud.billing.v1.Service.toObject(message.services[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListServicesResponse to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ListServicesResponse + * @instance + * @returns {Object.} JSON object + */ + ListServicesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListServicesResponse; + })(); + + v1.ListSkusRequest = (function() { + + /** + * Properties of a ListSkusRequest. + * @memberof google.cloud.billing.v1 + * @interface IListSkusRequest + * @property {string|null} [parent] ListSkusRequest parent + * @property {google.protobuf.ITimestamp|null} [startTime] ListSkusRequest startTime + * @property {google.protobuf.ITimestamp|null} [endTime] ListSkusRequest endTime + * @property {string|null} [currencyCode] ListSkusRequest currencyCode + * @property {number|null} [pageSize] ListSkusRequest pageSize + * @property {string|null} [pageToken] ListSkusRequest pageToken + */ + + /** + * Constructs a new ListSkusRequest. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ListSkusRequest. + * @implements IListSkusRequest + * @constructor + * @param {google.cloud.billing.v1.IListSkusRequest=} [properties] Properties to set + */ + function ListSkusRequest(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]]; + } + + /** + * ListSkusRequest parent. + * @member {string} parent + * @memberof google.cloud.billing.v1.ListSkusRequest + * @instance + */ + ListSkusRequest.prototype.parent = ""; + + /** + * ListSkusRequest startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.billing.v1.ListSkusRequest + * @instance + */ + ListSkusRequest.prototype.startTime = null; + + /** + * ListSkusRequest endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.billing.v1.ListSkusRequest + * @instance + */ + ListSkusRequest.prototype.endTime = null; + + /** + * ListSkusRequest currencyCode. + * @member {string} currencyCode + * @memberof google.cloud.billing.v1.ListSkusRequest + * @instance + */ + ListSkusRequest.prototype.currencyCode = ""; + + /** + * ListSkusRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.billing.v1.ListSkusRequest + * @instance + */ + ListSkusRequest.prototype.pageSize = 0; + + /** + * ListSkusRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.billing.v1.ListSkusRequest + * @instance + */ + ListSkusRequest.prototype.pageToken = ""; + + /** + * Creates a new ListSkusRequest instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {google.cloud.billing.v1.IListSkusRequest=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ListSkusRequest} ListSkusRequest instance + */ + ListSkusRequest.create = function create(properties) { + return new ListSkusRequest(properties); + }; + + /** + * Encodes the specified ListSkusRequest message. Does not implicitly {@link google.cloud.billing.v1.ListSkusRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {google.cloud.billing.v1.IListSkusRequest} message ListSkusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSkusRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.startTime != null && message.hasOwnProperty("startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endTime != null && message.hasOwnProperty("endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.currencyCode); + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.pageSize); + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListSkusRequest message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListSkusRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {google.cloud.billing.v1.IListSkusRequest} message ListSkusRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSkusRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSkusRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ListSkusRequest} ListSkusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSkusRequest.decode = function 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.billing.v1.ListSkusRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 3: + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 4: + message.currencyCode = reader.string(); + break; + case 5: + message.pageSize = reader.int32(); + break; + case 6: + message.pageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSkusRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ListSkusRequest} ListSkusRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSkusRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSkusRequest message. + * @function verify + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSkusRequest.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.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: 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 ListSkusRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ListSkusRequest} ListSkusRequest + */ + ListSkusRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ListSkusRequest) + return object; + var message = new $root.google.cloud.billing.v1.ListSkusRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.billing.v1.ListSkusRequest.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.billing.v1.ListSkusRequest.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + 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 ListSkusRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {google.cloud.billing.v1.ListSkusRequest} message ListSkusRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSkusRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.startTime = null; + object.endTime = null; + object.currencyCode = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + 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 ListSkusRequest to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ListSkusRequest + * @instance + * @returns {Object.} JSON object + */ + ListSkusRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListSkusRequest; + })(); + + v1.ListSkusResponse = (function() { + + /** + * Properties of a ListSkusResponse. + * @memberof google.cloud.billing.v1 + * @interface IListSkusResponse + * @property {Array.|null} [skus] ListSkusResponse skus + * @property {string|null} [nextPageToken] ListSkusResponse nextPageToken + */ + + /** + * Constructs a new ListSkusResponse. + * @memberof google.cloud.billing.v1 + * @classdesc Represents a ListSkusResponse. + * @implements IListSkusResponse + * @constructor + * @param {google.cloud.billing.v1.IListSkusResponse=} [properties] Properties to set + */ + function ListSkusResponse(properties) { + this.skus = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSkusResponse skus. + * @member {Array.} skus + * @memberof google.cloud.billing.v1.ListSkusResponse + * @instance + */ + ListSkusResponse.prototype.skus = $util.emptyArray; + + /** + * ListSkusResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.billing.v1.ListSkusResponse + * @instance + */ + ListSkusResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListSkusResponse instance using the specified properties. + * @function create + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {google.cloud.billing.v1.IListSkusResponse=} [properties] Properties to set + * @returns {google.cloud.billing.v1.ListSkusResponse} ListSkusResponse instance + */ + ListSkusResponse.create = function create(properties) { + return new ListSkusResponse(properties); + }; + + /** + * Encodes the specified ListSkusResponse message. Does not implicitly {@link google.cloud.billing.v1.ListSkusResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {google.cloud.billing.v1.IListSkusResponse} message ListSkusResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSkusResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.skus != null && message.skus.length) + for (var i = 0; i < message.skus.length; ++i) + $root.google.cloud.billing.v1.Sku.encode(message.skus[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListSkusResponse message, length delimited. Does not implicitly {@link google.cloud.billing.v1.ListSkusResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {google.cloud.billing.v1.IListSkusResponse} message ListSkusResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSkusResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSkusResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.billing.v1.ListSkusResponse} ListSkusResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSkusResponse.decode = function 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.billing.v1.ListSkusResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.skus && message.skus.length)) + message.skus = []; + message.skus.push($root.google.cloud.billing.v1.Sku.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSkusResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.billing.v1.ListSkusResponse} ListSkusResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSkusResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSkusResponse message. + * @function verify + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSkusResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.skus != null && message.hasOwnProperty("skus")) { + if (!Array.isArray(message.skus)) + return "skus: array expected"; + for (var i = 0; i < message.skus.length; ++i) { + var error = $root.google.cloud.billing.v1.Sku.verify(message.skus[i]); + if (error) + return "skus." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListSkusResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.billing.v1.ListSkusResponse} ListSkusResponse + */ + ListSkusResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.billing.v1.ListSkusResponse) + return object; + var message = new $root.google.cloud.billing.v1.ListSkusResponse(); + if (object.skus) { + if (!Array.isArray(object.skus)) + throw TypeError(".google.cloud.billing.v1.ListSkusResponse.skus: array expected"); + message.skus = []; + for (var i = 0; i < object.skus.length; ++i) { + if (typeof object.skus[i] !== "object") + throw TypeError(".google.cloud.billing.v1.ListSkusResponse.skus: object expected"); + message.skus[i] = $root.google.cloud.billing.v1.Sku.fromObject(object.skus[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListSkusResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {google.cloud.billing.v1.ListSkusResponse} message ListSkusResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSkusResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.skus = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.skus && message.skus.length) { + object.skus = []; + for (var j = 0; j < message.skus.length; ++j) + object.skus[j] = $root.google.cloud.billing.v1.Sku.toObject(message.skus[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListSkusResponse to JSON. + * @function toJSON + * @memberof google.cloud.billing.v1.ListSkusResponse + * @instance + * @returns {Object.} JSON object + */ + ListSkusResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListSkusResponse; + })(); + + return v1; + })(); + + return billing; + })(); + + 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 && message.hasOwnProperty("fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + case 2: + message.fullyDecodeReservedExpansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = ""; + + /** + * HttpRule put. + * @member {string} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = ""; + + /** + * HttpRule post. + * @member {string} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = ""; + + /** + * HttpRule delete. + * @member {string} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = ""; + + /** + * HttpRule patch. + * @member {string} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = ""; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && message.hasOwnProperty("selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && message.hasOwnProperty("get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && message.hasOwnProperty("put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && message.hasOwnProperty("post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && message.hasOwnProperty("delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && message.hasOwnProperty("patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && message.hasOwnProperty("body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && message.hasOwnProperty("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 && message.hasOwnProperty("responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selector = reader.string(); + break; + case 2: + message.get = reader.string(); + break; + case 3: + message.put = reader.string(); + break; + case 4: + message.post = reader.string(); + break; + case 5: + message["delete"] = reader.string(); + break; + case 6: + message.patch = reader.string(); + break; + case 8: + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 7: + message.body = reader.string(); + break; + case 12: + message.responseBody = reader.string(); + break; + case 11: + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && message.hasOwnProperty("kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && message.hasOwnProperty("path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.kind = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CustomHttpPattern; + })(); + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {string} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("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 && message.hasOwnProperty("nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && message.hasOwnProperty("history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && message.hasOwnProperty("plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && message.hasOwnProperty("singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + case 3: + message.nameField = reader.string(); + break; + case 4: + message.history = reader.int32(); + break; + case 5: + message.plural = reader.string(); + break; + case 6: + message.singular = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pattern = []; + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {string} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && message.hasOwnProperty("childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.childType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ResourceReference; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorSet; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && message.hasOwnProperty("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 && message.hasOwnProperty("options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && message.hasOwnProperty("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 && message.hasOwnProperty("syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message["package"] = reader.string(); + break; + case 3: + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + case 10: + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + case 11: + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + case 4: + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 8: + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("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 && message.hasOwnProperty("options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && message.hasOwnProperty("start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && message.hasOwnProperty("end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + case 3: + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && message.hasOwnProperty("start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && message.hasOwnProperty("end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + */ + + /** + * 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; + + /** + * 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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && message.hasOwnProperty("extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && message.hasOwnProperty("number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && message.hasOwnProperty("label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && message.hasOwnProperty("typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + 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; + 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; + } + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + } + switch (object.type) { + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + 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 = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {string} + * @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 {string} + * @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 && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("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 && message.hasOwnProperty("options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && message.hasOwnProperty("start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && message.hasOwnProperty("end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && message.hasOwnProperty("number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.number = reader.int32(); + break; + case 3: + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("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 && message.hasOwnProperty("options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && message.hasOwnProperty("inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && message.hasOwnProperty("outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.inputType = reader.string(); + break; + case 3: + message.outputType = reader.string(); + break; + case 4: + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [phpGenericServices] FileOptions phpGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions phpGenericServices. + * @member {boolean} phpGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = false; + + /** + * 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 && message.hasOwnProperty("javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.javaPackage = reader.string(); + break; + case 8: + message.javaOuterClassname = reader.string(); + break; + case 10: + message.javaMultipleFiles = reader.bool(); + break; + case 20: + message.javaGenerateEqualsAndHash = reader.bool(); + break; + case 27: + message.javaStringCheckUtf8 = reader.bool(); + break; + case 9: + message.optimizeFor = reader.int32(); + break; + case 11: + message.goPackage = reader.string(); + break; + case 16: + message.ccGenericServices = reader.bool(); + break; + case 17: + message.javaGenericServices = reader.bool(); + break; + case 18: + message.pyGenericServices = reader.bool(); + break; + case 42: + message.phpGenericServices = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.ccEnableArenas = reader.bool(); + break; + case 36: + message.objcClassPrefix = reader.string(); + break; + case 37: + message.csharpNamespace = reader.string(); + break; + case 39: + message.swiftPrefix = reader.string(); + break; + case 40: + message.phpClassPrefix = reader.string(); + break; + case 41: + message.phpNamespace = reader.string(); + break; + case 44: + message.phpMetadataNamespace = reader.string(); + break; + case 45: + message.rubyPackage = reader.string(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1053: + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + if (typeof message.phpGenericServices !== "boolean") + return "phpGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.phpGenericServices != null) + message.phpGenericServices = Boolean(object.phpGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = false; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpGenericServices = false; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + object.phpGenericServices = message.phpGenericServices; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {string} + * @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 && message.hasOwnProperty("messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && message.hasOwnProperty("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 && message.hasOwnProperty(".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageSetWireFormat = reader.bool(); + break; + case 2: + message.noStandardDescriptorAccessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.mapEntry = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1053: + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && message.hasOwnProperty("ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && message.hasOwnProperty("packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && message.hasOwnProperty("lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && message.hasOwnProperty("jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && message.hasOwnProperty("weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) { + writer.uint32(/* id 1052, wireType 2 =*/8418).fork(); + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.int32(message[".google.api.fieldBehavior"][i]); + writer.ldelim(); + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = reader.int32(); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = reader.int32(); + break; + case 5: + message.lazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1052: + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + case 1055: + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + } + } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object[".google.api.resourceReference"] = null; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {string} + * @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 {string} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allowAlias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && message.hasOwnProperty("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 && message.hasOwnProperty(".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + case 1049: + message[".google.api.defaultHost"] = reader.string(); + break; + case 1050: + message[".google.api.oauthScopes"] = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + */ + + /** + * 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; + + /** + * 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 && message.hasOwnProperty("deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && message.hasOwnProperty("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.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 && message.hasOwnProperty(".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; + 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"; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + switch (object.idempotencyLevel) { + case "IDEMPOTENCY_UNKNOWN": + case 0: + message.idempotencyLevel = 0; + break; + case "NO_SIDE_EFFECTS": + case 1: + message.idempotencyLevel = 1; + break; + case "IDEMPOTENT": + case 2: + message.idempotencyLevel = 2; + break; + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + if (object[".google.api.methodSignature"]) { + if (!Array.isArray(object[".google.api.methodSignature"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); + message[".google.api.methodSignature"] = []; + for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) + message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); + } + 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.api.http"] = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { + object[".google.api.methodSignature"] = []; + for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) + object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * IdempotencyLevel enum. + * @name google.protobuf.MethodOptions.IdempotencyLevel + * @enum {string} + * @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 && message.hasOwnProperty("identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + case 3: + message.identifierValue = reader.string(); + break; + case 4: + message.positiveIntValue = reader.uint64(); + break; + case 5: + message.negativeIntValue = reader.int64(); + break; + case 6: + message.doubleValue = reader.double(); + break; + case 7: + message.stringValue = reader.bytes(); + break; + case 8: + message.aggregateValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : 0; + object.doubleValue = 0; + if (options.bytes === String) + object.stringValue = ""; + else { + object.stringValue = []; + if (options.bytes !== Array) + object.stringValue = $util.newBuffer(object.stringValue); + } + object.aggregateValue = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + object.aggregateValue = message.aggregateValue; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namePart = reader.string(); + break; + case 2: + message.isExtension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!message.hasOwnProperty("isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + */ + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); + }; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + case 3: + message.leadingComments = reader.string(); + break; + case 4: + message.trailingComments = reader.string(); + break; + case 6: + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + */ + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); + }; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [sourceFile] Annotation sourceFile + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation sourceFile. + * @member {string} sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; + + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && message.hasOwnProperty("begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && message.hasOwnProperty("end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + case 2: + message.sourceFile = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return FieldMask; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @implements ITimestamp + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. + * @function create + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance + */ + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && message.hasOwnProperty("seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && message.hasOwnProperty("nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Timestamp; + })(); + + return protobuf; + })(); + + google.iam = (function() { + + /** + * Namespace iam. + * @memberof google + * @namespace + */ + var iam = {}; + + iam.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.iam + * @namespace + */ + var v1 = {}; + + v1.IAMPolicy = (function() { + + /** + * Constructs a new IAMPolicy service. + * @memberof google.iam.v1 + * @classdesc Represents a IAMPolicy + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function IAMPolicy(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (IAMPolicy.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = IAMPolicy; + + /** + * Creates new IAMPolicy service using the specified rpc implementation. + * @function create + * @memberof google.iam.v1.IAMPolicy + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {IAMPolicy} RPC service. Useful where requests and/or responses are streamed. + */ + IAMPolicy.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * @memberof google.iam.v1.IAMPolicy + * @typedef SetIamPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.Policy} [response] Policy + */ + + /** + * Calls SetIamPolicy. + * @function setIamPolicy + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.ISetIamPolicyRequest} request SetIamPolicyRequest message or plain object + * @param {google.iam.v1.IAMPolicy.SetIamPolicyCallback} callback Node-style callback called with the error, if any, and Policy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IAMPolicy.prototype.setIamPolicy = function setIamPolicy(request, callback) { + return this.rpcCall(setIamPolicy, $root.google.iam.v1.SetIamPolicyRequest, $root.google.iam.v1.Policy, request, callback); + }, "name", { value: "SetIamPolicy" }); + + /** + * Calls SetIamPolicy. + * @function setIamPolicy + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.ISetIamPolicyRequest} request SetIamPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * @memberof google.iam.v1.IAMPolicy + * @typedef GetIamPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.Policy} [response] Policy + */ + + /** + * Calls GetIamPolicy. + * @function getIamPolicy + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.IGetIamPolicyRequest} request GetIamPolicyRequest message or plain object + * @param {google.iam.v1.IAMPolicy.GetIamPolicyCallback} callback Node-style callback called with the error, if any, and Policy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IAMPolicy.prototype.getIamPolicy = function getIamPolicy(request, callback) { + return this.rpcCall(getIamPolicy, $root.google.iam.v1.GetIamPolicyRequest, $root.google.iam.v1.Policy, request, callback); + }, "name", { value: "GetIamPolicy" }); + + /** + * Calls GetIamPolicy. + * @function getIamPolicy + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.IGetIamPolicyRequest} request GetIamPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * @memberof google.iam.v1.IAMPolicy + * @typedef TestIamPermissionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.iam.v1.TestIamPermissionsResponse} [response] TestIamPermissionsResponse + */ + + /** + * Calls TestIamPermissions. + * @function testIamPermissions + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.ITestIamPermissionsRequest} request TestIamPermissionsRequest message or plain object + * @param {google.iam.v1.IAMPolicy.TestIamPermissionsCallback} callback Node-style callback called with the error, if any, and TestIamPermissionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(IAMPolicy.prototype.testIamPermissions = function testIamPermissions(request, callback) { + return this.rpcCall(testIamPermissions, $root.google.iam.v1.TestIamPermissionsRequest, $root.google.iam.v1.TestIamPermissionsResponse, request, callback); + }, "name", { value: "TestIamPermissions" }); + + /** + * Calls TestIamPermissions. + * @function testIamPermissions + * @memberof google.iam.v1.IAMPolicy + * @instance + * @param {google.iam.v1.ITestIamPermissionsRequest} request TestIamPermissionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return IAMPolicy; + })(); + + v1.SetIamPolicyRequest = (function() { + + /** + * Properties of a SetIamPolicyRequest. + * @memberof google.iam.v1 + * @interface ISetIamPolicyRequest + * @property {string|null} [resource] SetIamPolicyRequest resource + * @property {google.iam.v1.IPolicy|null} [policy] SetIamPolicyRequest policy + */ + + /** + * Constructs a new SetIamPolicyRequest. + * @memberof google.iam.v1 + * @classdesc Represents a SetIamPolicyRequest. + * @implements ISetIamPolicyRequest + * @constructor + * @param {google.iam.v1.ISetIamPolicyRequest=} [properties] Properties to set + */ + function SetIamPolicyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetIamPolicyRequest resource. + * @member {string} resource + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + */ + SetIamPolicyRequest.prototype.resource = ""; + + /** + * SetIamPolicyRequest policy. + * @member {google.iam.v1.IPolicy|null|undefined} policy + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + */ + SetIamPolicyRequest.prototype.policy = null; + + /** + * Creates a new SetIamPolicyRequest instance using the specified properties. + * @function create + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {google.iam.v1.ISetIamPolicyRequest=} [properties] Properties to set + * @returns {google.iam.v1.SetIamPolicyRequest} SetIamPolicyRequest instance + */ + SetIamPolicyRequest.create = function create(properties) { + return new SetIamPolicyRequest(properties); + }; + + /** + * Encodes the specified SetIamPolicyRequest message. Does not implicitly {@link google.iam.v1.SetIamPolicyRequest.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {google.iam.v1.ISetIamPolicyRequest} message SetIamPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetIamPolicyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resource != null && message.hasOwnProperty("resource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); + if (message.policy != null && message.hasOwnProperty("policy")) + $root.google.iam.v1.Policy.encode(message.policy, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetIamPolicyRequest message, length delimited. Does not implicitly {@link google.iam.v1.SetIamPolicyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {google.iam.v1.ISetIamPolicyRequest} message SetIamPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetIamPolicyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetIamPolicyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.SetIamPolicyRequest} SetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetIamPolicyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.SetIamPolicyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resource = reader.string(); + break; + case 2: + message.policy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetIamPolicyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.SetIamPolicyRequest} SetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetIamPolicyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetIamPolicyRequest message. + * @function verify + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetIamPolicyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.policy != null && message.hasOwnProperty("policy")) { + var error = $root.google.iam.v1.Policy.verify(message.policy); + if (error) + return "policy." + error; + } + return null; + }; + + /** + * Creates a SetIamPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.SetIamPolicyRequest} SetIamPolicyRequest + */ + SetIamPolicyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.SetIamPolicyRequest) + return object; + var message = new $root.google.iam.v1.SetIamPolicyRequest(); + if (object.resource != null) + message.resource = String(object.resource); + if (object.policy != null) { + if (typeof object.policy !== "object") + throw TypeError(".google.iam.v1.SetIamPolicyRequest.policy: object expected"); + message.policy = $root.google.iam.v1.Policy.fromObject(object.policy); + } + return message; + }; + + /** + * Creates a plain object from a SetIamPolicyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {google.iam.v1.SetIamPolicyRequest} message SetIamPolicyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetIamPolicyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resource = ""; + object.policy = null; + } + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.policy != null && message.hasOwnProperty("policy")) + object.policy = $root.google.iam.v1.Policy.toObject(message.policy, options); + return object; + }; + + /** + * Converts this SetIamPolicyRequest to JSON. + * @function toJSON + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + * @returns {Object.} JSON object + */ + SetIamPolicyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetIamPolicyRequest; + })(); + + v1.GetIamPolicyRequest = (function() { + + /** + * Properties of a GetIamPolicyRequest. + * @memberof google.iam.v1 + * @interface IGetIamPolicyRequest + * @property {string|null} [resource] GetIamPolicyRequest resource + * @property {google.iam.v1.IGetPolicyOptions|null} [options] GetIamPolicyRequest options + */ + + /** + * Constructs a new GetIamPolicyRequest. + * @memberof google.iam.v1 + * @classdesc Represents a GetIamPolicyRequest. + * @implements IGetIamPolicyRequest + * @constructor + * @param {google.iam.v1.IGetIamPolicyRequest=} [properties] Properties to set + */ + function GetIamPolicyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIamPolicyRequest resource. + * @member {string} resource + * @memberof google.iam.v1.GetIamPolicyRequest + * @instance + */ + GetIamPolicyRequest.prototype.resource = ""; + + /** + * GetIamPolicyRequest options. + * @member {google.iam.v1.IGetPolicyOptions|null|undefined} options + * @memberof google.iam.v1.GetIamPolicyRequest + * @instance + */ + GetIamPolicyRequest.prototype.options = null; + + /** + * Creates a new GetIamPolicyRequest instance using the specified properties. + * @function create + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {google.iam.v1.IGetIamPolicyRequest=} [properties] Properties to set + * @returns {google.iam.v1.GetIamPolicyRequest} GetIamPolicyRequest instance + */ + GetIamPolicyRequest.create = function create(properties) { + return new GetIamPolicyRequest(properties); + }; + + /** + * Encodes the specified GetIamPolicyRequest message. Does not implicitly {@link google.iam.v1.GetIamPolicyRequest.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {google.iam.v1.IGetIamPolicyRequest} message GetIamPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIamPolicyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resource != null && message.hasOwnProperty("resource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); + if (message.options != null && message.hasOwnProperty("options")) + $root.google.iam.v1.GetPolicyOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetIamPolicyRequest message, length delimited. Does not implicitly {@link google.iam.v1.GetIamPolicyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {google.iam.v1.IGetIamPolicyRequest} message GetIamPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIamPolicyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIamPolicyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.GetIamPolicyRequest} GetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIamPolicyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.GetIamPolicyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resource = reader.string(); + break; + case 2: + message.options = $root.google.iam.v1.GetPolicyOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIamPolicyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.GetIamPolicyRequest} GetIamPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIamPolicyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIamPolicyRequest message. + * @function verify + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIamPolicyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.iam.v1.GetPolicyOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a GetIamPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.GetIamPolicyRequest} GetIamPolicyRequest + */ + GetIamPolicyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.GetIamPolicyRequest) + return object; + var message = new $root.google.iam.v1.GetIamPolicyRequest(); + if (object.resource != null) + message.resource = String(object.resource); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.iam.v1.GetIamPolicyRequest.options: object expected"); + message.options = $root.google.iam.v1.GetPolicyOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a GetIamPolicyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {google.iam.v1.GetIamPolicyRequest} message GetIamPolicyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIamPolicyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.resource = ""; + object.options = null; + } + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.iam.v1.GetPolicyOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this GetIamPolicyRequest to JSON. + * @function toJSON + * @memberof google.iam.v1.GetIamPolicyRequest + * @instance + * @returns {Object.} JSON object + */ + GetIamPolicyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetIamPolicyRequest; + })(); + + v1.TestIamPermissionsRequest = (function() { + + /** + * Properties of a TestIamPermissionsRequest. + * @memberof google.iam.v1 + * @interface ITestIamPermissionsRequest + * @property {string|null} [resource] TestIamPermissionsRequest resource + * @property {Array.|null} [permissions] TestIamPermissionsRequest permissions + */ + + /** + * Constructs a new TestIamPermissionsRequest. + * @memberof google.iam.v1 + * @classdesc Represents a TestIamPermissionsRequest. + * @implements ITestIamPermissionsRequest + * @constructor + * @param {google.iam.v1.ITestIamPermissionsRequest=} [properties] Properties to set + */ + function TestIamPermissionsRequest(properties) { + this.permissions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TestIamPermissionsRequest resource. + * @member {string} resource + * @memberof google.iam.v1.TestIamPermissionsRequest + * @instance + */ + TestIamPermissionsRequest.prototype.resource = ""; + + /** + * TestIamPermissionsRequest permissions. + * @member {Array.} permissions + * @memberof google.iam.v1.TestIamPermissionsRequest + * @instance + */ + TestIamPermissionsRequest.prototype.permissions = $util.emptyArray; + + /** + * Creates a new TestIamPermissionsRequest instance using the specified properties. + * @function create + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {google.iam.v1.ITestIamPermissionsRequest=} [properties] Properties to set + * @returns {google.iam.v1.TestIamPermissionsRequest} TestIamPermissionsRequest instance + */ + TestIamPermissionsRequest.create = function create(properties) { + return new TestIamPermissionsRequest(properties); + }; + + /** + * Encodes the specified TestIamPermissionsRequest message. Does not implicitly {@link google.iam.v1.TestIamPermissionsRequest.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {google.iam.v1.ITestIamPermissionsRequest} message TestIamPermissionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestIamPermissionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resource != null && message.hasOwnProperty("resource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); + if (message.permissions != null && message.permissions.length) + for (var i = 0; i < message.permissions.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.permissions[i]); + return writer; + }; + + /** + * Encodes the specified TestIamPermissionsRequest message, length delimited. Does not implicitly {@link google.iam.v1.TestIamPermissionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {google.iam.v1.ITestIamPermissionsRequest} message TestIamPermissionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestIamPermissionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TestIamPermissionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.TestIamPermissionsRequest} TestIamPermissionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestIamPermissionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.TestIamPermissionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.resource = reader.string(); + break; + case 2: + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TestIamPermissionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.TestIamPermissionsRequest} TestIamPermissionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestIamPermissionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TestIamPermissionsRequest message. + * @function verify + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TestIamPermissionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: string expected"; + if (message.permissions != null && message.hasOwnProperty("permissions")) { + if (!Array.isArray(message.permissions)) + return "permissions: array expected"; + for (var i = 0; i < message.permissions.length; ++i) + if (!$util.isString(message.permissions[i])) + return "permissions: string[] expected"; + } + return null; + }; + + /** + * Creates a TestIamPermissionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.TestIamPermissionsRequest} TestIamPermissionsRequest + */ + TestIamPermissionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.TestIamPermissionsRequest) + return object; + var message = new $root.google.iam.v1.TestIamPermissionsRequest(); + if (object.resource != null) + message.resource = String(object.resource); + if (object.permissions) { + if (!Array.isArray(object.permissions)) + throw TypeError(".google.iam.v1.TestIamPermissionsRequest.permissions: array expected"); + message.permissions = []; + for (var i = 0; i < object.permissions.length; ++i) + message.permissions[i] = String(object.permissions[i]); + } + return message; + }; + + /** + * Creates a plain object from a TestIamPermissionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {google.iam.v1.TestIamPermissionsRequest} message TestIamPermissionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TestIamPermissionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.permissions = []; + if (options.defaults) + object.resource = ""; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + if (message.permissions && message.permissions.length) { + object.permissions = []; + for (var j = 0; j < message.permissions.length; ++j) + object.permissions[j] = message.permissions[j]; + } + return object; + }; + + /** + * Converts this TestIamPermissionsRequest to JSON. + * @function toJSON + * @memberof google.iam.v1.TestIamPermissionsRequest + * @instance + * @returns {Object.} JSON object + */ + TestIamPermissionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TestIamPermissionsRequest; + })(); + + v1.TestIamPermissionsResponse = (function() { + + /** + * Properties of a TestIamPermissionsResponse. + * @memberof google.iam.v1 + * @interface ITestIamPermissionsResponse + * @property {Array.|null} [permissions] TestIamPermissionsResponse permissions + */ + + /** + * Constructs a new TestIamPermissionsResponse. + * @memberof google.iam.v1 + * @classdesc Represents a TestIamPermissionsResponse. + * @implements ITestIamPermissionsResponse + * @constructor + * @param {google.iam.v1.ITestIamPermissionsResponse=} [properties] Properties to set + */ + function TestIamPermissionsResponse(properties) { + this.permissions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TestIamPermissionsResponse permissions. + * @member {Array.} permissions + * @memberof google.iam.v1.TestIamPermissionsResponse + * @instance + */ + TestIamPermissionsResponse.prototype.permissions = $util.emptyArray; + + /** + * Creates a new TestIamPermissionsResponse instance using the specified properties. + * @function create + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {google.iam.v1.ITestIamPermissionsResponse=} [properties] Properties to set + * @returns {google.iam.v1.TestIamPermissionsResponse} TestIamPermissionsResponse instance + */ + TestIamPermissionsResponse.create = function create(properties) { + return new TestIamPermissionsResponse(properties); + }; + + /** + * Encodes the specified TestIamPermissionsResponse message. Does not implicitly {@link google.iam.v1.TestIamPermissionsResponse.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {google.iam.v1.ITestIamPermissionsResponse} message TestIamPermissionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestIamPermissionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.permissions != null && message.permissions.length) + for (var i = 0; i < message.permissions.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.permissions[i]); + return writer; + }; + + /** + * Encodes the specified TestIamPermissionsResponse message, length delimited. Does not implicitly {@link google.iam.v1.TestIamPermissionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {google.iam.v1.ITestIamPermissionsResponse} message TestIamPermissionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TestIamPermissionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TestIamPermissionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.TestIamPermissionsResponse} TestIamPermissionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestIamPermissionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.TestIamPermissionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TestIamPermissionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.TestIamPermissionsResponse} TestIamPermissionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TestIamPermissionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TestIamPermissionsResponse message. + * @function verify + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TestIamPermissionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.permissions != null && message.hasOwnProperty("permissions")) { + if (!Array.isArray(message.permissions)) + return "permissions: array expected"; + for (var i = 0; i < message.permissions.length; ++i) + if (!$util.isString(message.permissions[i])) + return "permissions: string[] expected"; + } + return null; + }; + + /** + * Creates a TestIamPermissionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.TestIamPermissionsResponse} TestIamPermissionsResponse + */ + TestIamPermissionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.TestIamPermissionsResponse) + return object; + var message = new $root.google.iam.v1.TestIamPermissionsResponse(); + if (object.permissions) { + if (!Array.isArray(object.permissions)) + throw TypeError(".google.iam.v1.TestIamPermissionsResponse.permissions: array expected"); + message.permissions = []; + for (var i = 0; i < object.permissions.length; ++i) + message.permissions[i] = String(object.permissions[i]); + } + return message; + }; + + /** + * Creates a plain object from a TestIamPermissionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {google.iam.v1.TestIamPermissionsResponse} message TestIamPermissionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TestIamPermissionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.permissions = []; + if (message.permissions && message.permissions.length) { + object.permissions = []; + for (var j = 0; j < message.permissions.length; ++j) + object.permissions[j] = message.permissions[j]; + } + return object; + }; + + /** + * Converts this TestIamPermissionsResponse to JSON. + * @function toJSON + * @memberof google.iam.v1.TestIamPermissionsResponse + * @instance + * @returns {Object.} JSON object + */ + TestIamPermissionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TestIamPermissionsResponse; + })(); + + v1.GetPolicyOptions = (function() { + + /** + * Properties of a GetPolicyOptions. + * @memberof google.iam.v1 + * @interface IGetPolicyOptions + * @property {number|null} [requestedPolicyVersion] GetPolicyOptions requestedPolicyVersion + */ + + /** + * Constructs a new GetPolicyOptions. + * @memberof google.iam.v1 + * @classdesc Represents a GetPolicyOptions. + * @implements IGetPolicyOptions + * @constructor + * @param {google.iam.v1.IGetPolicyOptions=} [properties] Properties to set + */ + function GetPolicyOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetPolicyOptions requestedPolicyVersion. + * @member {number} requestedPolicyVersion + * @memberof google.iam.v1.GetPolicyOptions + * @instance + */ + GetPolicyOptions.prototype.requestedPolicyVersion = 0; + + /** + * Creates a new GetPolicyOptions instance using the specified properties. + * @function create + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {google.iam.v1.IGetPolicyOptions=} [properties] Properties to set + * @returns {google.iam.v1.GetPolicyOptions} GetPolicyOptions instance + */ + GetPolicyOptions.create = function create(properties) { + return new GetPolicyOptions(properties); + }; + + /** + * Encodes the specified GetPolicyOptions message. Does not implicitly {@link google.iam.v1.GetPolicyOptions.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {google.iam.v1.IGetPolicyOptions} message GetPolicyOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPolicyOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.requestedPolicyVersion != null && message.hasOwnProperty("requestedPolicyVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.requestedPolicyVersion); + return writer; + }; + + /** + * Encodes the specified GetPolicyOptions message, length delimited. Does not implicitly {@link google.iam.v1.GetPolicyOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {google.iam.v1.IGetPolicyOptions} message GetPolicyOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPolicyOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetPolicyOptions message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.GetPolicyOptions} GetPolicyOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPolicyOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.GetPolicyOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.requestedPolicyVersion = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetPolicyOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.GetPolicyOptions} GetPolicyOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPolicyOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetPolicyOptions message. + * @function verify + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetPolicyOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.requestedPolicyVersion != null && message.hasOwnProperty("requestedPolicyVersion")) + if (!$util.isInteger(message.requestedPolicyVersion)) + return "requestedPolicyVersion: integer expected"; + return null; + }; + + /** + * Creates a GetPolicyOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.GetPolicyOptions} GetPolicyOptions + */ + GetPolicyOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.GetPolicyOptions) + return object; + var message = new $root.google.iam.v1.GetPolicyOptions(); + if (object.requestedPolicyVersion != null) + message.requestedPolicyVersion = object.requestedPolicyVersion | 0; + return message; + }; + + /** + * Creates a plain object from a GetPolicyOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {google.iam.v1.GetPolicyOptions} message GetPolicyOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetPolicyOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.requestedPolicyVersion = 0; + if (message.requestedPolicyVersion != null && message.hasOwnProperty("requestedPolicyVersion")) + object.requestedPolicyVersion = message.requestedPolicyVersion; + return object; + }; + + /** + * Converts this GetPolicyOptions to JSON. + * @function toJSON + * @memberof google.iam.v1.GetPolicyOptions + * @instance + * @returns {Object.} JSON object + */ + GetPolicyOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetPolicyOptions; + })(); + + v1.Policy = (function() { + + /** + * Properties of a Policy. + * @memberof google.iam.v1 + * @interface IPolicy + * @property {number|null} [version] Policy version + * @property {Array.|null} [bindings] Policy bindings + * @property {Uint8Array|null} [etag] Policy etag + */ + + /** + * Constructs a new Policy. + * @memberof google.iam.v1 + * @classdesc Represents a Policy. + * @implements IPolicy + * @constructor + * @param {google.iam.v1.IPolicy=} [properties] Properties to set + */ + function Policy(properties) { + this.bindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Policy version. + * @member {number} version + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.version = 0; + + /** + * Policy bindings. + * @member {Array.} bindings + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.bindings = $util.emptyArray; + + /** + * Policy etag. + * @member {Uint8Array} etag + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.etag = $util.newBuffer([]); + + /** + * Creates a new Policy instance using the specified properties. + * @function create + * @memberof google.iam.v1.Policy + * @static + * @param {google.iam.v1.IPolicy=} [properties] Properties to set + * @returns {google.iam.v1.Policy} Policy instance + */ + Policy.create = function create(properties) { + return new Policy(properties); + }; + + /** + * Encodes the specified Policy message. Does not implicitly {@link google.iam.v1.Policy.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.Policy + * @static + * @param {google.iam.v1.IPolicy} message Policy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Policy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && message.hasOwnProperty("version")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.version); + if (message.etag != null && message.hasOwnProperty("etag")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.etag); + if (message.bindings != null && message.bindings.length) + for (var i = 0; i < message.bindings.length; ++i) + $root.google.iam.v1.Binding.encode(message.bindings[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Policy message, length delimited. Does not implicitly {@link google.iam.v1.Policy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.Policy + * @static + * @param {google.iam.v1.IPolicy} message Policy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Policy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Policy message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.Policy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.Policy} Policy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Policy.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.Policy(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.int32(); + break; + case 4: + if (!(message.bindings && message.bindings.length)) + message.bindings = []; + message.bindings.push($root.google.iam.v1.Binding.decode(reader, reader.uint32())); + break; + case 3: + message.etag = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Policy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.Policy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.Policy} Policy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Policy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Policy message. + * @function verify + * @memberof google.iam.v1.Policy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Policy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isInteger(message.version)) + return "version: integer expected"; + if (message.bindings != null && message.hasOwnProperty("bindings")) { + if (!Array.isArray(message.bindings)) + return "bindings: array expected"; + for (var i = 0; i < message.bindings.length; ++i) { + var error = $root.google.iam.v1.Binding.verify(message.bindings[i]); + if (error) + return "bindings." + error; + } + } + if (message.etag != null && message.hasOwnProperty("etag")) + if (!(message.etag && typeof message.etag.length === "number" || $util.isString(message.etag))) + return "etag: buffer expected"; + return null; + }; + + /** + * Creates a Policy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.Policy + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.Policy} Policy + */ + Policy.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.Policy) + return object; + var message = new $root.google.iam.v1.Policy(); + if (object.version != null) + message.version = object.version | 0; + if (object.bindings) { + if (!Array.isArray(object.bindings)) + throw TypeError(".google.iam.v1.Policy.bindings: array expected"); + message.bindings = []; + for (var i = 0; i < object.bindings.length; ++i) { + if (typeof object.bindings[i] !== "object") + throw TypeError(".google.iam.v1.Policy.bindings: object expected"); + message.bindings[i] = $root.google.iam.v1.Binding.fromObject(object.bindings[i]); + } + } + if (object.etag != null) + if (typeof object.etag === "string") + $util.base64.decode(object.etag, message.etag = $util.newBuffer($util.base64.length(object.etag)), 0); + else if (object.etag.length) + message.etag = object.etag; + return message; + }; + + /** + * Creates a plain object from a Policy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.Policy + * @static + * @param {google.iam.v1.Policy} message Policy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Policy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.bindings = []; + if (options.defaults) { + object.version = 0; + if (options.bytes === String) + object.etag = ""; + else { + object.etag = []; + if (options.bytes !== Array) + object.etag = $util.newBuffer(object.etag); + } + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = options.bytes === String ? $util.base64.encode(message.etag, 0, message.etag.length) : options.bytes === Array ? Array.prototype.slice.call(message.etag) : message.etag; + if (message.bindings && message.bindings.length) { + object.bindings = []; + for (var j = 0; j < message.bindings.length; ++j) + object.bindings[j] = $root.google.iam.v1.Binding.toObject(message.bindings[j], options); + } + return object; + }; + + /** + * Converts this Policy to JSON. + * @function toJSON + * @memberof google.iam.v1.Policy + * @instance + * @returns {Object.} JSON object + */ + Policy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Policy; + })(); + + v1.Binding = (function() { + + /** + * Properties of a Binding. + * @memberof google.iam.v1 + * @interface IBinding + * @property {string|null} [role] Binding role + * @property {Array.|null} [members] Binding members + * @property {google.type.IExpr|null} [condition] Binding condition + */ + + /** + * Constructs a new Binding. + * @memberof google.iam.v1 + * @classdesc Represents a Binding. + * @implements IBinding + * @constructor + * @param {google.iam.v1.IBinding=} [properties] Properties to set + */ + function Binding(properties) { + this.members = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Binding role. + * @member {string} role + * @memberof google.iam.v1.Binding + * @instance + */ + Binding.prototype.role = ""; + + /** + * Binding members. + * @member {Array.} members + * @memberof google.iam.v1.Binding + * @instance + */ + Binding.prototype.members = $util.emptyArray; + + /** + * Binding condition. + * @member {google.type.IExpr|null|undefined} condition + * @memberof google.iam.v1.Binding + * @instance + */ + Binding.prototype.condition = null; + + /** + * Creates a new Binding instance using the specified properties. + * @function create + * @memberof google.iam.v1.Binding + * @static + * @param {google.iam.v1.IBinding=} [properties] Properties to set + * @returns {google.iam.v1.Binding} Binding instance + */ + Binding.create = function create(properties) { + return new Binding(properties); + }; + + /** + * Encodes the specified Binding message. Does not implicitly {@link google.iam.v1.Binding.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.Binding + * @static + * @param {google.iam.v1.IBinding} message Binding message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Binding.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.role != null && message.hasOwnProperty("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 && message.hasOwnProperty("condition")) + $root.google.type.Expr.encode(message.condition, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Binding message, length delimited. Does not implicitly {@link google.iam.v1.Binding.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.Binding + * @static + * @param {google.iam.v1.IBinding} message Binding message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Binding.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Binding message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.Binding + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.Binding} Binding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Binding.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.Binding(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.role = reader.string(); + break; + case 2: + if (!(message.members && message.members.length)) + message.members = []; + message.members.push(reader.string()); + break; + case 3: + message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Binding message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.Binding + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.Binding} Binding + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Binding.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Binding message. + * @function verify + * @memberof google.iam.v1.Binding + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Binding.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.role != null && message.hasOwnProperty("role")) + if (!$util.isString(message.role)) + return "role: string expected"; + if (message.members != null && message.hasOwnProperty("members")) { + if (!Array.isArray(message.members)) + return "members: array expected"; + for (var i = 0; i < message.members.length; ++i) + if (!$util.isString(message.members[i])) + return "members: string[] expected"; + } + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.type.Expr.verify(message.condition); + if (error) + return "condition." + error; + } + return null; + }; + + /** + * Creates a Binding message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.Binding + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.Binding} Binding + */ + Binding.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.Binding) + return object; + var message = new $root.google.iam.v1.Binding(); + if (object.role != null) + message.role = String(object.role); + if (object.members) { + if (!Array.isArray(object.members)) + throw TypeError(".google.iam.v1.Binding.members: array expected"); + message.members = []; + for (var i = 0; i < object.members.length; ++i) + message.members[i] = String(object.members[i]); + } + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.iam.v1.Binding.condition: object expected"); + message.condition = $root.google.type.Expr.fromObject(object.condition); + } + return message; + }; + + /** + * Creates a plain object from a Binding message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.Binding + * @static + * @param {google.iam.v1.Binding} message Binding + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Binding.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.members = []; + if (options.defaults) { + object.role = ""; + object.condition = null; + } + if (message.role != null && message.hasOwnProperty("role")) + object.role = message.role; + if (message.members && message.members.length) { + object.members = []; + for (var j = 0; j < message.members.length; ++j) + object.members[j] = message.members[j]; + } + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.type.Expr.toObject(message.condition, options); + return object; + }; + + /** + * Converts this Binding to JSON. + * @function toJSON + * @memberof google.iam.v1.Binding + * @instance + * @returns {Object.} JSON object + */ + Binding.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Binding; + })(); + + v1.PolicyDelta = (function() { + + /** + * Properties of a PolicyDelta. + * @memberof google.iam.v1 + * @interface IPolicyDelta + * @property {Array.|null} [bindingDeltas] PolicyDelta bindingDeltas + * @property {Array.|null} [auditConfigDeltas] PolicyDelta auditConfigDeltas + */ + + /** + * Constructs a new PolicyDelta. + * @memberof google.iam.v1 + * @classdesc Represents a PolicyDelta. + * @implements IPolicyDelta + * @constructor + * @param {google.iam.v1.IPolicyDelta=} [properties] Properties to set + */ + function PolicyDelta(properties) { + this.bindingDeltas = []; + this.auditConfigDeltas = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PolicyDelta bindingDeltas. + * @member {Array.} bindingDeltas + * @memberof google.iam.v1.PolicyDelta + * @instance + */ + PolicyDelta.prototype.bindingDeltas = $util.emptyArray; + + /** + * PolicyDelta auditConfigDeltas. + * @member {Array.} auditConfigDeltas + * @memberof google.iam.v1.PolicyDelta + * @instance + */ + PolicyDelta.prototype.auditConfigDeltas = $util.emptyArray; + + /** + * Creates a new PolicyDelta instance using the specified properties. + * @function create + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {google.iam.v1.IPolicyDelta=} [properties] Properties to set + * @returns {google.iam.v1.PolicyDelta} PolicyDelta instance + */ + PolicyDelta.create = function create(properties) { + return new PolicyDelta(properties); + }; + + /** + * Encodes the specified PolicyDelta message. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {google.iam.v1.IPolicyDelta} message PolicyDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PolicyDelta.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bindingDeltas != null && message.bindingDeltas.length) + for (var i = 0; i < message.bindingDeltas.length; ++i) + $root.google.iam.v1.BindingDelta.encode(message.bindingDeltas[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.auditConfigDeltas != null && message.auditConfigDeltas.length) + for (var i = 0; i < message.auditConfigDeltas.length; ++i) + $root.google.iam.v1.AuditConfigDelta.encode(message.auditConfigDeltas[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PolicyDelta message, length delimited. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {google.iam.v1.IPolicyDelta} message PolicyDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PolicyDelta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PolicyDelta message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.PolicyDelta} PolicyDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PolicyDelta.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.PolicyDelta(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.bindingDeltas && message.bindingDeltas.length)) + message.bindingDeltas = []; + message.bindingDeltas.push($root.google.iam.v1.BindingDelta.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.auditConfigDeltas && message.auditConfigDeltas.length)) + message.auditConfigDeltas = []; + message.auditConfigDeltas.push($root.google.iam.v1.AuditConfigDelta.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PolicyDelta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.PolicyDelta} PolicyDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PolicyDelta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PolicyDelta message. + * @function verify + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PolicyDelta.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bindingDeltas != null && message.hasOwnProperty("bindingDeltas")) { + if (!Array.isArray(message.bindingDeltas)) + return "bindingDeltas: array expected"; + for (var i = 0; i < message.bindingDeltas.length; ++i) { + var error = $root.google.iam.v1.BindingDelta.verify(message.bindingDeltas[i]); + if (error) + return "bindingDeltas." + error; + } + } + if (message.auditConfigDeltas != null && message.hasOwnProperty("auditConfigDeltas")) { + if (!Array.isArray(message.auditConfigDeltas)) + return "auditConfigDeltas: array expected"; + for (var i = 0; i < message.auditConfigDeltas.length; ++i) { + var error = $root.google.iam.v1.AuditConfigDelta.verify(message.auditConfigDeltas[i]); + if (error) + return "auditConfigDeltas." + error; + } + } + return null; + }; + + /** + * Creates a PolicyDelta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.PolicyDelta} PolicyDelta + */ + PolicyDelta.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.PolicyDelta) + return object; + var message = new $root.google.iam.v1.PolicyDelta(); + if (object.bindingDeltas) { + if (!Array.isArray(object.bindingDeltas)) + throw TypeError(".google.iam.v1.PolicyDelta.bindingDeltas: array expected"); + message.bindingDeltas = []; + for (var i = 0; i < object.bindingDeltas.length; ++i) { + if (typeof object.bindingDeltas[i] !== "object") + throw TypeError(".google.iam.v1.PolicyDelta.bindingDeltas: object expected"); + message.bindingDeltas[i] = $root.google.iam.v1.BindingDelta.fromObject(object.bindingDeltas[i]); + } + } + if (object.auditConfigDeltas) { + if (!Array.isArray(object.auditConfigDeltas)) + throw TypeError(".google.iam.v1.PolicyDelta.auditConfigDeltas: array expected"); + message.auditConfigDeltas = []; + for (var i = 0; i < object.auditConfigDeltas.length; ++i) { + if (typeof object.auditConfigDeltas[i] !== "object") + throw TypeError(".google.iam.v1.PolicyDelta.auditConfigDeltas: object expected"); + message.auditConfigDeltas[i] = $root.google.iam.v1.AuditConfigDelta.fromObject(object.auditConfigDeltas[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PolicyDelta message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {google.iam.v1.PolicyDelta} message PolicyDelta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PolicyDelta.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.bindingDeltas = []; + object.auditConfigDeltas = []; + } + if (message.bindingDeltas && message.bindingDeltas.length) { + object.bindingDeltas = []; + for (var j = 0; j < message.bindingDeltas.length; ++j) + object.bindingDeltas[j] = $root.google.iam.v1.BindingDelta.toObject(message.bindingDeltas[j], options); + } + if (message.auditConfigDeltas && message.auditConfigDeltas.length) { + object.auditConfigDeltas = []; + for (var j = 0; j < message.auditConfigDeltas.length; ++j) + object.auditConfigDeltas[j] = $root.google.iam.v1.AuditConfigDelta.toObject(message.auditConfigDeltas[j], options); + } + return object; + }; + + /** + * Converts this PolicyDelta to JSON. + * @function toJSON + * @memberof google.iam.v1.PolicyDelta + * @instance + * @returns {Object.} JSON object + */ + PolicyDelta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return PolicyDelta; + })(); + + v1.BindingDelta = (function() { + + /** + * Properties of a BindingDelta. + * @memberof google.iam.v1 + * @interface IBindingDelta + * @property {google.iam.v1.BindingDelta.Action|null} [action] BindingDelta action + * @property {string|null} [role] BindingDelta role + * @property {string|null} [member] BindingDelta member + * @property {google.type.IExpr|null} [condition] BindingDelta condition + */ + + /** + * Constructs a new BindingDelta. + * @memberof google.iam.v1 + * @classdesc Represents a BindingDelta. + * @implements IBindingDelta + * @constructor + * @param {google.iam.v1.IBindingDelta=} [properties] Properties to set + */ + function BindingDelta(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BindingDelta action. + * @member {google.iam.v1.BindingDelta.Action} action + * @memberof google.iam.v1.BindingDelta + * @instance + */ + BindingDelta.prototype.action = 0; + + /** + * BindingDelta role. + * @member {string} role + * @memberof google.iam.v1.BindingDelta + * @instance + */ + BindingDelta.prototype.role = ""; + + /** + * BindingDelta member. + * @member {string} member + * @memberof google.iam.v1.BindingDelta + * @instance + */ + BindingDelta.prototype.member = ""; + + /** + * BindingDelta condition. + * @member {google.type.IExpr|null|undefined} condition + * @memberof google.iam.v1.BindingDelta + * @instance + */ + BindingDelta.prototype.condition = null; + + /** + * Creates a new BindingDelta instance using the specified properties. + * @function create + * @memberof google.iam.v1.BindingDelta + * @static + * @param {google.iam.v1.IBindingDelta=} [properties] Properties to set + * @returns {google.iam.v1.BindingDelta} BindingDelta instance + */ + BindingDelta.create = function create(properties) { + return new BindingDelta(properties); + }; + + /** + * Encodes the specified BindingDelta message. Does not implicitly {@link google.iam.v1.BindingDelta.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.BindingDelta + * @static + * @param {google.iam.v1.IBindingDelta} message BindingDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BindingDelta.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.action != null && message.hasOwnProperty("action")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.action); + if (message.role != null && message.hasOwnProperty("role")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.role); + if (message.member != null && message.hasOwnProperty("member")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.member); + if (message.condition != null && message.hasOwnProperty("condition")) + $root.google.type.Expr.encode(message.condition, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BindingDelta message, length delimited. Does not implicitly {@link google.iam.v1.BindingDelta.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.BindingDelta + * @static + * @param {google.iam.v1.IBindingDelta} message BindingDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BindingDelta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BindingDelta message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.BindingDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.BindingDelta} BindingDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BindingDelta.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.BindingDelta(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.action = reader.int32(); + break; + case 2: + message.role = reader.string(); + break; + case 3: + message.member = reader.string(); + break; + case 4: + message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BindingDelta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.BindingDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.BindingDelta} BindingDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BindingDelta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BindingDelta message. + * @function verify + * @memberof google.iam.v1.BindingDelta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BindingDelta.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.action != null && message.hasOwnProperty("action")) + switch (message.action) { + default: + return "action: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.role != null && message.hasOwnProperty("role")) + if (!$util.isString(message.role)) + return "role: string expected"; + if (message.member != null && message.hasOwnProperty("member")) + if (!$util.isString(message.member)) + return "member: string expected"; + if (message.condition != null && message.hasOwnProperty("condition")) { + var error = $root.google.type.Expr.verify(message.condition); + if (error) + return "condition." + error; + } + return null; + }; + + /** + * Creates a BindingDelta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.BindingDelta + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.BindingDelta} BindingDelta + */ + BindingDelta.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.BindingDelta) + return object; + var message = new $root.google.iam.v1.BindingDelta(); + switch (object.action) { + case "ACTION_UNSPECIFIED": + case 0: + message.action = 0; + break; + case "ADD": + case 1: + message.action = 1; + break; + case "REMOVE": + case 2: + message.action = 2; + break; + } + if (object.role != null) + message.role = String(object.role); + if (object.member != null) + message.member = String(object.member); + if (object.condition != null) { + if (typeof object.condition !== "object") + throw TypeError(".google.iam.v1.BindingDelta.condition: object expected"); + message.condition = $root.google.type.Expr.fromObject(object.condition); + } + return message; + }; + + /** + * Creates a plain object from a BindingDelta message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.BindingDelta + * @static + * @param {google.iam.v1.BindingDelta} message BindingDelta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BindingDelta.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.action = options.enums === String ? "ACTION_UNSPECIFIED" : 0; + object.role = ""; + object.member = ""; + object.condition = null; + } + if (message.action != null && message.hasOwnProperty("action")) + object.action = options.enums === String ? $root.google.iam.v1.BindingDelta.Action[message.action] : message.action; + if (message.role != null && message.hasOwnProperty("role")) + object.role = message.role; + if (message.member != null && message.hasOwnProperty("member")) + object.member = message.member; + if (message.condition != null && message.hasOwnProperty("condition")) + object.condition = $root.google.type.Expr.toObject(message.condition, options); + return object; + }; + + /** + * Converts this BindingDelta to JSON. + * @function toJSON + * @memberof google.iam.v1.BindingDelta + * @instance + * @returns {Object.} JSON object + */ + BindingDelta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Action enum. + * @name google.iam.v1.BindingDelta.Action + * @enum {string} + * @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 && message.hasOwnProperty("action")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.action); + if (message.service != null && message.hasOwnProperty("service")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.service); + if (message.exemptedMember != null && message.hasOwnProperty("exemptedMember")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.exemptedMember); + if (message.logType != null && message.hasOwnProperty("logType")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.logType); + return writer; + }; + + /** + * Encodes the specified AuditConfigDelta message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfigDelta.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {google.iam.v1.IAuditConfigDelta} message AuditConfigDelta message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditConfigDelta.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AuditConfigDelta message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.AuditConfigDelta} AuditConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditConfigDelta.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.AuditConfigDelta(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.action = reader.int32(); + break; + case 2: + message.service = reader.string(); + break; + case 3: + message.exemptedMember = reader.string(); + break; + case 4: + message.logType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AuditConfigDelta message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.AuditConfigDelta} AuditConfigDelta + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditConfigDelta.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AuditConfigDelta message. + * @function verify + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AuditConfigDelta.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.action != null && message.hasOwnProperty("action")) + switch (message.action) { + default: + return "action: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + if (message.exemptedMember != null && message.hasOwnProperty("exemptedMember")) + if (!$util.isString(message.exemptedMember)) + return "exemptedMember: string expected"; + if (message.logType != null && message.hasOwnProperty("logType")) + if (!$util.isString(message.logType)) + return "logType: string expected"; + return null; + }; + + /** + * Creates an AuditConfigDelta message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.AuditConfigDelta} AuditConfigDelta + */ + AuditConfigDelta.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.AuditConfigDelta) + return object; + var message = new $root.google.iam.v1.AuditConfigDelta(); + switch (object.action) { + case "ACTION_UNSPECIFIED": + case 0: + message.action = 0; + break; + case "ADD": + case 1: + message.action = 1; + break; + case "REMOVE": + case 2: + message.action = 2; + break; + } + if (object.service != null) + message.service = String(object.service); + if (object.exemptedMember != null) + message.exemptedMember = String(object.exemptedMember); + if (object.logType != null) + message.logType = String(object.logType); + return message; + }; + + /** + * Creates a plain object from an AuditConfigDelta message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {google.iam.v1.AuditConfigDelta} message AuditConfigDelta + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuditConfigDelta.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.action = options.enums === String ? "ACTION_UNSPECIFIED" : 0; + object.service = ""; + object.exemptedMember = ""; + object.logType = ""; + } + if (message.action != null && message.hasOwnProperty("action")) + object.action = options.enums === String ? $root.google.iam.v1.AuditConfigDelta.Action[message.action] : message.action; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.exemptedMember != null && message.hasOwnProperty("exemptedMember")) + object.exemptedMember = message.exemptedMember; + if (message.logType != null && message.hasOwnProperty("logType")) + object.logType = message.logType; + return object; + }; + + /** + * Converts this AuditConfigDelta to JSON. + * @function toJSON + * @memberof google.iam.v1.AuditConfigDelta + * @instance + * @returns {Object.} JSON object + */ + AuditConfigDelta.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Action enum. + * @name google.iam.v1.AuditConfigDelta.Action + * @enum {string} + * @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 && message.hasOwnProperty("expression")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.expression); + if (message.title != null && message.hasOwnProperty("title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && message.hasOwnProperty("description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.location != null && message.hasOwnProperty("location")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.location); + return writer; + }; + + /** + * Encodes the specified Expr message, length delimited. Does not implicitly {@link google.type.Expr.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Expr + * @static + * @param {google.type.IExpr} message Expr message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Expr.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Expr message from the specified reader or buffer. + * @function decode + * @memberof google.type.Expr + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.type.Expr} Expr + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Expr.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Expr(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.expression = reader.string(); + break; + case 2: + message.title = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.location = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Expr message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Expr + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.type.Expr} Expr + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Expr.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Expr message. + * @function verify + * @memberof google.type.Expr + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Expr.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.expression != null && message.hasOwnProperty("expression")) + if (!$util.isString(message.expression)) + return "expression: string expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + return null; + }; + + /** + * Creates an Expr message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Expr + * @static + * @param {Object.} object Plain object + * @returns {google.type.Expr} Expr + */ + Expr.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Expr) + return object; + var message = new $root.google.type.Expr(); + if (object.expression != null) + message.expression = String(object.expression); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.location != null) + message.location = String(object.location); + return message; + }; + + /** + * Creates a plain object from an Expr message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Expr + * @static + * @param {google.type.Expr} message Expr + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Expr.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.expression = ""; + object.title = ""; + object.description = ""; + object.location = ""; + } + if (message.expression != null && message.hasOwnProperty("expression")) + object.expression = message.expression; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + return object; + }; + + /** + * Converts this Expr to JSON. + * @function toJSON + * @memberof google.type.Expr + * @instance + * @returns {Object.} JSON object + */ + Expr.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Expr; + })(); + + type.Money = (function() { + + /** + * Properties of a Money. + * @memberof google.type + * @interface IMoney + * @property {string|null} [currencyCode] Money currencyCode + * @property {number|Long|null} [units] Money units + * @property {number|null} [nanos] Money nanos + */ + + /** + * Constructs a new Money. + * @memberof google.type + * @classdesc Represents a Money. + * @implements IMoney + * @constructor + * @param {google.type.IMoney=} [properties] Properties to set + */ + function Money(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]]; + } + + /** + * Money currencyCode. + * @member {string} currencyCode + * @memberof google.type.Money + * @instance + */ + Money.prototype.currencyCode = ""; + + /** + * Money units. + * @member {number|Long} units + * @memberof google.type.Money + * @instance + */ + Money.prototype.units = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Money nanos. + * @member {number} nanos + * @memberof google.type.Money + * @instance + */ + Money.prototype.nanos = 0; + + /** + * Creates a new Money instance using the specified properties. + * @function create + * @memberof google.type.Money + * @static + * @param {google.type.IMoney=} [properties] Properties to set + * @returns {google.type.Money} Money instance + */ + Money.create = function create(properties) { + return new Money(properties); + }; + + /** + * Encodes the specified Money message. Does not implicitly {@link google.type.Money.verify|verify} messages. + * @function encode + * @memberof google.type.Money + * @static + * @param {google.type.IMoney} message Money message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Money.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); + if (message.units != null && message.hasOwnProperty("units")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.units); + if (message.nanos != null && message.hasOwnProperty("nanos")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Money message, length delimited. Does not implicitly {@link google.type.Money.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Money + * @static + * @param {google.type.IMoney} message Money message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Money.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Money message from the specified reader or buffer. + * @function decode + * @memberof google.type.Money + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.type.Money} Money + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Money.decode = function 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.Money(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.currencyCode = reader.string(); + break; + case 2: + message.units = reader.int64(); + break; + case 3: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Money message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Money + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.type.Money} Money + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Money.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Money message. + * @function verify + * @memberof google.type.Money + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Money.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (!$util.isString(message.currencyCode)) + return "currencyCode: string expected"; + if (message.units != null && message.hasOwnProperty("units")) + if (!$util.isInteger(message.units) && !(message.units && $util.isInteger(message.units.low) && $util.isInteger(message.units.high))) + return "units: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Money message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Money + * @static + * @param {Object.} object Plain object + * @returns {google.type.Money} Money + */ + Money.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Money) + return object; + var message = new $root.google.type.Money(); + if (object.currencyCode != null) + message.currencyCode = String(object.currencyCode); + if (object.units != null) + if ($util.Long) + (message.units = $util.Long.fromValue(object.units)).unsigned = false; + else if (typeof object.units === "string") + message.units = parseInt(object.units, 10); + else if (typeof object.units === "number") + message.units = object.units; + else if (typeof object.units === "object") + message.units = new $util.LongBits(object.units.low >>> 0, object.units.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Money message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Money + * @static + * @param {google.type.Money} message Money + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Money.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.currencyCode = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.units = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.units = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + object.currencyCode = message.currencyCode; + if (message.units != null && message.hasOwnProperty("units")) + if (typeof message.units === "number") + object.units = options.longs === String ? String(message.units) : message.units; + else + object.units = options.longs === String ? $util.Long.prototype.toString.call(message.units) : options.longs === Number ? new $util.LongBits(message.units.low >>> 0, message.units.high >>> 0).toNumber() : message.units; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Money to JSON. + * @function toJSON + * @memberof google.type.Money + * @instance + * @returns {Object.} JSON object + */ + Money.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Money; + })(); + + return type; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-billing/protos/protos.json b/packages/google-cloud-billing/protos/protos.json new file mode 100644 index 00000000000..6b233b9e72a --- /dev/null +++ b/packages/google-cloud-billing/protos/protos.json @@ -0,0 +1,1965 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "billing": { + "nested": { + "v1": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/billing/v1;billing", + "java_multiple_files": true, + "java_outer_classname": "CloudCatalogProto", + "java_package": "com.google.cloud.billing.v1", + "csharp_namespace": "Google.Cloud.Billing.V1", + "objc_class_prefix": "CLDCTLG" + }, + "nested": { + "CloudBilling": { + "options": { + "(google.api.default_host)": "cloudbilling.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "GetBillingAccount": { + "requestType": "GetBillingAccountRequest", + "responseType": "BillingAccount", + "options": { + "(google.api.http).get": "/v1/{name=billingAccounts/*}", + "(google.api.method_signature)": "name" + } + }, + "ListBillingAccounts": { + "requestType": "ListBillingAccountsRequest", + "responseType": "ListBillingAccountsResponse", + "options": { + "(google.api.http).get": "/v1/billingAccounts", + "(google.api.method_signature)": "" + } + }, + "UpdateBillingAccount": { + "requestType": "UpdateBillingAccountRequest", + "responseType": "BillingAccount", + "options": { + "(google.api.http).patch": "/v1/{name=billingAccounts/*}", + "(google.api.http).body": "account", + "(google.api.method_signature)": "name,account" + } + }, + "CreateBillingAccount": { + "requestType": "CreateBillingAccountRequest", + "responseType": "BillingAccount", + "options": { + "(google.api.http).post": "/v1/billingAccounts", + "(google.api.http).body": "billing_account", + "(google.api.method_signature)": "billing_account" + } + }, + "ListProjectBillingInfo": { + "requestType": "ListProjectBillingInfoRequest", + "responseType": "ListProjectBillingInfoResponse", + "options": { + "(google.api.http).get": "/v1/{name=billingAccounts/*}/projects", + "(google.api.method_signature)": "name" + } + }, + "GetProjectBillingInfo": { + "requestType": "GetProjectBillingInfoRequest", + "responseType": "ProjectBillingInfo", + "options": { + "(google.api.http).get": "/v1/{name=projects/*}/billingInfo", + "(google.api.method_signature)": "name" + } + }, + "UpdateProjectBillingInfo": { + "requestType": "UpdateProjectBillingInfoRequest", + "responseType": "ProjectBillingInfo", + "options": { + "(google.api.http).put": "/v1/{name=projects/*}/billingInfo", + "(google.api.http).body": "project_billing_info", + "(google.api.method_signature)": "name,project_billing_info" + } + }, + "GetIamPolicy": { + "requestType": "google.iam.v1.GetIamPolicyRequest", + "responseType": "google.iam.v1.Policy", + "options": { + "(google.api.http).get": "/v1/{resource=billingAccounts/*}:getIamPolicy", + "(google.api.method_signature)": "resource" + } + }, + "SetIamPolicy": { + "requestType": "google.iam.v1.SetIamPolicyRequest", + "responseType": "google.iam.v1.Policy", + "options": { + "(google.api.http).post": "/v1/{resource=billingAccounts/*}:setIamPolicy", + "(google.api.http).body": "*", + "(google.api.method_signature)": "resource,policy" + } + }, + "TestIamPermissions": { + "requestType": "google.iam.v1.TestIamPermissionsRequest", + "responseType": "google.iam.v1.TestIamPermissionsResponse", + "options": { + "(google.api.http).post": "/v1/{resource=billingAccounts/*}:testIamPermissions", + "(google.api.http).body": "*", + "(google.api.method_signature)": "resource,permissions" + } + } + } + }, + "BillingAccount": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "cloudbilling.googleapis.com/BillingAccount" + } + }, + "open": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "displayName": { + "type": "string", + "id": 3 + }, + "masterBillingAccount": { + "type": "string", + "id": 4 + } + } + }, + "ProjectBillingInfo": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "projectId": { + "type": "string", + "id": 2 + }, + "billingAccountName": { + "type": "string", + "id": 3 + }, + "billingEnabled": { + "type": "bool", + "id": 4 + } + } + }, + "GetBillingAccountRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudbilling.googleapis.com/BillingAccount" + } + } + } + }, + "ListBillingAccountsRequest": { + "fields": { + "pageSize": { + "type": "int32", + "id": 1 + }, + "pageToken": { + "type": "string", + "id": 2 + }, + "filter": { + "type": "string", + "id": 3 + } + } + }, + "ListBillingAccountsResponse": { + "fields": { + "billingAccounts": { + "rule": "repeated", + "type": "BillingAccount", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateBillingAccountRequest": { + "fields": { + "billingAccount": { + "type": "BillingAccount", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateBillingAccountRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudbilling.googleapis.com/BillingAccount" + } + }, + "account": { + "type": "BillingAccount", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + } + } + }, + "ListProjectBillingInfoRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudbilling.googleapis.com/BillingAccount" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProjectBillingInfoResponse": { + "fields": { + "projectBillingInfo": { + "rule": "repeated", + "type": "ProjectBillingInfo", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetProjectBillingInfoRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateProjectBillingInfoRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "projectBillingInfo": { + "type": "ProjectBillingInfo", + "id": 2 + } + } + }, + "CloudCatalog": { + "options": { + "(google.api.default_host)": "cloudbilling.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListServices": { + "requestType": "ListServicesRequest", + "responseType": "ListServicesResponse", + "options": { + "(google.api.http).get": "/v1/services", + "(google.api.method_signature)": "" + } + }, + "ListSkus": { + "requestType": "ListSkusRequest", + "responseType": "ListSkusResponse", + "options": { + "(google.api.http).get": "/v1/{parent=services/*}/skus", + "(google.api.method_signature)": "parent" + } + } + } + }, + "Service": { + "options": { + "(google.api.resource).type": "cloudbilling.googleapis.com/Service", + "(google.api.resource).pattern": "services/{service}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "serviceId": { + "type": "string", + "id": 2 + }, + "displayName": { + "type": "string", + "id": 3 + }, + "businessEntityName": { + "type": "string", + "id": 4 + } + } + }, + "Sku": { + "options": { + "(google.api.resource).type": "cloudbilling.googleapis.com/Sku", + "(google.api.resource).pattern": "services/{service}/skus/{sku}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "skuId": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + }, + "category": { + "type": "Category", + "id": 4 + }, + "serviceRegions": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "pricingInfo": { + "rule": "repeated", + "type": "PricingInfo", + "id": 6 + }, + "serviceProviderName": { + "type": "string", + "id": 7 + } + } + }, + "Category": { + "fields": { + "serviceDisplayName": { + "type": "string", + "id": 1 + }, + "resourceFamily": { + "type": "string", + "id": 2 + }, + "resourceGroup": { + "type": "string", + "id": 3 + }, + "usageType": { + "type": "string", + "id": 4 + } + } + }, + "PricingInfo": { + "fields": { + "effectiveTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "summary": { + "type": "string", + "id": 2 + }, + "pricingExpression": { + "type": "PricingExpression", + "id": 3 + }, + "aggregationInfo": { + "type": "AggregationInfo", + "id": 4 + }, + "currencyConversionRate": { + "type": "double", + "id": 5 + } + } + }, + "PricingExpression": { + "fields": { + "usageUnit": { + "type": "string", + "id": 1 + }, + "usageUnitDescription": { + "type": "string", + "id": 4 + }, + "baseUnit": { + "type": "string", + "id": 5 + }, + "baseUnitDescription": { + "type": "string", + "id": 6 + }, + "baseUnitConversionFactor": { + "type": "double", + "id": 7 + }, + "displayQuantity": { + "type": "double", + "id": 2 + }, + "tieredRates": { + "rule": "repeated", + "type": "TierRate", + "id": 3 + } + }, + "nested": { + "TierRate": { + "fields": { + "startUsageAmount": { + "type": "double", + "id": 1 + }, + "unitPrice": { + "type": "google.type.Money", + "id": 2 + } + } + } + } + }, + "AggregationInfo": { + "fields": { + "aggregationLevel": { + "type": "AggregationLevel", + "id": 1 + }, + "aggregationInterval": { + "type": "AggregationInterval", + "id": 2 + }, + "aggregationCount": { + "type": "int32", + "id": 3 + } + }, + "nested": { + "AggregationLevel": { + "values": { + "AGGREGATION_LEVEL_UNSPECIFIED": 0, + "ACCOUNT": 1, + "PROJECT": 2 + } + }, + "AggregationInterval": { + "values": { + "AGGREGATION_INTERVAL_UNSPECIFIED": 0, + "DAILY": 1, + "MONTHLY": 2 + } + } + } + }, + "ListServicesRequest": { + "fields": { + "pageSize": { + "type": "int32", + "id": 1 + }, + "pageToken": { + "type": "string", + "id": 2 + } + } + }, + "ListServicesResponse": { + "fields": { + "services": { + "rule": "repeated", + "type": "Service", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ListSkusRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudbilling.googleapis.com/Service" + } + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "currencyCode": { + "type": "string", + "id": 4 + }, + "pageSize": { + "type": "int32", + "id": 5 + }, + "pageToken": { + "type": "string", + "id": 6 + } + } + }, + "ListSkusResponse": { + "fields": { + "skus": { + "rule": "repeated", + "type": "Sku", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "java_multiple_files": true, + "java_outer_classname": "ResourceProto", + "java_package": "com.google.api", + "objc_class_prefix": "GAPI", + "cc_enable_arenas": true + }, + "nested": { + "http": { + "type": "HttpRule", + "id": 72295728, + "extend": "google.protobuf.MethodOptions" + }, + "Http": { + "fields": { + "rules": { + "rule": "repeated", + "type": "HttpRule", + "id": 1 + }, + "fullyDecodeReservedExpansion": { + "type": "bool", + "id": 2 + } + } + }, + "HttpRule": { + "oneofs": { + "pattern": { + "oneof": [ + "get", + "put", + "post", + "delete", + "patch", + "custom" + ] + } + }, + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "get": { + "type": "string", + "id": 2 + }, + "put": { + "type": "string", + "id": 3 + }, + "post": { + "type": "string", + "id": 4 + }, + "delete": { + "type": "string", + "id": 5 + }, + "patch": { + "type": "string", + "id": 6 + }, + "custom": { + "type": "CustomHttpPattern", + "id": 8 + }, + "body": { + "type": "string", + "id": 7 + }, + "responseBody": { + "type": "string", + "id": 12 + }, + "additionalBindings": { + "rule": "repeated", + "type": "HttpRule", + "id": 11 + } + } + }, + "CustomHttpPattern": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" + }, + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions" + }, + "FieldBehavior": { + "values": { + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5 + } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + } + } + }, + "protobuf": { + "options": { + "go_package": "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "csharp_namespace": "Google.Protobuf.Reflection", + "objc_class_prefix": "GPB", + "cc_enable_arenas": true, + "optimize_for": "SPEED" + }, + "nested": { + "FileDescriptorSet": { + "fields": { + "file": { + "rule": "repeated", + "type": "FileDescriptorProto", + "id": 1 + } + } + }, + "FileDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "package": { + "type": "string", + "id": 2 + }, + "dependency": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "publicDependency": { + "rule": "repeated", + "type": "int32", + "id": 10, + "options": { + "packed": false + } + }, + "weakDependency": { + "rule": "repeated", + "type": "int32", + "id": 11, + "options": { + "packed": false + } + }, + "messageType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 4 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 5 + }, + "service": { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "id": 6 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 7 + }, + "options": { + "type": "FileOptions", + "id": 8 + }, + "sourceCodeInfo": { + "type": "SourceCodeInfo", + "id": 9 + }, + "syntax": { + "type": "string", + "id": 12 + } + } + }, + "DescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "field": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 2 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 6 + }, + "nestedType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 3 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 4 + }, + "extensionRange": { + "rule": "repeated", + "type": "ExtensionRange", + "id": 5 + }, + "oneofDecl": { + "rule": "repeated", + "type": "OneofDescriptorProto", + "id": 8 + }, + "options": { + "type": "MessageOptions", + "id": 7 + }, + "reservedRange": { + "rule": "repeated", + "type": "ReservedRange", + "id": 9 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 10 + } + }, + "nested": { + "ExtensionRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "ExtensionRangeOptions", + "id": 3 + } + } + }, + "ReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "ExtensionRangeOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "FieldDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 3 + }, + "label": { + "type": "Label", + "id": 4 + }, + "type": { + "type": "Type", + "id": 5 + }, + "typeName": { + "type": "string", + "id": 6 + }, + "extendee": { + "type": "string", + "id": 2 + }, + "defaultValue": { + "type": "string", + "id": 7 + }, + "oneofIndex": { + "type": "int32", + "id": 9 + }, + "jsonName": { + "type": "string", + "id": 10 + }, + "options": { + "type": "FieldOptions", + "id": 8 + } + }, + "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": false + } + }, + "objcClassPrefix": { + "type": "string", + "id": 36 + }, + "csharpNamespace": { + "type": "string", + "id": 37 + }, + "swiftPrefix": { + "type": "string", + "id": 39 + }, + "phpClassPrefix": { + "type": "string", + "id": 40 + }, + "phpNamespace": { + "type": "string", + "id": 41 + }, + "phpMetadataNamespace": { + "type": "string", + "id": 44 + }, + "rubyPackage": { + "type": "string", + "id": 45 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 38, + 38 + ] + ], + "nested": { + "OptimizeMode": { + "values": { + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3 + } + } + } + }, + "MessageOptions": { + "fields": { + "messageSetWireFormat": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "noStandardDescriptorAccessor": { + "type": "bool", + "id": 2, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "mapEntry": { + "type": "bool", + "id": 7 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 8, + 8 + ], + [ + 9, + 9 + ] + ] + }, + "FieldOptions": { + "fields": { + "ctype": { + "type": "CType", + "id": 1, + "options": { + "default": "STRING" + } + }, + "packed": { + "type": "bool", + "id": 2 + }, + "jstype": { + "type": "JSType", + "id": 6, + "options": { + "default": "JS_NORMAL" + } + }, + "lazy": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "weak": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ] + ], + "nested": { + "CType": { + "values": { + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2 + } + }, + "JSType": { + "values": { + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2 + } + } + } + }, + "OneofOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "EnumOptions": { + "fields": { + "allowAlias": { + "type": "bool", + "id": 2 + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 5, + 5 + ] + ] + }, + "EnumValueOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "ServiceOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "MethodOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "idempotencyLevel": { + "type": "IdempotencyLevel", + "id": 34, + "options": { + "default": "IDEMPOTENCY_UNKNOWN" + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "IdempotencyLevel": { + "values": { + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2 + } + } + } + }, + "UninterpretedOption": { + "fields": { + "name": { + "rule": "repeated", + "type": "NamePart", + "id": 2 + }, + "identifierValue": { + "type": "string", + "id": 3 + }, + "positiveIntValue": { + "type": "uint64", + "id": 4 + }, + "negativeIntValue": { + "type": "int64", + "id": 5 + }, + "doubleValue": { + "type": "double", + "id": 6 + }, + "stringValue": { + "type": "bytes", + "id": 7 + }, + "aggregateValue": { + "type": "string", + "id": 8 + } + }, + "nested": { + "NamePart": { + "fields": { + "namePart": { + "rule": "required", + "type": "string", + "id": 1 + }, + "isExtension": { + "rule": "required", + "type": "bool", + "id": 2 + } + } + } + } + }, + "SourceCodeInfo": { + "fields": { + "location": { + "rule": "repeated", + "type": "Location", + "id": 1 + } + }, + "nested": { + "Location": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "span": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "leadingComments": { + "type": "string", + "id": 3 + }, + "trailingComments": { + "type": "string", + "id": 4 + }, + "leadingDetachedComments": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + } + } + }, + "GeneratedCodeInfo": { + "fields": { + "annotation": { + "rule": "repeated", + "type": "Annotation", + "id": 1 + } + }, + "nested": { + "Annotation": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "sourceFile": { + "type": "string", + "id": 2 + }, + "begin": { + "type": "int32", + "id": 3 + }, + "end": { + "type": "int32", + "id": 4 + } + } + } + } + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "iam": { + "nested": { + "v1": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.Cloud.Iam.V1", + "go_package": "google.golang.org/genproto/googleapis/iam/v1;iam", + "java_multiple_files": true, + "java_outer_classname": "PolicyProto", + "java_package": "com.google.iam.v1", + "php_namespace": "Google\\Cloud\\Iam\\V1" + }, + "nested": { + "IAMPolicy": { + "options": { + "(google.api.default_host)": "iam-meta-api.googleapis.com" + }, + "methods": { + "SetIamPolicy": { + "requestType": "SetIamPolicyRequest", + "responseType": "Policy", + "options": { + "(google.api.http).post": "/v1/{resource=**}:setIamPolicy", + "(google.api.http).body": "*" + } + }, + "GetIamPolicy": { + "requestType": "GetIamPolicyRequest", + "responseType": "Policy", + "options": { + "(google.api.http).post": "/v1/{resource=**}:getIamPolicy", + "(google.api.http).body": "*" + } + }, + "TestIamPermissions": { + "requestType": "TestIamPermissionsRequest", + "responseType": "TestIamPermissionsResponse", + "options": { + "(google.api.http).post": "/v1/{resource=**}:testIamPermissions", + "(google.api.http).body": "*" + } + } + } + }, + "SetIamPolicyRequest": { + "fields": { + "resource": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "policy": { + "type": "Policy", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetIamPolicyRequest": { + "fields": { + "resource": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "options": { + "type": "GetPolicyOptions", + "id": 2 + } + } + }, + "TestIamPermissionsRequest": { + "fields": { + "resource": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "permissions": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "TestIamPermissionsResponse": { + "fields": { + "permissions": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "GetPolicyOptions": { + "fields": { + "requestedPolicyVersion": { + "type": "int32", + "id": 1 + } + } + }, + "Policy": { + "fields": { + "version": { + "type": "int32", + "id": 1 + }, + "bindings": { + "rule": "repeated", + "type": "Binding", + "id": 4 + }, + "etag": { + "type": "bytes", + "id": 3 + } + } + }, + "Binding": { + "fields": { + "role": { + "type": "string", + "id": 1 + }, + "members": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "condition": { + "type": "google.type.Expr", + "id": 3 + } + } + }, + "PolicyDelta": { + "fields": { + "bindingDeltas": { + "rule": "repeated", + "type": "BindingDelta", + "id": 1 + }, + "auditConfigDeltas": { + "rule": "repeated", + "type": "AuditConfigDelta", + "id": 2 + } + } + }, + "BindingDelta": { + "fields": { + "action": { + "type": "Action", + "id": 1 + }, + "role": { + "type": "string", + "id": 2 + }, + "member": { + "type": "string", + "id": 3 + }, + "condition": { + "type": "google.type.Expr", + "id": 4 + } + }, + "nested": { + "Action": { + "values": { + "ACTION_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2 + } + } + } + }, + "AuditConfigDelta": { + "fields": { + "action": { + "type": "Action", + "id": 1 + }, + "service": { + "type": "string", + "id": 2 + }, + "exemptedMember": { + "type": "string", + "id": 3 + }, + "logType": { + "type": "string", + "id": 4 + } + }, + "nested": { + "Action": { + "values": { + "ACTION_UNSPECIFIED": 0, + "ADD": 1, + "REMOVE": 2 + } + } + } + } + } + } + } + }, + "type": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/type/money;money", + "java_multiple_files": true, + "java_outer_classname": "MoneyProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP", + "cc_enable_arenas": true + }, + "nested": { + "Expr": { + "fields": { + "expression": { + "type": "string", + "id": 1 + }, + "title": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + }, + "location": { + "type": "string", + "id": 4 + } + } + }, + "Money": { + "fields": { + "currencyCode": { + "type": "string", + "id": 1 + }, + "units": { + "type": "int64", + "id": 2 + }, + "nanos": { + "type": "int32", + "id": 3 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-billing/samples/README.md b/packages/google-cloud-billing/samples/README.md new file mode 100644 index 00000000000..f98b84e6e2b --- /dev/null +++ b/packages/google-cloud-billing/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 + +# [Cloud Billing: Node.js Samples](https://github.com/googleapis/nodejs-billing) + +[![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-billing#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### Quickstart + +View the [source code](https://github.com/googleapis/nodejs-billing/blob/master/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-billing&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-billing&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/billing/docs diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json new file mode 100644 index 00000000000..433d3bd1cf5 --- /dev/null +++ b/packages/google-cloud-billing/samples/package.json @@ -0,0 +1,23 @@ +{ + "name": "nodejs-google-cloud-billing-samples", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=8" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "c8 mocha --timeout 600000 test/*.js" + }, + "dependencies": { + "@google-cloud/billing": "^0.1.0" + }, + "devDependencies": { + "c8": "^7.1.0", + "chai": "^4.2.0", + "mocha": "^7.1.0" + } +} diff --git a/packages/google-cloud-billing/samples/quickstart.js b/packages/google-cloud-billing/samples/quickstart.js new file mode 100644 index 00000000000..f629edbca4a --- /dev/null +++ b/packages/google-cloud-billing/samples/quickstart.js @@ -0,0 +1,46 @@ +// 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. +// + +'use strict'; + +async function quickstart( + name = 'my-project' // Project name to list billing accounts for. +) { + // [START billing_quickstart] + // Imports the Google Cloud client library + const {CloudBillingClient} = require('@google-cloud/billing'); + + // Creates a client + const client = new CloudBillingClient(); + + // name = 'my-project' // Project name to list billing accounts for. + + async function listBillingAccounts() { + const [accounts] = await client.listBillingAccounts({ + name, + }); + console.info(`found ${accounts.length} billing accounts:`); + for (const account of accounts) { + console.info(`${account.displayName}:`); + console.info(`\topen: ${account.open}`); + console.info(`\tparentBillingAccount: ${account.masterBillingAccount}`); + } + } + listBillingAccounts(); + // [END billing_quickstart] +} + +const args = process.argv.slice(2); +quickstart(...args).catch(console.error); diff --git a/packages/google-cloud-billing/samples/test/quickstart.js b/packages/google-cloud-billing/samples/test/quickstart.js new file mode 100644 index 00000000000..cd2b2b29c99 --- /dev/null +++ b/packages/google-cloud-billing/samples/test/quickstart.js @@ -0,0 +1,34 @@ +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +const path = require('path'); +const {assert} = require('chai'); +const cp = require('child_process'); +const {describe, it} = require('mocha'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const cwd = path.join(__dirname, '..'); + +describe('Quickstart', () => { + it('should run quickstart', async () => { + const stdout = execSync(`node ./quickstart.js`, {cwd}); + assert.match(stdout, /found [0-9]+ billing accounts/); + }); +}); diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts new file mode 100644 index 00000000000..e53a7318d1c --- /dev/null +++ b/packages/google-cloud-billing/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const CloudBillingClient = v1.CloudBillingClient; +const CloudCatalogClient = v1.CloudCatalogClient; +export {v1, CloudBillingClient, CloudCatalogClient}; +// For compatibility with JavaScript libraries we need to provide this default export: +// tslint:disable-next-line no-default-export +export default {v1, CloudBillingClient, CloudCatalogClient}; diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts new file mode 100644 index 00000000000..876ab6a08dd --- /dev/null +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -0,0 +1,1353 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + PaginationResponse, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './cloud_billing_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Retrieves GCP Console billing accounts and associates them with projects. + * @class + * @memberof v1 + */ +export class CloudBillingClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + cloudBillingStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudBillingClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof CloudBillingClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof CloudBillingClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + billingAccountPathTemplate: new gaxModule.PathTemplate( + 'billingAccounts/{billing_account}' + ), + servicePathTemplate: new gaxModule.PathTemplate('services/{service}'), + skuPathTemplate: new gaxModule.PathTemplate( + 'services/{service}/skus/{sku}' + ), + }; + + // 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 = { + listBillingAccounts: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'billingAccounts' + ), + listProjectBillingInfo: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'projectBillingInfo' + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.billing.v1.CloudBilling', + 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 = {}; + + // Put together the "service stub" for + // google.cloud.billing.v1.CloudBilling. + this.cloudBillingStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.billing.v1.CloudBilling' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.billing.v1.CloudBilling, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const cloudBillingStubMethods = [ + 'getBillingAccount', + 'listBillingAccounts', + 'updateBillingAccount', + 'createBillingAccount', + 'listProjectBillingInfo', + 'getProjectBillingInfo', + 'updateProjectBillingInfo', + 'getIamPolicy', + 'setIamPolicy', + 'testIamPermissions', + ]; + + for (const methodName of cloudBillingStubMethods) { + const innerCallPromise = this.cloudBillingStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'cloudbilling.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'cloudbilling.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getBillingAccount( + request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IBillingAccount, + protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, + {} | undefined + ] + >; + getBillingAccount( + request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, + {} | undefined + > + ): void; + /** + * Gets information about a billing account. The current authenticated user + * must be a [viewer of the billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account to retrieve. For example, + * `billingAccounts/012345-567890-ABCDEF`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getBillingAccount( + request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + | protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IBillingAccount, + protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getBillingAccount(request, options, callback); + } + updateBillingAccount( + request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IBillingAccount, + ( + | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest + | undefined + ), + {} | undefined + ] + >; + updateBillingAccount( + request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest + | undefined, + {} | undefined + > + ): void; + /** + * Updates a billing account's fields. + * Currently the only field that can be edited is `display_name`. + * The current authenticated user must have the `billing.accounts.update` + * IAM permission, which is typically given to the + * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) + * of the billing account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the billing account resource to be updated. + * @param {google.cloud.billing.v1.BillingAccount} request.account + * Required. The billing account resource to replace the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The update mask applied to the resource. + * Only "display_name" is currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateBillingAccount( + request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IBillingAccount, + ( + | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.updateBillingAccount(request, options, callback); + } + createBillingAccount( + request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IBillingAccount, + ( + | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest + | undefined + ), + {} | undefined + ] + >; + createBillingAccount( + request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest + | undefined, + {} | undefined + > + ): void; + /** + * Creates a billing account. + * This method can only be used to create + * [billing subaccounts](https://cloud.google.com/billing/docs/concepts) + * by GCP resellers. + * When creating a subaccount, the current authenticated user must have the + * `billing.accounts.update` IAM permission on the master account, which is + * typically given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * This method will return an error if the master account has not been + * provisioned as a reseller account. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.billing.v1.BillingAccount} request.billingAccount + * Required. The billing account resource to create. + * Currently CreateBillingAccount only supports subaccount creation, so + * any created billing accounts must be under a provided master billing + * account. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createBillingAccount( + request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount, + | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IBillingAccount, + ( + | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.createBillingAccount(request, options, callback); + } + getProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + ( + | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | undefined + ), + {} | undefined + ] + >; + getProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | undefined, + {} | undefined + > + ): void; + /** + * Gets the billing information for a project. The current authenticated user + * must have [permission to view the + * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + * ). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the project for which billing information is + * retrieved. For example, `projects/tokyo-rain-123`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + ( + | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getProjectBillingInfo( + request, + options, + callback + ); + } + updateProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + ( + | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | undefined + ), + {} | undefined + ] + >; + updateProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | undefined, + {} | undefined + > + ): void; + /** + * Sets or updates the billing account associated with a project. You specify + * the new billing account by setting the `billing_account_name` in the + * `ProjectBillingInfo` resource to the resource name of a billing account. + * Associating a project with an open billing account enables billing on the + * project and allows charges for resource usage. If the project already had a + * billing account, this method changes the billing account used for resource + * usage charges. + * + * *Note:* Incurred charges that have not yet been reported in the transaction + * history of the GCP Console might be billed to the new billing + * account, even if the charge occurred before the new billing account was + * assigned to the project. + * + * The current authenticated user must have ownership privileges for both the + * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + * ) and the [billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * You can disable billing on the project by setting the + * `billing_account_name` field to empty. This action disassociates the + * current billing account from the project. Any billable activity of your + * in-use services will stop, and your application could stop functioning as + * expected. Any unbilled charges to date will be billed to the previously + * associated account. The current authenticated user must be either an owner + * of the project or an owner of the billing account for the project. + * + * Note that associating a project with a *closed* billing account will have + * much the same effect as disabling billing on the project: any paid + * resources used by the project will be shut down. Thus, unless you wish to + * disable billing, you should always call this method with the name of an + * *open* billing account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the project associated with the billing information + * that you want to update. For example, `projects/tokyo-rain-123`. + * @param {google.cloud.billing.v1.ProjectBillingInfo} request.projectBillingInfo + * The new billing information for the project. Read-only fields are ignored; + * thus, you can leave empty all fields except `billing_account_name`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + ( + | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.updateProjectBillingInfo( + request, + options, + callback + ); + } + getIamPolicy( + request: protosTypes.google.iam.v1.IGetIamPolicyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + ] + >; + getIamPolicy( + request: protosTypes.google.iam.v1.IGetIamPolicyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + > + ): void; + /** + * Gets the access control policy for a billing account. + * The caller must have the `billing.accounts.getIamPolicy` permission on the + * account, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: protosTypes.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); + return this._innerApiCalls.getIamPolicy(request, options, callback); + } + setIamPolicy( + request: protosTypes.google.iam.v1.ISetIamPolicyRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + ] + >; + setIamPolicy( + request: protosTypes.google.iam.v1.ISetIamPolicyRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + > + ): void; + /** + * Sets the access control policy for a billing account. Replaces any existing + * policy. + * The caller must have the `billing.accounts.setIamPolicy` permission on the + * account, which is often given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: protosTypes.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.iam.v1.IPolicy, + protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); + return this._innerApiCalls.setIamPolicy(request, options, callback); + } + testIamPermissions( + request: protosTypes.google.iam.v1.ITestIamPermissionsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.iam.v1.ITestIamPermissionsResponse, + protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + ] + >; + testIamPermissions( + request: protosTypes.google.iam.v1.ITestIamPermissionsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.iam.v1.ITestIamPermissionsResponse, + protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + > + ): void; + /** + * Tests the access control policy for a billing account. This method takes + * the resource and a set of permissions as input and returns the subset of + * the input permissions that the caller is allowed for that resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + testIamPermissions( + request: protosTypes.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.iam.v1.ITestIamPermissionsResponse, + protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.iam.v1.ITestIamPermissionsResponse, + protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.iam.v1.ITestIamPermissionsResponse, + protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + resource: request.resource || '', + }); + return this._innerApiCalls.testIamPermissions(request, options, callback); + } + + listBillingAccounts( + request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IBillingAccount[], + protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + ] + >; + listBillingAccounts( + request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount[], + protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + > + ): void; + /** + * Lists the billing accounts that the current authenticated user has + * permission to + * [view](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListBillingAccountsRequest]{@link google.cloud.billing.v1.ListBillingAccountsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListBillingAccountsResponse]{@link google.cloud.billing.v1.ListBillingAccountsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listBillingAccounts( + request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount[], + protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.IBillingAccount[], + protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IBillingAccount[], + protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.listBillingAccounts(request, options, callback); + } + + /** + * Equivalent to {@link listBillingAccounts}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listBillingAccounts} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @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 [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} on 'data' event. + */ + listBillingAccountsStream( + request?: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listBillingAccounts.createStream( + this._innerApiCalls.listBillingAccounts as gax.GaxCall, + request, + callSettings + ); + } + listProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + ] + >; + listProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + > + ): void; + /** + * Lists the projects associated with a billing account. The current + * authenticated user must have the `billing.resourceAssociations.list` IAM + * permission, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProjectBillingInfoRequest]{@link google.cloud.billing.v1.ListProjectBillingInfoRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProjectBillingInfoResponse]{@link google.cloud.billing.v1.ListProjectBillingInfoResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProjectBillingInfo( + request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.listProjectBillingInfo( + request, + options, + callback + ); + } + + /** + * Equivalent to {@link listProjectBillingInfo}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProjectBillingInfo} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} on 'data' event. + */ + listProjectBillingInfoStream( + request?: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProjectBillingInfo.createStream( + this._innerApiCalls.listProjectBillingInfo as gax.GaxCall, + request, + callSettings + ); + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified billingAccount resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountPath(billingAccount: string) { + return this._pathTemplates.billingAccountPathTemplate.render({ + billing_account: billingAccount, + }); + } + + /** + * Parse the billing_account from BillingAccount resource. + * + * @param {string} billingAccountName + * A fully-qualified path representing BillingAccount resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountName(billingAccountName: string) { + return this._pathTemplates.billingAccountPathTemplate.match( + billingAccountName + ).billing_account; + } + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(service: string) { + return this._pathTemplates.servicePathTemplate.render({ + service, + }); + } + + /** + * 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 sku resource name string. + * + * @param {string} service + * @param {string} sku + * @returns {string} Resource name string. + */ + skuPath(service: string, sku: string) { + return this._pathTemplates.skuPathTemplate.render({ + service, + sku, + }); + } + + /** + * Parse the service from Sku resource. + * + * @param {string} skuName + * A fully-qualified path representing Sku resource. + * @returns {string} A string representing the service. + */ + matchServiceFromSkuName(skuName: string) { + return this._pathTemplates.skuPathTemplate.match(skuName).service; + } + + /** + * Parse the sku from Sku resource. + * + * @param {string} skuName + * A fully-qualified path representing Sku resource. + * @returns {string} A string representing the sku. + */ + matchSkuFromSkuName(skuName: string) { + return this._pathTemplates.skuPathTemplate.match(skuName).sku; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.cloudBillingStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client_config.json b/packages/google-cloud-billing/src/v1/cloud_billing_client_config.json new file mode 100644 index 00000000000..e98db6a6e4b --- /dev/null +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client_config.json @@ -0,0 +1,76 @@ +{ + "interfaces": { + "google.cloud.billing.v1.CloudBilling": { + "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": { + "GetBillingAccount": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListBillingAccounts": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateBillingAccount": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateBillingAccount": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProjectBillingInfo": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetProjectBillingInfo": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateProjectBillingInfo": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_proto_list.json b/packages/google-cloud-billing/src/v1/cloud_billing_proto_list.json new file mode 100644 index 00000000000..e34eb066aa5 --- /dev/null +++ b/packages/google-cloud-billing/src/v1/cloud_billing_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/billing/v1/cloud_billing.proto", + "../../protos/google/cloud/billing/v1/cloud_catalog.proto" +] diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts new file mode 100644 index 00000000000..6dc7928f0fa --- /dev/null +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -0,0 +1,653 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + PaginationResponse, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './cloud_catalog_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * A catalog of Google Cloud Platform services and SKUs. + * Provides pricing information and metadata on Google Cloud Platform services + * and SKUs. + * @class + * @memberof v1 + */ +export class CloudCatalogClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + cloudCatalogStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudCatalogClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof CloudCatalogClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof CloudCatalogClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + servicePathTemplate: new gaxModule.PathTemplate('services/{service}'), + skuPathTemplate: new gaxModule.PathTemplate( + 'services/{service}/skus/{sku}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this._descriptors.page = { + listServices: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'services' + ), + listSkus: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'skus' + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.billing.v1.CloudCatalog', + 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 = {}; + + // Put together the "service stub" for + // google.cloud.billing.v1.CloudCatalog. + this.cloudCatalogStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.billing.v1.CloudCatalog' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.billing.v1.CloudCatalog, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const cloudCatalogStubMethods = ['listServices', 'listSkus']; + + for (const methodName of cloudCatalogStubMethods) { + const innerCallPromise = this.cloudCatalogStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'cloudbilling.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'cloudbilling.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + listServices( + request: protosTypes.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IService[], + protosTypes.google.cloud.billing.v1.IListServicesRequest | null, + protosTypes.google.cloud.billing.v1.IListServicesResponse + ] + >; + listServices( + request: protosTypes.google.cloud.billing.v1.IListServicesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.IService[], + protosTypes.google.cloud.billing.v1.IListServicesRequest | null, + protosTypes.google.cloud.billing.v1.IListServicesResponse + > + ): void; + /** + * Lists all public cloud services. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Service]{@link google.cloud.billing.v1.Service}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Service]{@link google.cloud.billing.v1.Service} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListServicesRequest]{@link google.cloud.billing.v1.ListServicesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListServicesResponse]{@link google.cloud.billing.v1.ListServicesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listServices( + request: protosTypes.google.cloud.billing.v1.IListServicesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.IService[], + protosTypes.google.cloud.billing.v1.IListServicesRequest | null, + protosTypes.google.cloud.billing.v1.IListServicesResponse + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.IService[], + protosTypes.google.cloud.billing.v1.IListServicesRequest | null, + protosTypes.google.cloud.billing.v1.IListServicesResponse + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.IService[], + protosTypes.google.cloud.billing.v1.IListServicesRequest | null, + protosTypes.google.cloud.billing.v1.IListServicesResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.listServices(request, options, callback); + } + + /** + * Equivalent to {@link listServices}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listServices} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Service]{@link google.cloud.billing.v1.Service} on 'data' event. + */ + listServicesStream( + request?: protosTypes.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listServices.createStream( + this._innerApiCalls.listServices as gax.GaxCall, + request, + callSettings + ); + } + listSkus( + request: protosTypes.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.billing.v1.ISku[], + protosTypes.google.cloud.billing.v1.IListSkusRequest | null, + protosTypes.google.cloud.billing.v1.IListSkusResponse + ] + >; + listSkus( + request: protosTypes.google.cloud.billing.v1.IListSkusRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.billing.v1.ISku[], + protosTypes.google.cloud.billing.v1.IListSkusRequest | null, + protosTypes.google.cloud.billing.v1.IListSkusResponse + > + ): void; + /** + * Lists all publicly available SKUs for a given cloud service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Sku]{@link google.cloud.billing.v1.Sku}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Sku]{@link google.cloud.billing.v1.Sku} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListSkusRequest]{@link google.cloud.billing.v1.ListSkusRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListSkusResponse]{@link google.cloud.billing.v1.ListSkusResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listSkus( + request: protosTypes.google.cloud.billing.v1.IListSkusRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.billing.v1.ISku[], + protosTypes.google.cloud.billing.v1.IListSkusRequest | null, + protosTypes.google.cloud.billing.v1.IListSkusResponse + >, + callback?: Callback< + protosTypes.google.cloud.billing.v1.ISku[], + protosTypes.google.cloud.billing.v1.IListSkusRequest | null, + protosTypes.google.cloud.billing.v1.IListSkusResponse + > + ): Promise< + [ + protosTypes.google.cloud.billing.v1.ISku[], + protosTypes.google.cloud.billing.v1.IListSkusRequest | null, + protosTypes.google.cloud.billing.v1.IListSkusResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listSkus(request, options, callback); + } + + /** + * Equivalent to {@link listSkus}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listSkus} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Sku]{@link google.cloud.billing.v1.Sku} on 'data' event. + */ + listSkusStream( + request?: protosTypes.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listSkus.createStream( + this._innerApiCalls.listSkus as gax.GaxCall, + request, + callSettings + ); + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified service resource name string. + * + * @param {string} service + * @returns {string} Resource name string. + */ + servicePath(service: string) { + return this._pathTemplates.servicePathTemplate.render({ + service, + }); + } + + /** + * 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 sku resource name string. + * + * @param {string} service + * @param {string} sku + * @returns {string} Resource name string. + */ + skuPath(service: string, sku: string) { + return this._pathTemplates.skuPathTemplate.render({ + service, + sku, + }); + } + + /** + * Parse the service from Sku resource. + * + * @param {string} skuName + * A fully-qualified path representing Sku resource. + * @returns {string} A string representing the service. + */ + matchServiceFromSkuName(skuName: string) { + return this._pathTemplates.skuPathTemplate.match(skuName).service; + } + + /** + * Parse the sku from Sku resource. + * + * @param {string} skuName + * A fully-qualified path representing Sku resource. + * @returns {string} A string representing the sku. + */ + matchSkuFromSkuName(skuName: string) { + return this._pathTemplates.skuPathTemplate.match(skuName).sku; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.cloudCatalogStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client_config.json b/packages/google-cloud-billing/src/v1/cloud_catalog_client_config.json new file mode 100644 index 00000000000..e985baae91b --- /dev/null +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client_config.json @@ -0,0 +1,34 @@ +{ + "interfaces": { + "google.cloud.billing.v1.CloudCatalog": { + "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": { + "ListServices": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSkus": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_proto_list.json b/packages/google-cloud-billing/src/v1/cloud_catalog_proto_list.json new file mode 100644 index 00000000000..e34eb066aa5 --- /dev/null +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/billing/v1/cloud_billing.proto", + "../../protos/google/cloud/billing/v1/cloud_catalog.proto" +] diff --git a/packages/google-cloud-billing/src/v1/index.ts b/packages/google-cloud-billing/src/v1/index.ts new file mode 100644 index 00000000000..0436765de76 --- /dev/null +++ b/packages/google-cloud-billing/src/v1/index.ts @@ -0,0 +1,20 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CloudBillingClient} from './cloud_billing_client'; +export {CloudCatalogClient} from './cloud_catalog_client'; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata new file mode 100644 index 00000000000..174b057165a --- /dev/null +++ b/packages/google-cloud-billing/synth.metadata @@ -0,0 +1,31 @@ +{ + "updateTime": "2020-02-27T22:25:59.292521Z", + "sources": [ + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "e9e90a787703ec5d388902e2cb796aaed3a385b4", + "internalRef": "297671458" + } + }, + { + "template": { + "name": "node_library", + "origin": "synthtool.gcp", + "version": "2020.2.4" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "billing", + "apiVersion": "v1", + "language": "typescript", + "generator": "gapic-generator-typescript" + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..989eff52d20 --- /dev/null +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js @@ -0,0 +1,28 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const billing = require('@google-cloud/billing'); + +function main() { + const cloudBillingClient = new billing.CloudBillingClient(); + const cloudCatalogClient = new billing.CloudCatalogClient(); +} + +main(); diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..7af92f4e405 --- /dev/null +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,26 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {CloudBillingClient, CloudCatalogClient} from '@google-cloud/billing'; + +function main() { + const cloudBillingClient = new CloudBillingClient(); + const cloudCatalogClient = new CloudCatalogClient(); +} + +main(); diff --git a/packages/google-cloud-billing/system-test/install.ts b/packages/google-cloud-billing/system-test/install.ts new file mode 100644 index 00000000000..c9aa74ec221 --- /dev/null +++ b/packages/google-cloud-billing/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('typescript consumer tests', () => { + it('should have correct type signature for typescript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, + }; + await packNTest(options); // will throw upon error. + }); + + it('should have correct type signature for javascript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, + }; + await packNTest(options); // will throw upon error. + }); +}); diff --git a/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts b/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts new file mode 100644 index 00000000000..c8c20a8ca13 --- /dev/null +++ b/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts @@ -0,0 +1,585 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const cloudbillingModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +describe('v1.CloudBillingClient', () => { + it('has servicePath', () => { + const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = cloudbillingModule.v1.CloudBillingClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new cloudbillingModule.v1.CloudBillingClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + fallback: true, + }); + assert(client); + }); + describe('getBillingAccount', () => { + it('invokes getBillingAccount without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getBillingAccount = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getBillingAccount(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getBillingAccount with error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getBillingAccount = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getBillingAccount(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateBillingAccount', () => { + it('invokes updateBillingAccount without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateBillingAccount = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateBillingAccount(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateBillingAccount with error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateBillingAccount = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateBillingAccount(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('createBillingAccount', () => { + it('invokes createBillingAccount without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createBillingAccount = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createBillingAccount(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createBillingAccount with error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createBillingAccount = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createBillingAccount(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getProjectBillingInfo', () => { + it('invokes getProjectBillingInfo without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProjectBillingInfo = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getProjectBillingInfo(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getProjectBillingInfo with error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProjectBillingInfo = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getProjectBillingInfo(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateProjectBillingInfo', () => { + it('invokes updateProjectBillingInfo without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProjectBillingInfo = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateProjectBillingInfo(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateProjectBillingInfo with error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProjectBillingInfo = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateProjectBillingInfo( + request, + (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + } + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; + request.resource = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getIamPolicy = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getIamPolicy(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getIamPolicy with error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; + request.resource = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getIamPolicy = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getIamPolicy(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; + request.resource = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.setIamPolicy = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.setIamPolicy(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes setIamPolicy with error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; + request.resource = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.setIamPolicy = mockSimpleGrpcMethod( + request, + null, + error + ); + client.setIamPolicy(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; + request.resource = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.testIamPermissions = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.testIamPermissions(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes testIamPermissions with error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; + request.resource = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.testIamPermissions = mockSimpleGrpcMethod( + request, + null, + error + ); + client.testIamPermissions(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('listBillingAccounts', () => { + it('invokes listBillingAccounts without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listBillingAccounts = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listBillingAccounts(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listBillingAccountsStream', () => { + it('invokes listBillingAccountsStream without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest = {}; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listBillingAccounts = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listBillingAccountsStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listProjectBillingInfo', () => { + it('invokes listProjectBillingInfo without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProjectBillingInfo = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProjectBillingInfo(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listProjectBillingInfoStream', () => { + it('invokes listProjectBillingInfoStream without error', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProjectBillingInfo = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProjectBillingInfoStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); +}); diff --git a/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts b/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts new file mode 100644 index 00000000000..c95157e95b3 --- /dev/null +++ b/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts @@ -0,0 +1,184 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const cloudcatalogModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +describe('v1.CloudCatalogClient', () => { + it('has servicePath', () => { + const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = cloudcatalogModule.v1.CloudCatalogClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + fallback: true, + }); + assert(client); + }); + describe('listServices', () => { + it('invokes listServices without error', done => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IListServicesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listServices = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listServices(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listServicesStream', () => { + it('invokes listServicesStream without error', done => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IListServicesRequest = {}; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listServices = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listServicesStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listSkus', () => { + it('invokes listSkus without error', done => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IListSkusRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listSkus = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listSkus(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listSkusStream', () => { + it('invokes listSkusStream without error', done => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.billing.v1.IListSkusRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listSkus = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listSkusStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); +}); diff --git a/packages/google-cloud-billing/tsconfig.json b/packages/google-cloud-billing/tsconfig.json new file mode 100644 index 00000000000..613d35597b5 --- /dev/null +++ b/packages/google-cloud-billing/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2016", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/packages/google-cloud-billing/tslint.json b/packages/google-cloud-billing/tslint.json new file mode 100644 index 00000000000..617dc975bae --- /dev/null +++ b/packages/google-cloud-billing/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "gts/tslint.json" +} diff --git a/packages/google-cloud-billing/webpack.config.js b/packages/google-cloud-billing/webpack.config.js new file mode 100644 index 00000000000..697bb874b79 --- /dev/null +++ b/packages/google-cloud-billing/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'CloudBilling', + filename: './cloud-billing.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 71ff9afe8856e8a10d963261dfda37c0c38095d4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2020 23:58:51 +0000 Subject: [PATCH 003/169] chore: release 1.0.0 (#4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit :robot: I have created a release \*beep\* \*boop\* --- ## 1.0.0 (2020-02-27) ### ⚠ BREAKING CHANGES * initial library generation (#1) ### Features * initial library generation ([#1](https://www.github.com/googleapis/nodejs-billing/issues/1)) ([5a04fa9](https://www.github.com/googleapis/nodejs-billing/commit/5a04fa957a8a83325744c5a275f742bf3abd4579)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- packages/google-cloud-billing/CHANGELOG.md | 12 ++++++++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-billing/CHANGELOG.md diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md new file mode 100644 index 00000000000..b0f37b4733f --- /dev/null +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +## 1.0.0 (2020-02-27) + + +### ⚠ BREAKING CHANGES + +* initial library generation (#1) + +### Features + +* initial library generation ([#1](https://www.github.com/googleapis/nodejs-billing/issues/1)) ([5a04fa9](https://www.github.com/googleapis/nodejs-billing/commit/5a04fa957a8a83325744c5a275f742bf3abd4579)) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index ec7b2b74246..dcbfa5986a8 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "0.1.0", + "version": "1.0.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 433d3bd1cf5..6c8d7c65905 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^0.1.0" + "@google-cloud/billing": "^1.0.0" }, "devDependencies": { "c8": "^7.1.0", From 2bb720854c647f67b854abbcf96dc35c42e89dc9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 28 Feb 2020 20:48:05 +0100 Subject: [PATCH 004/169] chore(deps): update dependency mocha to v7 (#7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^6.0.0` -> `^7.0.0`](https://renovatebot.com/diffs/npm/mocha/6.2.2/7.1.0) | | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^5.2.5` -> `^7.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/5.2.7/7.0.1) | --- ### Release Notes
mochajs/mocha ### [`v7.1.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​710--2020-02-26) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.0.1...v7.1.0) #### :tada: Enhancements [#​4038](https://togithub.com/mochajs/mocha/issues/4038): Add Node.js native ESM support ([**@​giltayar**](https://togithub.com/giltayar)) Mocha supports writing your test files as ES modules: - Node.js only v12.11.0 and above - Node.js below v13.2.0, you must set `--experimental-modules` option - current limitations: please check our [documentation](https://mochajs.org/#nodejs-native-esm-support) - for programmatic usage: see [API: loadFilesAsync()](https://mochajs.org/api/mocha#loadFilesAsync) **Note:** Node.JS native [ECMAScript Modules](https://nodejs.org/api/esm.html) implementation has status: **Stability: 1 - Experimental** #### :bug: Fixes - [#​4181](https://togithub.com/mochajs/mocha/issues/4181): Programmatic API cannot access retried test objects ([**@​juergba**](https://togithub.com/juergba)) - [#​4174](https://togithub.com/mochajs/mocha/issues/4174): Browser: fix `allowUncaught` option ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4058](https://togithub.com/mochajs/mocha/issues/4058): Manage author list in AUTHORS instead of `package.json` ([**@​outsideris**](https://togithub.com/outsideris)) #### :nut_and_bolt: Other - [#​4138](https://togithub.com/mochajs/mocha/issues/4138): Upgrade ESLint v6.8 ([**@​kaicataldo**](https://togithub.com/kaicataldo)) ### [`v7.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​701--2020-01-25) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.0.0...v7.0.1) #### :bug: Fixes - [#​4165](https://togithub.com/mochajs/mocha/issues/4165): Fix exception when skipping tests programmatically ([**@​juergba**](https://togithub.com/juergba)) - [#​4153](https://togithub.com/mochajs/mocha/issues/4153): Restore backwards compatibility for `reporterOptions` ([**@​holm**](https://togithub.com/holm)) - [#​4150](https://togithub.com/mochajs/mocha/issues/4150): Fix recovery of an open test upon uncaught exception ([**@​juergba**](https://togithub.com/juergba)) - [#​4147](https://togithub.com/mochajs/mocha/issues/4147): Fix regression of leaking uncaught exception handler ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4146](https://togithub.com/mochajs/mocha/issues/4146): Update copyright & trademark notices per OJSF ([**@​boneskull**](https://togithub.com/boneskull)) - [#​4140](https://togithub.com/mochajs/mocha/issues/4140): Fix broken links ([**@​KyoungWan**](https://togithub.com/KyoungWan)) #### :nut_and_bolt: Other - [#​4133](https://togithub.com/mochajs/mocha/issues/4133): Print more descriptive error message ([**@​Zirak**](https://togithub.com/Zirak)) ### [`v7.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​700--2020-01-05) [Compare Source](https://togithub.com/mochajs/mocha/compare/v6.2.2...v7.0.0) #### :boom: Breaking Changes - [#​3885](https://togithub.com/mochajs/mocha/issues/3885): **Drop Node.js v6.x support** ([**@​mojosoeun**](https://togithub.com/mojosoeun)) - [#​3890](https://togithub.com/mochajs/mocha/issues/3890): Remove Node.js debug-related flags `--debug`/`--debug-brk` and deprecate `debug` argument ([**@​juergba**](https://togithub.com/juergba)) - [#​3962](https://togithub.com/mochajs/mocha/issues/3962): Changes to command-line options ([**@​ParkSB**](https://togithub.com/ParkSB)): - `--list-interfaces` replaces `--interfaces` - `--list-reporters` replaces `--reporters` - Hook pattern of `this.skip()` ([**@​juergba**](https://togithub.com/juergba)): - [#​3859](https://togithub.com/mochajs/mocha/issues/3859): When conditionally skipping in a `it` test, related `afterEach` hooks are now executed - [#​3741](https://togithub.com/mochajs/mocha/issues/3741): When conditionally skipping in a `beforeEach` hook, subsequent inner `beforeEach` hooks are now skipped and related `afterEach` hooks are executed - [#​4136](https://togithub.com/mochajs/mocha/issues/4136): Disallow `this.skip()` within `after` hooks - [#​3967](https://togithub.com/mochajs/mocha/issues/3967): Remove deprecated `getOptions()` and `lib/cli/options.js` ([**@​juergba**](https://togithub.com/juergba)) - [#​4083](https://togithub.com/mochajs/mocha/issues/4083): Uncaught exception in `pending` test: don't swallow, but retrospectively fail the test for correct exit code ([**@​juergba**](https://togithub.com/juergba)) - [#​4004](https://togithub.com/mochajs/mocha/issues/4004): Align `Mocha` constructor's option names with command-line options ([**@​juergba**](https://togithub.com/juergba)) #### :tada: Enhancements - [#​3980](https://togithub.com/mochajs/mocha/issues/3980): Refactor and improve `--watch` mode with chokidar ([**@​geigerzaehler**](https://togithub.com/geigerzaehler)): - adds command-line options `--watch-files` and `--watch-ignore` - removes `--watch-extensions` - [#​3979](https://togithub.com/mochajs/mocha/issues/3979): Type "rs\\n" to restart tests ([**@​broofa**](https://togithub.com/broofa)) #### :fax: Deprecations These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha: - [#​3968](https://togithub.com/mochajs/mocha/issues/3968): Deprecate legacy configuration via `mocha.opts` ([**@​juergba**](https://togithub.com/juergba)) #### :bug: Fixes - [#​4125](https://togithub.com/mochajs/mocha/issues/4125): Fix timeout handling with `--inspect-brk`/`--inspect` ([**@​juergba**](https://togithub.com/juergba)) - [#​4070](https://togithub.com/mochajs/mocha/issues/4070): `Mocha` constructor: improve browser setup ([**@​juergba**](https://togithub.com/juergba)) - [#​4068](https://togithub.com/mochajs/mocha/issues/4068): XUnit reporter should handle exceptions during diff generation ([**@​rgroothuijsen**](https://togithub.com/rgroothuijsen)) - [#​4030](https://togithub.com/mochajs/mocha/issues/4030): Fix `--allow-uncaught` with `this.skip()` ([**@​juergba**](https://togithub.com/juergba)) #### :mag: Coverage - [#​4109](https://togithub.com/mochajs/mocha/issues/4109): Add Node.js v13.x to CI test matrix ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4129](https://togithub.com/mochajs/mocha/issues/4129): Fix broken links ([**@​SaeromB**](https://togithub.com/SaeromB)) - [#​4127](https://togithub.com/mochajs/mocha/issues/4127): Add reporter alias names to docs ([**@​khg0712**](https://togithub.com/khg0712)) - [#​4101](https://togithub.com/mochajs/mocha/issues/4101): Clarify invalid usage of `done()` ([**@​jgehrcke**](https://togithub.com/jgehrcke)) - [#​4092](https://togithub.com/mochajs/mocha/issues/4092): Replace `:coffee:` with emoji ☕️ ([**@​pzrq**](https://togithub.com/pzrq)) - [#​4088](https://togithub.com/mochajs/mocha/issues/4088): Initial draft of project charter ([**@​boneskull**](https://togithub.com/boneskull)) - [#​4066](https://togithub.com/mochajs/mocha/issues/4066): Change `sh` to `bash` for code block in docs/index.md ([**@​HyunSangHan**](https://togithub.com/HyunSangHan)) - [#​4045](https://togithub.com/mochajs/mocha/issues/4045): Update README.md concerning GraphicsMagick installation ([**@​HyunSangHan**](https://togithub.com/HyunSangHan)) - [#​3988](https://togithub.com/mochajs/mocha/issues/3988): Fix sponsors background color for readability ([**@​outsideris**](https://togithub.com/outsideris)) #### :nut_and_bolt: Other - [#​4118](https://togithub.com/mochajs/mocha/issues/4118): Update node-environment-flags to 1.0.6 ([**@​kylef**](https://togithub.com/kylef)) - [#​4097](https://togithub.com/mochajs/mocha/issues/4097): Add GH Funding Metadata ([**@​SheetJSDev**](https://togithub.com/SheetJSDev)) - [#​4089](https://togithub.com/mochajs/mocha/issues/4089): Add funding information to `package.json` ([**@​Munter**](https://togithub.com/Munter)) - [#​4077](https://togithub.com/mochajs/mocha/issues/4077): Improve integration tests ([**@​soobing**](https://togithub.com/soobing))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index dcbfa5986a8..5299a08d5ec 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -29,7 +29,7 @@ "google-gax": "^1.12.0" }, "devDependencies": { - "@types/mocha": "^5.2.5", + "@types/mocha": "^7.0.0", "@types/node": "^12.0.0", "c8": "^6.0.0", "gts": "^1.0.0", @@ -37,7 +37,7 @@ "jsdoc-fresh": "^1.0.1", "jsdoc-region-tag": "^1.0.2", "linkinator": "^1.5.0", - "mocha": "^6.0.0", + "mocha": "^7.0.0", "pack-n-play": "^1.0.0-2", "null-loader": "^3.0.0", "ts-loader": "^6.2.1", From 15516f0fcb282a2a6c07948fe07afb0d4203639a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 28 Feb 2020 20:54:04 +0100 Subject: [PATCH 005/169] chore(deps): update dependency c8 to v7 (#5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [c8](https://togithub.com/bcoe/c8) | devDependencies | major | [`^6.0.0` -> `^7.0.0`](https://renovatebot.com/diffs/npm/c8/6.0.1/7.1.0) | --- ### Release Notes
bcoe/c8 ### [`v7.1.0`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​710httpswwwgithubcombcoec8comparev701v710-2020-02-09) [Compare Source](https://togithub.com/bcoe/c8/compare/v7.0.1...v7.1.0) ##### Features - adds TypeScript definitions ([d39801b](https://www.github.com/bcoe/c8/commit/d39801bc9b2713aa56592010e6394a295bd12b0b)), closes [#​195](https://www.github.com/bcoe/c8/issues/195) ##### Bug Fixes - **deps:** update dependency furi to v2 ([#​193](https://www.github.com/bcoe/c8/issues/193)) ([6b9af6e](https://www.github.com/bcoe/c8/commit/6b9af6ee8cbbacd85eea91dc49bb269fe3651c12)) - **deps:** v8-to-istanbul with patch for crasher ([#​200](https://www.github.com/bcoe/c8/issues/200)) ([d4b7d80](https://www.github.com/bcoe/c8/commit/d4b7d80d78f3d1cb2e9a2e9e106af0cef327b446)) ##### [7.0.1](https://www.github.com/bcoe/c8/compare/v7.0.0...v7.0.1) (2020-01-13) ##### Bug Fixes - all flag not propagated to check-coverage command ([#​188](https://www.github.com/bcoe/c8/issues/188)) ([86eaf72](https://www.github.com/bcoe/c8/commit/86eaf72a8c7af93d6ec9699b741d11df50017a8d)) ### [`v7.0.1`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​710httpswwwgithubcombcoec8comparev701v710-2020-02-09) [Compare Source](https://togithub.com/bcoe/c8/compare/v7.0.0...v7.0.1) ##### Features - adds TypeScript definitions ([d39801b](https://www.github.com/bcoe/c8/commit/d39801bc9b2713aa56592010e6394a295bd12b0b)), closes [#​195](https://www.github.com/bcoe/c8/issues/195) ##### Bug Fixes - **deps:** update dependency furi to v2 ([#​193](https://www.github.com/bcoe/c8/issues/193)) ([6b9af6e](https://www.github.com/bcoe/c8/commit/6b9af6ee8cbbacd85eea91dc49bb269fe3651c12)) - **deps:** v8-to-istanbul with patch for crasher ([#​200](https://www.github.com/bcoe/c8/issues/200)) ([d4b7d80](https://www.github.com/bcoe/c8/commit/d4b7d80d78f3d1cb2e9a2e9e106af0cef327b446)) ##### [7.0.1](https://www.github.com/bcoe/c8/compare/v7.0.0...v7.0.1) (2020-01-13) ##### Bug Fixes - all flag not propagated to check-coverage command ([#​188](https://www.github.com/bcoe/c8/issues/188)) ([86eaf72](https://www.github.com/bcoe/c8/commit/86eaf72a8c7af93d6ec9699b741d11df50017a8d)) ### [`v7.0.0`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​700httpswwwgithubcombcoec8comparev601v700-2019-12-22) [Compare Source](https://togithub.com/bcoe/c8/compare/v6.0.1...v7.0.0) ##### ⚠ BREAKING CHANGES - new test-exclude with modified exclude rules ([#​179](https://togithub.com/bcoe/c8/issues/179)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://togithub.com/bcoe/c8/issues/168)) ##### Features - adds --all functionality ([#​158](https://www.github.com/bcoe/c8/issues/158)) ([2eb631e](https://www.github.com/bcoe/c8/commit/2eb631e460eba3d06925ee1d128e0db82ec50b6c)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://www.github.com/bcoe/c8/issues/168)) ([35d9338](https://www.github.com/bcoe/c8/commit/35d9338b69ba803c19a19d16ff601e3ec5692fa6)) - new test-exclude with modified exclude rules ([#​179](https://www.github.com/bcoe/c8/issues/179)) ([af7d94d](https://www.github.com/bcoe/c8/commit/af7d94d715ab98d67e6b5bff5dfba19430681c9c)) ##### Bug Fixes - **deps:** update dependency v8-to-istanbul to v4 ([#​167](https://www.github.com/bcoe/c8/issues/167)) ([97b9769](https://www.github.com/bcoe/c8/commit/97b97699870ddc4af780cedb25cbb3a87e0eb777)) - **deps:** update dependency yargs to v15 ([#​164](https://www.github.com/bcoe/c8/issues/164)) ([e41a483](https://www.github.com/bcoe/c8/commit/e41a4831aac92591f303d48038a327e9631affee)) - **deps:** update dependency yargs-parser to v16 ([#​157](https://www.github.com/bcoe/c8/issues/157)) ([15746e5](https://www.github.com/bcoe/c8/commit/15746e51640e6e172f27f02c12056e2977342005)) ##### [6.0.1](https://togithub.com/bcoe/c8/compare/v6.0.0...v6.0.1) (2019-10-26) ##### Bug Fixes - regex flags in dependency were breaking Node 8 ([a9d9645](https://togithub.com/bcoe/c8/commit/a9d9645858031cee985087828f5e04cfd8922868))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 5299a08d5ec..f56914ac349 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -31,7 +31,7 @@ "devDependencies": { "@types/mocha": "^7.0.0", "@types/node": "^12.0.0", - "c8": "^6.0.0", + "c8": "^7.0.0", "gts": "^1.0.0", "jsdoc": "^3.5.5", "jsdoc-fresh": "^1.0.1", From a1d21ebf649cd933ef2c4358ab40444ba9eb6771 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 28 Feb 2020 21:00:05 +0100 Subject: [PATCH 006/169] chore(deps): update dependency linkinator to v2 (#6) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [linkinator](https://togithub.com/JustinBeckwith/linkinator) | devDependencies | major | [`^1.5.0` -> `^2.0.0`](https://renovatebot.com/diffs/npm/linkinator/1.8.2/2.0.2) | --- ### Release Notes
JustinBeckwith/linkinator ### [`v2.0.2`](https://togithub.com/JustinBeckwith/linkinator/releases/v2.0.2) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v2.0.1...v2.0.2) ##### Bug Fixes - **perf:** reduce total memory consumption ([#​153](https://togithub.com/JustinBeckwith/linkinator/issues/153)) ([aa139da](https://togithub.com/JustinBeckwith/linkinator/commit/aa139dae442f6353f14c9d233ded18609e8addbe)) ### [`v2.0.1`](https://togithub.com/JustinBeckwith/linkinator/releases/v2.0.1) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v2.0.0...v2.0.1) ##### Bug Fixes - ignore prefetch and connect for link ([#​145](https://togithub.com/JustinBeckwith/linkinator/issues/145)) ([154eb2b](https://togithub.com/JustinBeckwith/linkinator/commit/154eb2b6c3ac8dab8f55e7d05566ad7aff1e5d9a)) ### [`v2.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/v2.0.0) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v1.8.2...v2.0.0) - build!: drop support for node.js 8.x ([#​142](https://togithub.com/JustinBeckwith/linkinator/issues/142)) ([85642bd](https://togithub.com/JustinBeckwith/linkinator/commit/85642bdb1ccead89dc6d25f7891054f28e6ce609)), closes [#​142](https://togithub.com/JustinBeckwith/linkinator/issues/142) ##### BREAKING CHANGES - This module now requires Node.js 10.x or greater. Please upgrade to a LTS release of node.js.
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index f56914ac349..f3833771aa8 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -36,7 +36,7 @@ "jsdoc": "^3.5.5", "jsdoc-fresh": "^1.0.1", "jsdoc-region-tag": "^1.0.2", - "linkinator": "^1.5.0", + "linkinator": "^2.0.0", "mocha": "^7.0.0", "pack-n-play": "^1.0.0-2", "null-loader": "^3.0.0", From 83e649d7d6e313e3ee418c9ecd12d906a922fc4a Mon Sep 17 00:00:00 2001 From: Summer Ji Date: Fri, 28 Feb 2020 16:36:21 -0800 Subject: [PATCH 007/169] chore: update jsdoc with macro license (#9) --- packages/google-cloud-billing/.jsdoc.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/google-cloud-billing/.jsdoc.js b/packages/google-cloud-billing/.jsdoc.js index c6ecbdc9263..a590fe325cf 100644 --- a/packages/google-cloud-billing/.jsdoc.js +++ b/packages/google-cloud-billing/.jsdoc.js @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** 'use strict'; From 3dbe6cdb0033418c165166ec3deafad0289bbb71 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 29 Feb 2020 10:26:29 -0800 Subject: [PATCH 008/169] feat: export protos from src/index.ts; update jsdoc config --- packages/google-cloud-billing/.jsdoc.js | 10 +++++++--- packages/google-cloud-billing/linkinator.config.json | 6 +----- packages/google-cloud-billing/src/index.ts | 2 ++ packages/google-cloud-billing/synth.metadata | 7 ++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/google-cloud-billing/.jsdoc.js b/packages/google-cloud-billing/.jsdoc.js index a590fe325cf..81518d292e6 100644 --- a/packages/google-cloud-billing/.jsdoc.js +++ b/packages/google-cloud-billing/.jsdoc.js @@ -34,16 +34,20 @@ module.exports = { source: { excludePattern: '(^|\\/|\\\\)[._]', include: [ - 'build/src' + 'build/src', + 'protos' ], includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2018 Google, LLC.', + copyright: 'Copyright 2019 Google, LLC.', includeDate: false, sourceFiles: false, systemName: '@google-cloud/billing', - theme: 'lumen' + theme: 'lumen', + default: { + outputSourceFiles: false + } }, markdown: { idInHeadings: true diff --git a/packages/google-cloud-billing/linkinator.config.json b/packages/google-cloud-billing/linkinator.config.json index acbeb589800..b555215ca02 100644 --- a/packages/google-cloud-billing/linkinator.config.json +++ b/packages/google-cloud-billing/linkinator.config.json @@ -3,10 +3,6 @@ "skip": [ "https://codecov.io/gh/googleapis/", "www.googleapis.com", - "img.shields.io", - "https://googleapis.dev/nodejs/billing/latest/.*", - "https://www.npmjs.org/package/@google-cloud/billing", - "https://github.com/googleapis/nodejs-billing/tree/master/samples", - "https://github.com/googleapis/nodejs-billing/blob/master/samples/quickstart.js" + "img.shields.io" ] } diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index e53a7318d1c..3ca552e9d89 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -23,3 +23,5 @@ export {v1, CloudBillingClient, CloudCatalogClient}; // For compatibility with JavaScript libraries we need to provide this default export: // tslint:disable-next-line no-default-export export default {v1, CloudBillingClient, CloudCatalogClient}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 174b057165a..e0684a1f0f4 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,12 +1,13 @@ { - "updateTime": "2020-02-27T22:25:59.292521Z", + "updateTime": "2020-02-29T12:16:38.714183Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "e9e90a787703ec5d388902e2cb796aaed3a385b4", - "internalRef": "297671458" + "sha": "83c6f84035ee0f80eaa44d8b688a010461cc4080", + "internalRef": "297918498", + "log": "83c6f84035ee0f80eaa44d8b688a010461cc4080\nUpdate google/api/auth.proto to make AuthProvider to have JwtLocation\n\nPiperOrigin-RevId: 297918498\n\n" } }, { From 1f1f97a53a0d1d330b9021248fb4baa1821b8276 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 14:47:39 -0800 Subject: [PATCH 009/169] chore: release 1.1.0 (#11) --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index b0f37b4733f..2d240a5ffa7 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.1.0](https://www.github.com/googleapis/nodejs-billing/compare/v1.0.0...v1.1.0) (2020-02-29) + + +### Features + +* export protos from src/index.ts; update jsdoc config ([ea41ed3](https://www.github.com/googleapis/nodejs-billing/commit/ea41ed3bdb792c8a3de3c168ebf18904127c9edc)) + ## 1.0.0 (2020-02-27) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index f3833771aa8..d16b5c0c083 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "1.0.0", + "version": "1.1.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 6c8d7c65905..761f7f9e0af 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^1.0.0" + "@google-cloud/billing": "^1.1.0" }, "devDependencies": { "c8": "^7.1.0", From edf9643a2603de32d6ffaf1e2e74d775f85a2054 Mon Sep 17 00:00:00 2001 From: "gcf-merge-on-green[bot]" <60162190+gcf-merge-on-green[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2020 00:14:11 +0000 Subject: [PATCH 010/169] feat: deferred client initialization (#12) This PR includes changes from https://github.com/googleapis/gapic-generator-typescript/pull/317 that will move the asynchronous initialization and authentication from the client constructor to an `initialize()` method. This method will be automatically called when the first RPC call is performed. The client library usage has not changed, there is no need to update any code. If you want to make sure the client is authenticated _before_ the first RPC call, you can do ```js await client.initialize(); ``` manually before calling any client method. --- .../src/v1/cloud_billing_client.ts | 89 ++++++++++++++----- .../src/v1/cloud_catalog_client.ts | 79 +++++++++++----- packages/google-cloud-billing/synth.metadata | 8 +- .../test/gapic-cloud_billing-v1.ts | 56 ++++++++++++ .../test/gapic-cloud_catalog-v1.ts | 24 +++++ 5 files changed, 205 insertions(+), 51 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 876ab6a08dd..04d2342e8e3 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -44,8 +44,13 @@ export class CloudBillingClient { private _innerApiCalls: {[name: string]: Function}; private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - cloudBillingStub: Promise<{[name: string]: Function}>; + cloudBillingStub?: Promise<{[name: string]: Function}>; /** * Construct an instance of CloudBillingClient. @@ -69,8 +74,6 @@ export class CloudBillingClient { * app is running in an environment which supports * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. */ @@ -100,25 +103,28 @@ export class CloudBillingClient { // If we are in browser, we are already using fallback because of the // "browser" field in package.json. // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. opts.scopes = (this.constructor as typeof CloudBillingClient).scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); + 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 = gaxGrpc.auth as gax.GoogleAuth; + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Determine the client header string. - const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { - clientHeader.push(`gl-web/${gaxModule.version}`); + clientHeader.push(`gl-web/${this._gaxModule.version}`); } if (!opts.fallback) { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); @@ -134,7 +140,7 @@ export class CloudBillingClient { 'protos', 'protos.json' ); - const protos = gaxGrpc.loadProto( + this._protos = this._gaxGrpc.loadProto( opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); @@ -142,11 +148,13 @@ export class CloudBillingClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - billingAccountPathTemplate: new gaxModule.PathTemplate( + billingAccountPathTemplate: new this._gaxModule.PathTemplate( 'billingAccounts/{billing_account}' ), - servicePathTemplate: new gaxModule.PathTemplate('services/{service}'), - skuPathTemplate: new gaxModule.PathTemplate( + servicePathTemplate: new this._gaxModule.PathTemplate( + 'services/{service}' + ), + skuPathTemplate: new this._gaxModule.PathTemplate( 'services/{service}/skus/{sku}' ), }; @@ -155,12 +163,12 @@ export class CloudBillingClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - listBillingAccounts: new gaxModule.PageDescriptor( + listBillingAccounts: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'billingAccounts' ), - listProjectBillingInfo: new gaxModule.PageDescriptor( + listProjectBillingInfo: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'projectBillingInfo' @@ -168,7 +176,7 @@ export class CloudBillingClient { }; // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( + this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.billing.v1.CloudBilling', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, @@ -179,17 +187,35 @@ export class CloudBillingClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this._innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.cloudBillingStub) { + return this.cloudBillingStub; + } // Put together the "service stub" for // google.cloud.billing.v1.CloudBilling. - this.cloudBillingStub = gaxGrpc.createStub( - opts.fallback - ? (protos as protobuf.Root).lookupService( + this.cloudBillingStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( 'google.cloud.billing.v1.CloudBilling' ) : // tslint:disable-next-line no-any - (protos as any).google.cloud.billing.v1.CloudBilling, - opts + (this._protos as any).google.cloud.billing.v1.CloudBilling, + this._opts ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -220,9 +246,9 @@ export class CloudBillingClient { } ); - const apiCall = gaxModule.createApiCall( + const apiCall = this._gaxModule.createApiCall( innerCallPromise, - defaults[methodName], + this._defaults[methodName], this._descriptors.page[methodName] || this._descriptors.stream[methodName] || this._descriptors.longrunning[methodName] @@ -236,6 +262,8 @@ export class CloudBillingClient { return apiCall(argument, callOptions, callback); }; } + + return this.cloudBillingStub; } /** @@ -361,6 +389,7 @@ export class CloudBillingClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getBillingAccount(request, options, callback); } updateBillingAccount( @@ -451,6 +480,7 @@ export class CloudBillingClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.updateBillingAccount(request, options, callback); } createBillingAccount( @@ -536,6 +566,7 @@ export class CloudBillingClient { options = optionsOrCallback as gax.CallOptions; } options = options || {}; + this.initialize(); return this._innerApiCalls.createBillingAccount(request, options, callback); } getProjectBillingInfo( @@ -620,6 +651,7 @@ export class CloudBillingClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.getProjectBillingInfo( request, options, @@ -738,6 +770,7 @@ export class CloudBillingClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.updateProjectBillingInfo( request, options, @@ -814,6 +847,7 @@ export class CloudBillingClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.getIamPolicy(request, options, callback); } setIamPolicy( @@ -887,6 +921,7 @@ export class CloudBillingClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.setIamPolicy(request, options, callback); } testIamPermissions( @@ -958,6 +993,7 @@ export class CloudBillingClient { ] = gax.routingHeader.fromParams({ resource: request.resource || '', }); + this.initialize(); return this._innerApiCalls.testIamPermissions(request, options, callback); } @@ -1049,6 +1085,7 @@ export class CloudBillingClient { options = optionsOrCallback as gax.CallOptions; } options = options || {}; + this.initialize(); return this._innerApiCalls.listBillingAccounts(request, options, callback); } @@ -1093,6 +1130,7 @@ export class CloudBillingClient { request = request || {}; options = options || {}; const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listBillingAccounts.createStream( this._innerApiCalls.listBillingAccounts as gax.GaxCall, request, @@ -1191,6 +1229,7 @@ export class CloudBillingClient { ] = gax.routingHeader.fromParams({ name: request.name || '', }); + this.initialize(); return this._innerApiCalls.listProjectBillingInfo( request, options, @@ -1242,6 +1281,7 @@ export class CloudBillingClient { name: request.name || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listProjectBillingInfo.createStream( this._innerApiCalls.listProjectBillingInfo as gax.GaxCall, request, @@ -1342,8 +1382,9 @@ export class CloudBillingClient { * The client will no longer be usable and all future behavior is undefined. */ close(): Promise { + this.initialize(); if (!this._terminated) { - return this.cloudBillingStub.then(stub => { + return this.cloudBillingStub!.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 6dc7928f0fa..615575b8f35 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -46,8 +46,13 @@ export class CloudCatalogClient { private _innerApiCalls: {[name: string]: Function}; private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - cloudCatalogStub: Promise<{[name: string]: Function}>; + cloudCatalogStub?: Promise<{[name: string]: Function}>; /** * Construct an instance of CloudCatalogClient. @@ -71,8 +76,6 @@ export class CloudCatalogClient { * app is running in an environment which supports * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. */ @@ -102,25 +105,28 @@ export class CloudCatalogClient { // If we are in browser, we are already using fallback because of the // "browser" field in package.json. // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. opts.scopes = (this.constructor as typeof CloudCatalogClient).scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); + 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 = gaxGrpc.auth as gax.GoogleAuth; + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Determine the client header string. - const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { - clientHeader.push(`gl-web/${gaxModule.version}`); + clientHeader.push(`gl-web/${this._gaxModule.version}`); } if (!opts.fallback) { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); @@ -136,7 +142,7 @@ export class CloudCatalogClient { 'protos', 'protos.json' ); - const protos = gaxGrpc.loadProto( + this._protos = this._gaxGrpc.loadProto( opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath ); @@ -144,8 +150,10 @@ export class CloudCatalogClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this._pathTemplates = { - servicePathTemplate: new gaxModule.PathTemplate('services/{service}'), - skuPathTemplate: new gaxModule.PathTemplate( + servicePathTemplate: new this._gaxModule.PathTemplate( + 'services/{service}' + ), + skuPathTemplate: new this._gaxModule.PathTemplate( 'services/{service}/skus/{sku}' ), }; @@ -154,12 +162,12 @@ export class CloudCatalogClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this._descriptors.page = { - listServices: new gaxModule.PageDescriptor( + listServices: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'services' ), - listSkus: new gaxModule.PageDescriptor( + listSkus: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', 'skus' @@ -167,7 +175,7 @@ export class CloudCatalogClient { }; // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( + this._defaults = this._gaxGrpc.constructSettings( 'google.cloud.billing.v1.CloudCatalog', gapicConfig as gax.ClientConfig, opts.clientConfig || {}, @@ -178,17 +186,35 @@ export class CloudCatalogClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this._innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.cloudCatalogStub) { + return this.cloudCatalogStub; + } // Put together the "service stub" for // google.cloud.billing.v1.CloudCatalog. - this.cloudCatalogStub = gaxGrpc.createStub( - opts.fallback - ? (protos as protobuf.Root).lookupService( + this.cloudCatalogStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( 'google.cloud.billing.v1.CloudCatalog' ) : // tslint:disable-next-line no-any - (protos as any).google.cloud.billing.v1.CloudCatalog, - opts + (this._protos as any).google.cloud.billing.v1.CloudCatalog, + this._opts ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides @@ -208,9 +234,9 @@ export class CloudCatalogClient { } ); - const apiCall = gaxModule.createApiCall( + const apiCall = this._gaxModule.createApiCall( innerCallPromise, - defaults[methodName], + this._defaults[methodName], this._descriptors.page[methodName] || this._descriptors.stream[methodName] || this._descriptors.longrunning[methodName] @@ -224,6 +250,8 @@ export class CloudCatalogClient { return apiCall(argument, callOptions, callback); }; } + + return this.cloudCatalogStub; } /** @@ -355,6 +383,7 @@ export class CloudCatalogClient { options = optionsOrCallback as gax.CallOptions; } options = options || {}; + this.initialize(); return this._innerApiCalls.listServices(request, options, callback); } @@ -391,6 +420,7 @@ export class CloudCatalogClient { request = request || {}; options = options || {}; const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listServices.createStream( this._innerApiCalls.listServices as gax.GaxCall, request, @@ -503,6 +533,7 @@ export class CloudCatalogClient { ] = gax.routingHeader.fromParams({ parent: request.parent || '', }); + this.initialize(); return this._innerApiCalls.listSkus(request, options, callback); } @@ -567,6 +598,7 @@ export class CloudCatalogClient { parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); + this.initialize(); return this._descriptors.page.listSkus.createStream( this._innerApiCalls.listSkus as gax.GaxCall, request, @@ -642,8 +674,9 @@ export class CloudCatalogClient { * The client will no longer be usable and all future behavior is undefined. */ close(): Promise { + this.initialize(); if (!this._terminated) { - return this.cloudCatalogStub.then(stub => { + return this.cloudCatalogStub!.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index e0684a1f0f4..13821d207f5 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,13 +1,13 @@ { - "updateTime": "2020-02-29T12:16:38.714183Z", + "updateTime": "2020-03-05T23:02:33.954720Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "83c6f84035ee0f80eaa44d8b688a010461cc4080", - "internalRef": "297918498", - "log": "83c6f84035ee0f80eaa44d8b688a010461cc4080\nUpdate google/api/auth.proto to make AuthProvider to have JwtLocation\n\nPiperOrigin-RevId: 297918498\n\n" + "sha": "f0b581b5bdf803e45201ecdb3688b60e381628a8", + "internalRef": "299181282", + "log": "f0b581b5bdf803e45201ecdb3688b60e381628a8\nfix: recommendationengine/v1beta1 update some comments\n\nPiperOrigin-RevId: 299181282\n\n10e9a0a833dc85ff8f05b2c67ebe5ac785fe04ff\nbuild: add generated BUILD file for Routes Preferred API\n\nPiperOrigin-RevId: 299164808\n\n86738c956a8238d7c77f729be78b0ed887a6c913\npublish v1p1beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299152383\n\n73d9f2ad4591de45c2e1f352bc99d70cbd2a6d95\npublish v1: update with absolute address in comments\n\nPiperOrigin-RevId: 299147194\n\nd2158f24cb77b0b0ccfe68af784c6a628705e3c6\npublish v1beta2: update with absolute address in comments\n\nPiperOrigin-RevId: 299147086\n\n7fca61292c11b4cd5b352cee1a50bf88819dd63b\npublish v1p2beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146903\n\n583b7321624736e2c490e328f4b1957335779295\npublish v1p3beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146674\n\n638253bf86d1ce1c314108a089b7351440c2f0bf\nfix: add java_multiple_files option for automl text_sentiment.proto\n\nPiperOrigin-RevId: 298971070\n\n373d655703bf914fb8b0b1cc4071d772bac0e0d1\nUpdate Recs AI Beta public bazel file\n\nPiperOrigin-RevId: 298961623\n\ndcc5d00fc8a8d8b56f16194d7c682027b2c66a3b\nfix: add java_multiple_files option for automl classification.proto\n\nPiperOrigin-RevId: 298953301\n\na3f791827266f3496a6a5201d58adc4bb265c2a3\nchore: automl/v1 publish annotations and retry config\n\nPiperOrigin-RevId: 298942178\n\n01c681586d8d6dbd60155289b587aee678530bd9\nMark return_immediately in PullRequest deprecated.\n\nPiperOrigin-RevId: 298893281\n\nc9f5e9c4bfed54bbd09227e990e7bded5f90f31c\nRemove out of date documentation for predicate support on the Storage API\n\nPiperOrigin-RevId: 298883309\n\nfd5b3b8238d783b04692a113ffe07c0363f5de0f\ngenerate webrisk v1 proto\n\nPiperOrigin-RevId: 298847934\n\n541b1ded4abadcc38e8178680b0677f65594ea6f\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 298686266\n\nc0d171acecb4f5b0bfd2c4ca34fc54716574e300\n Updated to include the Notification v1 API.\n\nPiperOrigin-RevId: 298652775\n\n2346a9186c0bff2c9cc439f2459d558068637e05\nAdd Service Directory v1beta1 protos and configs\n\nPiperOrigin-RevId: 298625638\n\na78ed801b82a5c6d9c5368e24b1412212e541bb7\nPublishing v3 protos and configs.\n\nPiperOrigin-RevId: 298607357\n\n4a180bfff8a21645b3a935c2756e8d6ab18a74e0\nautoml/v1beta1 publish proto updates\n\nPiperOrigin-RevId: 298484782\n\n6de6e938b7df1cd62396563a067334abeedb9676\nchore: use the latest gapic-generator and protoc-java-resource-name-plugin in Bazel workspace.\n\nPiperOrigin-RevId: 298474513\n\n244ab2b83a82076a1fa7be63b7e0671af73f5c02\nAdds service config definition for bigqueryreservation v1\n\nPiperOrigin-RevId: 298455048\n\n" } }, { diff --git a/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts b/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts index c8c20a8ca13..a2f405f2fd9 100644 --- a/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts +++ b/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts @@ -81,12 +81,30 @@ describe('v1.CloudBillingClient', () => { }); assert(client); }); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBillingStub, undefined); + await client.initialize(); + assert(client.cloudBillingStub); + }); + it('has close method', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); describe('getBillingAccount', () => { it('invokes getBillingAccount without error', done => { const client = new cloudbillingModule.v1.CloudBillingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest = {}; request.name = ''; @@ -110,6 +128,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest = {}; request.name = ''; @@ -135,6 +155,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest = {}; request.name = ''; @@ -158,6 +180,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest = {}; request.name = ''; @@ -183,6 +207,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest = {}; // Mock response @@ -205,6 +231,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest = {}; // Mock response @@ -229,6 +257,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest = {}; request.name = ''; @@ -252,6 +282,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest = {}; request.name = ''; @@ -277,6 +309,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest = {}; request.name = ''; @@ -300,6 +334,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest = {}; request.name = ''; @@ -328,6 +364,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; request.resource = ''; @@ -351,6 +389,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; request.resource = ''; @@ -376,6 +416,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; request.resource = ''; @@ -399,6 +441,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; request.resource = ''; @@ -424,6 +468,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; request.resource = ''; @@ -447,6 +493,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; request.resource = ''; @@ -472,6 +520,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest = {}; // Mock response @@ -498,6 +548,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest = {}; // Mock response @@ -529,6 +581,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest = {}; request.name = ''; @@ -556,6 +610,8 @@ describe('v1.CloudBillingClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest = {}; request.name = ''; diff --git a/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts b/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts index c95157e95b3..8318b6ac296 100644 --- a/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts +++ b/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts @@ -65,12 +65,30 @@ describe('v1.CloudCatalogClient', () => { }); assert(client); }); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudCatalogStub, undefined); + await client.initialize(); + assert(client.cloudCatalogStub); + }); + it('has close method', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); describe('listServices', () => { it('invokes listServices without error', done => { const client = new cloudcatalogModule.v1.CloudCatalogClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IListServicesRequest = {}; // Mock response @@ -97,6 +115,8 @@ describe('v1.CloudCatalogClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IListServicesRequest = {}; // Mock response @@ -128,6 +148,8 @@ describe('v1.CloudCatalogClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IListSkusRequest = {}; request.parent = ''; @@ -155,6 +177,8 @@ describe('v1.CloudCatalogClient', () => { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); + // Initialize client before mocking + client.initialize(); // Mock request const request: protosTypes.google.cloud.billing.v1.IListSkusRequest = {}; request.parent = ''; From 572413673b04a958a0ee47bb1d78e2330beac91f Mon Sep 17 00:00:00 2001 From: "gcf-merge-on-green[bot]" <60162190+gcf-merge-on-green[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2020 01:23:01 +0000 Subject: [PATCH 011/169] build: update linkinator config (#14) --- packages/google-cloud-billing/linkinator.config.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/linkinator.config.json b/packages/google-cloud-billing/linkinator.config.json index b555215ca02..29a223b6db6 100644 --- a/packages/google-cloud-billing/linkinator.config.json +++ b/packages/google-cloud-billing/linkinator.config.json @@ -4,5 +4,7 @@ "https://codecov.io/gh/googleapis/", "www.googleapis.com", "img.shields.io" - ] + ], + "silent": true, + "concurrency": 10 } From 271633f9f9e9e3fb16afe548da1d40624281265c Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Fri, 6 Mar 2020 14:56:55 -0800 Subject: [PATCH 012/169] build(tests): fix coveralls and enable build cop (#15) --- packages/google-cloud-billing/.mocharc.js | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 packages/google-cloud-billing/.mocharc.js diff --git a/packages/google-cloud-billing/.mocharc.js b/packages/google-cloud-billing/.mocharc.js new file mode 100644 index 00000000000..ff7b34fa5d1 --- /dev/null +++ b/packages/google-cloud-billing/.mocharc.js @@ -0,0 +1,28 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config From 94871666dfca93f2f5ea4bb679c7e25ff0ccfcc4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2020 00:04:09 +0000 Subject: [PATCH 013/169] chore: release 1.2.0 (#13) :robot: I have created a release \*beep\* \*boop\* --- ## [1.2.0](https://www.github.com/googleapis/nodejs-billing/compare/v1.1.0...v1.2.0) (2020-03-06) ### Features * deferred client initialization ([#12](https://www.github.com/googleapis/nodejs-billing/issues/12)) ([63c6abf](https://www.github.com/googleapis/nodejs-billing/commit/63c6abfc0b1f6322177222a7d65456517fce1e1b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 2d240a5ffa7..9dd0c045be4 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.2.0](https://www.github.com/googleapis/nodejs-billing/compare/v1.1.0...v1.2.0) (2020-03-06) + + +### Features + +* deferred client initialization ([#12](https://www.github.com/googleapis/nodejs-billing/issues/12)) ([63c6abf](https://www.github.com/googleapis/nodejs-billing/commit/63c6abfc0b1f6322177222a7d65456517fce1e1b)) + ## [1.1.0](https://www.github.com/googleapis/nodejs-billing/compare/v1.0.0...v1.1.0) (2020-02-29) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index d16b5c0c083..2cdf2741798 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "1.1.0", + "version": "1.2.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 761f7f9e0af..ee995658429 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^1.1.0" + "@google-cloud/billing": "^1.2.0" }, "devDependencies": { "c8": "^7.1.0", From ed0207dd8afe6ff4ea75e0401f076136ce4a05e0 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 18 Mar 2020 12:56:31 -0700 Subject: [PATCH 014/169] docs: mention templates in contributing section of README (#17) --- packages/google-cloud-billing/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index f5371968088..01b097b97b2 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -116,6 +116,12 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-billing/blob/master/CONTRIBUTING.md). +Please note that this `README.md`, the `samples/README.md`, +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) +are generated from a central template. To edit one of these files, make an edit +to its template in this +[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). + ## License Apache Version 2.0 From 8a8682745dc97f747a5fc34092a3457239e55746 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Thu, 19 Mar 2020 08:52:30 -0700 Subject: [PATCH 015/169] chore: remove snippet leading whitespace (#19) --- packages/google-cloud-billing/README.md | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 01b097b97b2..e01d814bf52 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -55,26 +55,26 @@ npm install @google-cloud/billing ### Using the client library ```javascript - // Imports the Google Cloud client library - const {CloudBillingClient} = require('@google-cloud/billing'); - - // Creates a client - const client = new CloudBillingClient(); - - // name = 'my-project' // Project name to list billing accounts for. - - async function listBillingAccounts() { - const [accounts] = await client.listBillingAccounts({ - name, - }); - console.info(`found ${accounts.length} billing accounts:`); - for (const account of accounts) { - console.info(`${account.displayName}:`); - console.info(`\topen: ${account.open}`); - console.info(`\tparentBillingAccount: ${account.masterBillingAccount}`); - } +// Imports the Google Cloud client library +const {CloudBillingClient} = require('@google-cloud/billing'); + +// Creates a client +const client = new CloudBillingClient(); + +// name = 'my-project' // Project name to list billing accounts for. + +async function listBillingAccounts() { + const [accounts] = await client.listBillingAccounts({ + name, + }); + console.info(`found ${accounts.length} billing accounts:`); + for (const account of accounts) { + console.info(`${account.displayName}:`); + console.info(`\topen: ${account.open}`); + console.info(`\tparentBillingAccount: ${account.masterBillingAccount}`); } - listBillingAccounts(); +} +listBillingAccounts(); ``` From d1b51a1c7a1081a4bd6cc1381065fca223190223 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 23 Mar 2020 18:28:21 -0700 Subject: [PATCH 016/169] docs: document version support goals (#24) --- packages/google-cloud-billing/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index e01d814bf52..06e2f4d2b16 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -94,6 +94,27 @@ has instructions for running the samples. The [Cloud Billing Node.js Client API Reference][client-docs] documentation also contains samples. +## Supported Node.js Versions + +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). +Libraries are compatible with all current _active_ and _maintenance_ versions of +Node.js. + +Client libraries targetting some end-of-life versions of Node.js are available, and +can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. + +_Legacy Node.js versions are supported as a best effort:_ + +* Legacy versions will not be tested in continuous integration. +* Some security patches may not be able to be backported. +* Dependencies will not be kept up-to-date, and features will not be backported. + +#### Legacy tags available + +* `legacy-8`: install client libraries from this dist-tag for versions + compatible with Node.js 8. + ## Versioning This library follows [Semantic Versioning](http://semver.org/). From 08af98dfaf4a3fcf163f709891ab5b96098cd4c7 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 25 Mar 2020 01:12:10 -0700 Subject: [PATCH 017/169] chore: regenerate the code (#23) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-03-22 04:16:28,100 synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py. 2020-03-22 04:16:28,152 synthtool > Ensuring dependencies. 2020-03-22 04:16:28,157 synthtool > Cloning googleapis. 2020-03-22 04:16:28,823 synthtool > Pulling Docker image: gapic-generator-typescript:latest latest: Pulling from gapic-images/gapic-generator-typescript Digest: sha256:3762b8bcba247ef4d020ffc7043e2881a20b5fab0ffd98d542f365d3f3a3829d Status: Image is up to date for gcr.io/gapic-images/gapic-generator-typescript:latest 2020-03-22 04:16:29,715 synthtool > Generating code for: google/cloud/billing/v1. 2020-03-22 04:16:30,881 synthtool > Generated code into /tmpfs/tmp/tmpmap9p8dh. .eslintignore .eslintrc.yml .github/ISSUE_TEMPLATE/bug_report.md .github/ISSUE_TEMPLATE/feature_request.md .github/ISSUE_TEMPLATE/support_request.md .github/PULL_REQUEST_TEMPLATE.md .github/publish.yml .github/release-please.yml .github/workflows/ci.yaml .kokoro/common.cfg .kokoro/continuous/node10/common.cfg .kokoro/continuous/node10/docs.cfg .kokoro/continuous/node10/lint.cfg .kokoro/continuous/node10/samples-test.cfg .kokoro/continuous/node10/system-test.cfg .kokoro/continuous/node10/test.cfg .kokoro/continuous/node12/common.cfg .kokoro/continuous/node12/test.cfg .kokoro/continuous/node8/common.cfg .kokoro/continuous/node8/test.cfg .kokoro/docs.sh .kokoro/lint.sh .kokoro/presubmit/node10/common.cfg .kokoro/presubmit/node10/docs.cfg .kokoro/presubmit/node10/lint.cfg .kokoro/presubmit/node10/samples-test.cfg .kokoro/presubmit/node10/system-test.cfg .kokoro/presubmit/node10/test.cfg .kokoro/presubmit/node12/common.cfg .kokoro/presubmit/node12/test.cfg .kokoro/presubmit/node8/common.cfg .kokoro/presubmit/node8/test.cfg .kokoro/presubmit/windows/common.cfg .kokoro/presubmit/windows/test.cfg .kokoro/publish.sh .kokoro/release/docs.cfg .kokoro/release/docs.sh .kokoro/release/publish.cfg .kokoro/samples-test.sh .kokoro/system-test.sh .kokoro/test.bat .kokoro/test.sh .kokoro/trampoline.sh .mocharc.js .nycrc .prettierignore .prettierrc CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md codecov.yaml renovate.json samples/README.md npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > protobufjs@6.8.9 postinstall /tmpfs/src/git/autosynth/working_repo/node_modules/protobufjs > node scripts/postinstall > @google-cloud/billing@1.2.0 prepare /tmpfs/src/git/autosynth/working_repo > npm run compile-protos && npm run compile npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > @google-cloud/billing@1.2.0 compile-protos /tmpfs/src/git/autosynth/working_repo > compileProtos src installing semver@^5.5.0 installing uglify-js@^3.3.25 installing espree@^3.5.4 installing escodegen@^1.9.1 npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > @google-cloud/billing@1.2.0 compile /tmpfs/src/git/autosynth/working_repo > tsc -p . && cp -r protos build/ npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.1 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack/node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: abbrev@1.1.1 (node_modules/watchpack/node_modules/fsevents/node_modules/abbrev): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/abbrev' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.abbrev.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ansi-regex@2.1.1 (node_modules/watchpack/node_modules/fsevents/node_modules/ansi-regex): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/ansi-regex' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.ansi-regex.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: aproba@1.2.0 (node_modules/watchpack/node_modules/fsevents/node_modules/aproba): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/aproba' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.aproba.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: balanced-match@1.0.0 (node_modules/watchpack/node_modules/fsevents/node_modules/balanced-match): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/balanced-match' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.balanced-match.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: chownr@1.1.4 (node_modules/watchpack/node_modules/fsevents/node_modules/chownr): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/chownr' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.chownr.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: code-point-at@1.1.0 (node_modules/watchpack/node_modules/fsevents/node_modules/code-point-at): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/code-point-at' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.code-point-at.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: concat-map@0.0.1 (node_modules/watchpack/node_modules/fsevents/node_modules/concat-map): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/concat-map' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.concat-map.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: console-control-strings@1.1.0 (node_modules/watchpack/node_modules/fsevents/node_modules/console-control-strings): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/console-control-strings' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.console-control-strings.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-util-is@1.0.2 (node_modules/watchpack/node_modules/fsevents/node_modules/core-util-is): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/core-util-is' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.core-util-is.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: deep-extend@0.6.0 (node_modules/watchpack/node_modules/fsevents/node_modules/deep-extend): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/deep-extend' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.deep-extend.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: delegates@1.0.0 (node_modules/watchpack/node_modules/fsevents/node_modules/delegates): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/delegates' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.delegates.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: detect-libc@1.0.3 (node_modules/watchpack/node_modules/fsevents/node_modules/detect-libc): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/detect-libc' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.detect-libc.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs.realpath@1.0.0 (node_modules/watchpack/node_modules/fsevents/node_modules/fs.realpath): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/fs.realpath' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.fs.realpath.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: has-unicode@2.0.1 (node_modules/watchpack/node_modules/fsevents/node_modules/has-unicode): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/has-unicode' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.has-unicode.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: inherits@2.0.4 (node_modules/watchpack/node_modules/fsevents/node_modules/inherits): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/inherits' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.inherits.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ini@1.3.5 (node_modules/watchpack/node_modules/fsevents/node_modules/ini): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/ini' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.ini.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: isarray@1.0.0 (node_modules/watchpack/node_modules/fsevents/node_modules/isarray): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/isarray' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.isarray.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@1.2.5 (node_modules/watchpack/node_modules/fsevents/node_modules/minimist): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/minimist' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.minimist.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ms@2.1.2 (node_modules/watchpack/node_modules/fsevents/node_modules/ms): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/ms' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.ms.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: npm-normalize-package-bin@1.0.1 (node_modules/watchpack/node_modules/fsevents/node_modules/npm-normalize-package-bin): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/npm-normalize-package-bin' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.npm-normalize-package-bin.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: number-is-nan@1.0.1 (node_modules/watchpack/node_modules/fsevents/node_modules/number-is-nan): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/number-is-nan' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.number-is-nan.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: object-assign@4.1.1 (node_modules/watchpack/node_modules/fsevents/node_modules/object-assign): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/object-assign' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.object-assign.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-homedir@1.0.2 (node_modules/watchpack/node_modules/fsevents/node_modules/os-homedir): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/os-homedir' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.os-homedir.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-tmpdir@1.0.2 (node_modules/watchpack/node_modules/fsevents/node_modules/os-tmpdir): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/os-tmpdir' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.os-tmpdir.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: path-is-absolute@1.0.1 (node_modules/watchpack/node_modules/fsevents/node_modules/path-is-absolute): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/path-is-absolute' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.path-is-absolute.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: process-nextick-args@2.0.1 (node_modules/watchpack/node_modules/fsevents/node_modules/process-nextick-args): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/process-nextick-args' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.process-nextick-args.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safe-buffer@5.1.2 (node_modules/watchpack/node_modules/fsevents/node_modules/safe-buffer): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/safe-buffer' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.safe-buffer.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safer-buffer@2.1.2 (node_modules/watchpack/node_modules/fsevents/node_modules/safer-buffer): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/safer-buffer' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.safer-buffer.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sax@1.2.4 (node_modules/watchpack/node_modules/fsevents/node_modules/sax): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/sax' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.sax.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: semver@5.7.1 (node_modules/watchpack/node_modules/fsevents/node_modules/semver): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/semver' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.semver.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: set-blocking@2.0.0 (node_modules/watchpack/node_modules/fsevents/node_modules/set-blocking): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/set-blocking' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.set-blocking.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: signal-exit@3.0.2 (node_modules/watchpack/node_modules/fsevents/node_modules/signal-exit): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/signal-exit' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.signal-exit.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: strip-json-comments@2.0.1 (node_modules/watchpack/node_modules/fsevents/node_modules/strip-json-comments): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/strip-json-comments' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.strip-json-comments.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: util-deprecate@1.0.2 (node_modules/watchpack/node_modules/fsevents/node_modules/util-deprecate): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/util-deprecate' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.util-deprecate.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: wrappy@1.0.2 (node_modules/watchpack/node_modules/fsevents/node_modules/wrappy): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/wrappy' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.wrappy.DELETE' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: yallist@3.1.1 (node_modules/watchpack/node_modules/fsevents/node_modules/yallist): npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/yallist' -> '/tmpfs/src/git/autosynth/working_repo/node_modules/watchpack/node_modules/fsevents/node_modules/.yallist.DELETE' added 967 packages from 454 contributors and audited 6746 packages in 27.191s found 0 vulnerabilities npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11. npm WARN npm You can find the latest version at https://nodejs.org/ > @google-cloud/billing@1.2.0 fix /tmpfs/src/git/autosynth/working_repo > gts fix && eslint samples --fix /tmpfs/src/git/autosynth/working_repo/samples/quickstart.js 23:40 error "@google-cloud/billing" is not found node/no-missing-require /tmpfs/src/git/autosynth/working_repo/samples/test/quickstart.js 21:26 error "chai" is not found node/no-missing-require ✖ 2 problems (2 errors, 0 warnings) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @google-cloud/billing@1.2.0 fix: `gts fix && eslint samples --fix` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @google-cloud/billing@1.2.0 fix script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/kbuilder/.npm/_logs/2020-03-22T11_17_07_633Z-debug.log 2020-03-22 04:17:07,648 synthtool > Wrote metadata to synth.metadata. ```
--- packages/google-cloud-billing/.jsdoc.js | 2 +- packages/google-cloud-billing/src/index.ts | 2 +- .../src/v1/cloud_billing_client.ts | 12 +++++++++--- .../src/v1/cloud_catalog_client.ts | 12 +++++++++--- packages/google-cloud-billing/src/v1/index.ts | 2 +- packages/google-cloud-billing/synth.metadata | 16 ++++++++-------- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- .../google-cloud-billing/system-test/install.ts | 2 +- .../test/gapic-cloud_billing-v1.ts | 2 +- .../test/gapic-cloud_catalog-v1.ts | 2 +- packages/google-cloud-billing/webpack.config.js | 2 +- 12 files changed, 35 insertions(+), 23 deletions(-) diff --git a/packages/google-cloud-billing/.jsdoc.js b/packages/google-cloud-billing/.jsdoc.js index 81518d292e6..e05890800b6 100644 --- a/packages/google-cloud-billing/.jsdoc.js +++ b/packages/google-cloud-billing/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index 3ca552e9d89..80379fe2a5b 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 04d2342e8e3..39d5bec9e2b 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. @@ -40,7 +40,12 @@ const version = require('../../../package.json').version; * @memberof v1 */ export class CloudBillingClient { - private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; private _innerApiCalls: {[name: string]: Function}; private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; @@ -239,7 +244,8 @@ export class CloudBillingClient { if (this._terminated) { return Promise.reject('The client has already been closed.'); } - return stub[methodName].apply(stub, args); + const func = stub[methodName]; + return func.apply(stub, args); }, (err: Error | null | undefined) => () => { throw err; diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 615575b8f35..b932e4b7b09 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. @@ -42,7 +42,12 @@ const version = require('../../../package.json').version; * @memberof v1 */ export class CloudCatalogClient { - private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; private _innerApiCalls: {[name: string]: Function}; private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; @@ -227,7 +232,8 @@ export class CloudCatalogClient { if (this._terminated) { return Promise.reject('The client has already been closed.'); } - return stub[methodName].apply(stub, args); + const func = stub[methodName]; + return func.apply(stub, args); }, (err: Error | null | undefined) => () => { throw err; diff --git a/packages/google-cloud-billing/src/v1/index.ts b/packages/google-cloud-billing/src/v1/index.ts index 0436765de76..6e2f971b42f 100644 --- a/packages/google-cloud-billing/src/v1/index.ts +++ b/packages/google-cloud-billing/src/v1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 13821d207f5..0a7766ec42b 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,20 +1,20 @@ { - "updateTime": "2020-03-05T23:02:33.954720Z", + "updateTime": "2020-03-22T11:17:07.647933Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "f0b581b5bdf803e45201ecdb3688b60e381628a8", - "internalRef": "299181282", - "log": "f0b581b5bdf803e45201ecdb3688b60e381628a8\nfix: recommendationengine/v1beta1 update some comments\n\nPiperOrigin-RevId: 299181282\n\n10e9a0a833dc85ff8f05b2c67ebe5ac785fe04ff\nbuild: add generated BUILD file for Routes Preferred API\n\nPiperOrigin-RevId: 299164808\n\n86738c956a8238d7c77f729be78b0ed887a6c913\npublish v1p1beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299152383\n\n73d9f2ad4591de45c2e1f352bc99d70cbd2a6d95\npublish v1: update with absolute address in comments\n\nPiperOrigin-RevId: 299147194\n\nd2158f24cb77b0b0ccfe68af784c6a628705e3c6\npublish v1beta2: update with absolute address in comments\n\nPiperOrigin-RevId: 299147086\n\n7fca61292c11b4cd5b352cee1a50bf88819dd63b\npublish v1p2beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146903\n\n583b7321624736e2c490e328f4b1957335779295\npublish v1p3beta1: update with absolute address in comments\n\nPiperOrigin-RevId: 299146674\n\n638253bf86d1ce1c314108a089b7351440c2f0bf\nfix: add java_multiple_files option for automl text_sentiment.proto\n\nPiperOrigin-RevId: 298971070\n\n373d655703bf914fb8b0b1cc4071d772bac0e0d1\nUpdate Recs AI Beta public bazel file\n\nPiperOrigin-RevId: 298961623\n\ndcc5d00fc8a8d8b56f16194d7c682027b2c66a3b\nfix: add java_multiple_files option for automl classification.proto\n\nPiperOrigin-RevId: 298953301\n\na3f791827266f3496a6a5201d58adc4bb265c2a3\nchore: automl/v1 publish annotations and retry config\n\nPiperOrigin-RevId: 298942178\n\n01c681586d8d6dbd60155289b587aee678530bd9\nMark return_immediately in PullRequest deprecated.\n\nPiperOrigin-RevId: 298893281\n\nc9f5e9c4bfed54bbd09227e990e7bded5f90f31c\nRemove out of date documentation for predicate support on the Storage API\n\nPiperOrigin-RevId: 298883309\n\nfd5b3b8238d783b04692a113ffe07c0363f5de0f\ngenerate webrisk v1 proto\n\nPiperOrigin-RevId: 298847934\n\n541b1ded4abadcc38e8178680b0677f65594ea6f\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 298686266\n\nc0d171acecb4f5b0bfd2c4ca34fc54716574e300\n Updated to include the Notification v1 API.\n\nPiperOrigin-RevId: 298652775\n\n2346a9186c0bff2c9cc439f2459d558068637e05\nAdd Service Directory v1beta1 protos and configs\n\nPiperOrigin-RevId: 298625638\n\na78ed801b82a5c6d9c5368e24b1412212e541bb7\nPublishing v3 protos and configs.\n\nPiperOrigin-RevId: 298607357\n\n4a180bfff8a21645b3a935c2756e8d6ab18a74e0\nautoml/v1beta1 publish proto updates\n\nPiperOrigin-RevId: 298484782\n\n6de6e938b7df1cd62396563a067334abeedb9676\nchore: use the latest gapic-generator and protoc-java-resource-name-plugin in Bazel workspace.\n\nPiperOrigin-RevId: 298474513\n\n244ab2b83a82076a1fa7be63b7e0671af73f5c02\nAdds service config definition for bigqueryreservation v1\n\nPiperOrigin-RevId: 298455048\n\n" + "sha": "0be7105dc52590fa9a24e784052298ae37ce53aa", + "internalRef": "302154871", + "log": "0be7105dc52590fa9a24e784052298ae37ce53aa\nAdd BUILD.bazel file to asset/v1p1beta1\n\nPiperOrigin-RevId: 302154871\n\n6c248fd13e8543f8d22cbf118d978301a9fbe2a8\nAdd missing resource annotations and additional_bindings to dialogflow v2 API.\n\nPiperOrigin-RevId: 302063117\n\n9a3a7f33be9eeacf7b3e98435816b7022d206bd7\nChange the service name from \"chromeos-moblab.googleapis.com\" to \"chromeosmoblab.googleapis.com\"\n\nPiperOrigin-RevId: 302060989\n\n98a339237577e3de26cb4921f75fb5c57cc7a19f\nfeat: devtools/build/v1 publish client library config annotations\n\n* add details field to some of the BuildEvents\n* add final_invocation_id and build_tool_exit_code fields to BuildStatus\n\nPiperOrigin-RevId: 302044087\n\ncfabc98c6bbbb22d1aeaf7612179c0be193b3a13\nfeat: home/graph/v1 publish client library config annotations & comment updates\n\nThis change includes adding the client library configuration annotations, updated proto comments, and some client library configuration files.\n\nPiperOrigin-RevId: 302042647\n\nc8c8c0bd15d082db9546253dbaad1087c7a9782c\nchore: use latest gapic-generator in bazel WORKSPACE.\nincluding the following commits from gapic-generator:\n- feat: take source protos in all sub-packages (#3144)\n\nPiperOrigin-RevId: 301843591\n\ne4daf5202ea31cb2cb6916fdbfa9d6bd771aeb4c\nAdd bazel file for v1 client lib generation\n\nPiperOrigin-RevId: 301802926\n\n275fbcce2c900278d487c33293a3c7e1fbcd3a34\nfeat: pubsub/v1 add an experimental filter field to Subscription\n\nPiperOrigin-RevId: 301661567\n\nf2b18cec51d27c999ad30011dba17f3965677e9c\nFix: UpdateBackupRequest.backup is a resource, not a resource reference - remove annotation.\n\nPiperOrigin-RevId: 301636171\n\n800384063ac93a0cac3a510d41726fa4b2cd4a83\nCloud Billing Budget API v1beta1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301634389\n\n0cc6c146b660db21f04056c3d58a4b752ee445e3\nCloud Billing Budget API v1alpha1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301630018\n\nff2ea00f69065585c3ac0993c8b582af3b6fc215\nFix: Add resource definition for a parent of InspectTemplate which was otherwise missing.\n\nPiperOrigin-RevId: 301623052\n\n55fa441c9daf03173910760191646399338f2b7c\nAdd proto definition for AccessLevel, AccessPolicy, and ServicePerimeter.\n\nPiperOrigin-RevId: 301620844\n\ne7b10591c5408a67cf14ffafa267556f3290e262\nCloud Bigtable Managed Backup service and message proto files.\n\nPiperOrigin-RevId: 301585144\n\nd8e226f702f8ddf92915128c9f4693b63fb8685d\nfeat: Add time-to-live in a queue for builds\n\nPiperOrigin-RevId: 301579876\n\n430375af011f8c7a5174884f0d0e539c6ffa7675\ndocs: add missing closing backtick\n\nPiperOrigin-RevId: 301538851\n\n0e9f1f60ded9ad1c2e725e37719112f5b487ab65\nbazel: Use latest release of gax_java\n\nPiperOrigin-RevId: 301480457\n\n5058c1c96d0ece7f5301a154cf5a07b2ad03a571\nUpdate GAPIC v2 with batching parameters for Logging API\n\nPiperOrigin-RevId: 301443847\n\n64ab9744073de81fec1b3a6a931befc8a90edf90\nFix: Introduce location-based organization/folder/billing-account resources\nChore: Update copyright years\n\nPiperOrigin-RevId: 301373760\n\n23d5f09e670ebb0c1b36214acf78704e2ecfc2ac\nUpdate field_behavior annotations in V1 and V2.\n\nPiperOrigin-RevId: 301337970\n\nb2cf37e7fd62383a811aa4d54d013ecae638851d\nData Catalog V1 API\n\nPiperOrigin-RevId: 301282503\n\n1976b9981e2900c8172b7d34b4220bdb18c5db42\nCloud DLP api update. Adds missing fields to Finding and adds support for hybrid jobs.\n\nPiperOrigin-RevId: 301205325\n\nae78682c05e864d71223ce22532219813b0245ac\nfix: several sample code blocks in comments are now properly indented for markdown\n\nPiperOrigin-RevId: 301185150\n\ndcd171d04bda5b67db13049320f97eca3ace3731\nPublish Media Translation API V1Beta1\n\nPiperOrigin-RevId: 301180096\n\nff1713453b0fbc5a7544a1ef6828c26ad21a370e\nAdd protos and BUILD rules for v1 API.\n\nPiperOrigin-RevId: 301179394\n\n8386761d09819b665b6a6e1e6d6ff884bc8ff781\nfeat: chromeos/modlab publish protos and config for Chrome OS Moblab API.\n\nPiperOrigin-RevId: 300843960\n\nb2e2bc62fab90e6829e62d3d189906d9b79899e4\nUpdates to GCS gRPC API spec:\n\n1. Changed GetIamPolicy and TestBucketIamPermissions to use wrapper messages around google.iam.v1 IAM requests messages, and added CommonRequestParams. This lets us support RequesterPays buckets.\n2. Added a metadata field to GetObjectMediaResponse, to support resuming an object media read safely (by extracting the generation of the object being read, and using it in the resumed read request).\n\nPiperOrigin-RevId: 300817706\n\n7fd916ce12335cc9e784bb9452a8602d00b2516c\nAdd deprecated_collections field for backward-compatiblity in PHP and monolith-generated Python and Ruby clients.\n\nGenerate TopicName class in Java which covers the functionality of both ProjectTopicName and DeletedTopicName. Introduce breaking changes to be fixed by synth.py.\n\nDelete default retry parameters.\n\nRetry codes defs can be deleted once # https://github.com/googleapis/gapic-generator/issues/3137 is fixed.\n\nPiperOrigin-RevId: 300813135\n\n047d3a8ac7f75383855df0166144f891d7af08d9\nfix!: google/rpc refactor ErrorInfo.type to ErrorInfo.reason and comment updates.\n\nPiperOrigin-RevId: 300773211\n\nfae4bb6d5aac52aabe5f0bb4396466c2304ea6f6\nAdding RetryPolicy to pubsub.proto\n\nPiperOrigin-RevId: 300769420\n\n7d569be2928dbd72b4e261bf9e468f23afd2b950\nAdding additional protocol buffer annotations to v3.\n\nPiperOrigin-RevId: 300718800\n\n13942d1a85a337515040a03c5108993087dc0e4f\nAdd logging protos for Recommender v1.\n\nPiperOrigin-RevId: 300689896\n\na1a573c3eecfe2c404892bfa61a32dd0c9fb22b6\nfix: change go package to use cloud.google.com/go/maps\n\nPiperOrigin-RevId: 300661825\n\nc6fbac11afa0c7ab2972d9df181493875c566f77\nfeat: publish documentai/v1beta2 protos\n\nPiperOrigin-RevId: 300656808\n\n5202a9e0d9903f49e900f20fe5c7f4e42dd6588f\nProtos for v1beta1 release of Cloud Security Center Settings API\n\nPiperOrigin-RevId: 300580858\n\n83518e18655d9d4ac044acbda063cc6ecdb63ef8\nAdds gapic.yaml file and BUILD.bazel file.\n\nPiperOrigin-RevId: 300554200\n\n836c196dc8ef8354bbfb5f30696bd3477e8db5e2\nRegenerate recommender v1beta1 gRPC ServiceConfig file for Insights methods.\n\nPiperOrigin-RevId: 300549302\n\n34a5450c591b6be3d6566f25ac31caa5211b2f3f\nIncreases the default timeout from 20s to 30s for MetricService\n\nPiperOrigin-RevId: 300474272\n\n5d8bffe87cd01ba390c32f1714230e5a95d5991d\nfeat: use the latest gapic-generator in WORKSPACE for bazel build.\n\nPiperOrigin-RevId: 300461878\n\nd631c651e3bcfac5d371e8560c27648f7b3e2364\nUpdated the GAPIC configs to include parameters for Backups APIs.\n\nPiperOrigin-RevId: 300443402\n\n678afc7055c1adea9b7b54519f3bdb228013f918\nAdding Game Servers v1beta API.\n\nPiperOrigin-RevId: 300433218\n\n80d2bd2c652a5e213302041b0620aff423132589\nEnable proto annotation and gapic v2 for talent API.\n\nPiperOrigin-RevId: 300393997\n\n85e454be7a353f7fe1bf2b0affb753305785b872\ndocs(google/maps/roads): remove mention of nonexported api\n\nPiperOrigin-RevId: 300367734\n\nbf839ae632e0f263a729569e44be4b38b1c85f9c\nAdding protocol buffer annotations and updated config info for v1 and v2.\n\nPiperOrigin-RevId: 300276913\n\n309b899ca18a4c604bce63882a161d44854da549\nPublish `Backup` APIs and protos.\n\nPiperOrigin-RevId: 300246038\n\neced64c3f122421350b4aca68a28e89121d20db8\nadd PHP client libraries\n\nPiperOrigin-RevId: 300193634\n\n7727af0e39df1ae9ad715895c8576d7b65cf6c6d\nfeat: use the latest gapic-generator and protoc-java-resource-name-plugin in googleapis/WORKSPACE.\n\nPiperOrigin-RevId: 300188410\n\n2a25aa351dd5b5fe14895266aff5824d90ce757b\nBreaking change: remove the ProjectOrTenant resource and its references.\n\nPiperOrigin-RevId: 300182152\n\na499dbb28546379415f51803505cfb6123477e71\nUpdate web risk v1 gapic config and BUILD file.\n\nPiperOrigin-RevId: 300152177\n\n52701da10fec2a5f9796e8d12518c0fe574488fe\nFix: apply appropriate namespace/package options for C#, PHP and Ruby.\n\nPiperOrigin-RevId: 300123508\n\n365c029b8cdb63f7751b92ab490f1976e616105c\nAdd CC targets to the kms protos.\n\nThese are needed by go/tink.\n\nPiperOrigin-RevId: 300038469\n\n4ba9aa8a4a1413b88dca5a8fa931824ee9c284e6\nExpose logo recognition API proto for GA.\n\nPiperOrigin-RevId: 299971671\n\n1c9fc2c9e03dadf15f16b1c4f570955bdcebe00e\nAdding ruby_package option to accessapproval.proto for the Ruby client libraries generation.\n\nPiperOrigin-RevId: 299955924\n\n1cc6f0a7bfb147e6f2ede911d9b01e7a9923b719\nbuild(google/maps/routes): generate api clients\n\nPiperOrigin-RevId: 299955905\n\n29a47c965aac79e3fe8e3314482ca0b5967680f0\nIncrease timeout to 1hr for method `dropRange` in bigtable/admin/v2, which is\nsynced with the timeout setting in gapic_yaml.\n\nPiperOrigin-RevId: 299917154\n\n8f631c4c70a60a9c7da3749511ee4ad432b62898\nbuild(google/maps/roads/v1op): move go to monorepo pattern\n\nPiperOrigin-RevId: 299885195\n\nd66816518844ebbf63504c9e8dfc7133921dd2cd\nbuild(google/maps/roads/v1op): Add bazel build files to generate clients.\n\nPiperOrigin-RevId: 299851148\n\naf7dff701fabe029672168649c62356cf1bb43d0\nAdd LogPlayerReports and LogImpressions to Playable Locations service\n\nPiperOrigin-RevId: 299724050\n\nb6927fca808f38df32a642c560082f5bf6538ced\nUpdate BigQuery Connection API v1beta1 proto: added credential to CloudSqlProperties.\n\nPiperOrigin-RevId: 299503150\n\n91e1fb5ef9829c0c7a64bfa5bde330e6ed594378\nchore: update protobuf (protoc) version to 3.11.2\n\nPiperOrigin-RevId: 299404145\n\n30e36b4bee6749c4799f4fc1a51cc8f058ba167d\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 299399890\n\nffbb493674099f265693872ae250711b2238090c\nfeat: cloudbuild/v1 add new fields and annotate OUTPUT_OUT fields.\n\nPiperOrigin-RevId: 299397780\n\nbc973a15818e00c19e121959832676e9b7607456\nbazel: Fix broken common dependency\n\nPiperOrigin-RevId: 299397431\n\n71094a343e3b962e744aa49eb9338219537474e4\nchore: bigtable/admin/v2 publish retry config\n\nPiperOrigin-RevId: 299391875\n\n8f488efd7bda33885cb674ddd023b3678c40bd82\nfeat: Migrate logging to GAPIC v2; release new features.\n\nIMPORTANT: This is a breaking change for client libraries\nin all languages.\n\nCommitter: @lukesneeringer, @jskeet\nPiperOrigin-RevId: 299370279\n\n007605bf9ad3a1fd775014ebefbf7f1e6b31ee71\nUpdate API for bigqueryreservation v1beta1.\n- Adds flex capacity commitment plan to CapacityCommitment.\n- Adds methods for getting and updating BiReservations.\n- Adds methods for updating/splitting/merging CapacityCommitments.\n\nPiperOrigin-RevId: 299368059\n\n" } }, { - "template": { - "name": "node_library", - "origin": "synthtool.gcp", - "version": "2020.2.4" + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "7e98e1609c91082f4eeb63b530c6468aefd18cfd" } } ], diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js index 989eff52d20..e2595373d29 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts index 7af92f4e405..57c9ada62c7 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-billing/system-test/install.ts b/packages/google-cloud-billing/system-test/install.ts index c9aa74ec221..c4d80e9c0c8 100644 --- a/packages/google-cloud-billing/system-test/install.ts +++ b/packages/google-cloud-billing/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts b/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts index a2f405f2fd9..b1fe2068293 100644 --- a/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts +++ b/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts b/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts index 8318b6ac296..9e6d72d13ca 100644 --- a/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts +++ b/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. diff --git a/packages/google-cloud-billing/webpack.config.js b/packages/google-cloud-billing/webpack.config.js index 697bb874b79..e4c1e9dff02 100644 --- a/packages/google-cloud-billing/webpack.config.js +++ b/packages/google-cloud-billing/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// 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. From 6bfdc6204783086c855d0d8aab5eccd004df37b5 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Tue, 31 Mar 2020 13:44:53 -0700 Subject: [PATCH 018/169] feat!: drop node8 support, support for async iterators (#27) BREAKING CHANGE: The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. New feature: methods with pagination now support async iteration. --- packages/google-cloud-billing/.eslintrc.json | 3 + packages/google-cloud-billing/.eslintrc.yml | 15 - packages/google-cloud-billing/.prettierrc | 8 - packages/google-cloud-billing/.prettierrc.js | 17 + packages/google-cloud-billing/package.json | 24 +- .../samples/test/quickstart.js | 2 +- packages/google-cloud-billing/src/index.ts | 2 - .../src/v1/cloud_billing_client.ts | 678 ++++--- .../src/v1/cloud_catalog_client.ts | 284 ++- packages/google-cloud-billing/synth.metadata | 20 +- .../system-test/fixtures/sample/src/index.js | 1 - .../test/gapic-cloud_billing-v1.ts | 641 ------ .../test/gapic-cloud_catalog-v1.ts | 208 -- .../test/gapic_cloud_billing_v1.ts | 1805 +++++++++++++++++ .../test/gapic_cloud_catalog_v1.ts | 796 ++++++++ .../google-cloud-billing/webpack.config.js | 12 +- 16 files changed, 3270 insertions(+), 1246 deletions(-) create mode 100644 packages/google-cloud-billing/.eslintrc.json delete mode 100644 packages/google-cloud-billing/.eslintrc.yml delete mode 100644 packages/google-cloud-billing/.prettierrc create mode 100644 packages/google-cloud-billing/.prettierrc.js delete mode 100644 packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts delete mode 100644 packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts create mode 100644 packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts create mode 100644 packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts diff --git a/packages/google-cloud-billing/.eslintrc.json b/packages/google-cloud-billing/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-billing/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-billing/.eslintrc.yml b/packages/google-cloud-billing/.eslintrc.yml deleted file mode 100644 index 73eeec27612..00000000000 --- a/packages/google-cloud-billing/.eslintrc.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -extends: - - 'eslint:recommended' - - 'plugin:node/recommended' - - prettier -plugins: - - node - - prettier -rules: - prettier/prettier: error - block-scoped-var: error - eqeqeq: error - no-warning-comments: warn - no-var: error - prefer-const: error diff --git a/packages/google-cloud-billing/.prettierrc b/packages/google-cloud-billing/.prettierrc deleted file mode 100644 index df6eac07446..00000000000 --- a/packages/google-cloud-billing/.prettierrc +++ /dev/null @@ -1,8 +0,0 @@ ---- -bracketSpacing: false -printWidth: 80 -semi: true -singleQuote: true -tabWidth: 2 -trailingComma: es5 -useTabs: false diff --git a/packages/google-cloud-billing/.prettierrc.js b/packages/google-cloud-billing/.prettierrc.js new file mode 100644 index 00000000000..08cba3775be --- /dev/null +++ b/packages/google-cloud-billing/.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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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-billing/package.json b/packages/google-cloud-billing/package.json index 2cdf2741798..b6189568002 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -26,31 +26,33 @@ "samples-test": "cd samples/ && npm link ../ && npm test && cd ../" }, "dependencies": { - "google-gax": "^1.12.0" + "google-gax": "^2.0.1" }, "devDependencies": { "@types/mocha": "^7.0.0", "@types/node": "^12.0.0", + "@types/sinon": "^7.5.2", "c8": "^7.0.0", - "gts": "^1.0.0", + "eslint": "^6.0.0", + "eslint-config-prettier": "^6.0.0", + "eslint-plugin-node": "^11.0.0", + "eslint-plugin-prettier": "^3.0.1", + "gts": "2.0.0-alpha.9", "jsdoc": "^3.5.5", "jsdoc-fresh": "^1.0.1", "jsdoc-region-tag": "^1.0.2", "linkinator": "^2.0.0", "mocha": "^7.0.0", - "pack-n-play": "^1.0.0-2", "null-loader": "^3.0.0", + "pack-n-play": "^1.0.0-2", + "prettier": "^1.17.0", + "sinon": "^9.0.1", "ts-loader": "^6.2.1", - "typescript": "~3.6.4", + "typescript": "^3.8.3", "webpack": "^4.41.2", - "webpack-cli": "^3.3.10", - "eslint": "^6.0.0", - "eslint-config-prettier": "^6.0.0", - "eslint-plugin-node": "^11.0.0", - "eslint-plugin-prettier": "^3.0.1", - "prettier": "^1.17.0" + "webpack-cli": "^3.3.10" }, "engines": { - "node": ">=8.13.0" + "node": ">=10" } } diff --git a/packages/google-cloud-billing/samples/test/quickstart.js b/packages/google-cloud-billing/samples/test/quickstart.js index cd2b2b29c99..e66d4cb0797 100644 --- a/packages/google-cloud-billing/samples/test/quickstart.js +++ b/packages/google-cloud-billing/samples/test/quickstart.js @@ -28,7 +28,7 @@ const cwd = path.join(__dirname, '..'); describe('Quickstart', () => { it('should run quickstart', async () => { - const stdout = execSync(`node ./quickstart.js`, {cwd}); + const stdout = execSync('node ./quickstart.js', {cwd}); assert.match(stdout, /found [0-9]+ billing accounts/); }); }); diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index 80379fe2a5b..41db5b4968b 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -20,8 +20,6 @@ import * as v1 from './v1'; const CloudBillingClient = v1.CloudBillingClient; const CloudCatalogClient = v1.CloudCatalogClient; export {v1, CloudBillingClient, CloudCatalogClient}; -// For compatibility with JavaScript libraries we need to provide this default export: -// tslint:disable-next-line no-default-export export default {v1, CloudBillingClient, CloudCatalogClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 39d5bec9e2b..9903256b706 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -18,18 +18,18 @@ import * as gax from 'google-gax'; import { - APICallback, + GaxCall, Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, - PaginationResponse, } from 'google-gax'; import * as path from 'path'; import {Transform} from 'stream'; -import * as protosTypes from '../../protos/protos'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; import * as gapicConfig from './cloud_billing_client_config.json'; const version = require('../../../package.json').version; @@ -40,14 +40,6 @@ const version = require('../../../package.json').version; * @memberof v1 */ export class CloudBillingClient { - private _descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - private _innerApiCalls: {[name: string]: Function}; - private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; private _opts: ClientOptions; private _gaxModule: typeof gax | typeof gax.fallback; @@ -55,6 +47,14 @@ export class CloudBillingClient { private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; cloudBillingStub?: Promise<{[name: string]: Function}>; /** @@ -146,13 +146,16 @@ export class CloudBillingClient { 'protos.json' ); this._protos = this._gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. - this._pathTemplates = { + this.pathTemplates = { billingAccountPathTemplate: new this._gaxModule.PathTemplate( 'billingAccounts/{billing_account}' ), @@ -167,7 +170,7 @@ export class CloudBillingClient { // 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 = { + this.descriptors.page = { listBillingAccounts: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', @@ -191,7 +194,7 @@ export class CloudBillingClient { // 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 = {}; + this.innerApiCalls = {}; } /** @@ -218,7 +221,7 @@ export class CloudBillingClient { ? (this._protos as protobuf.Root).lookupService( 'google.cloud.billing.v1.CloudBilling' ) - : // tslint:disable-next-line no-any + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.billing.v1.CloudBilling, this._opts ) as Promise<{[method: string]: Function}>; @@ -237,9 +240,8 @@ export class CloudBillingClient { 'setIamPolicy', 'testIamPermissions', ]; - for (const methodName of cloudBillingStubMethods) { - const innerCallPromise = this.cloudBillingStub.then( + const callPromise = this.cloudBillingStub.then( stub => (...args: Array<{}>) => { if (this._terminated) { return Promise.reject('The client has already been closed.'); @@ -253,20 +255,14 @@ export class CloudBillingClient { ); const apiCall = this._gaxModule.createApiCall( - innerCallPromise, + callPromise, this._defaults[methodName], - this._descriptors.page[methodName] || - this._descriptors.stream[methodName] || - this._descriptors.longrunning[methodName] + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] ); - this._innerApiCalls[methodName] = ( - argument: {}, - callOptions?: CallOptions, - callback?: APICallback - ) => { - return apiCall(argument, callOptions, callback); - }; + this.innerApiCalls[methodName] = apiCall; } return this.cloudBillingStub; @@ -323,22 +319,34 @@ export class CloudBillingClient { // -- Service calls -- // ------------------- getBillingAccount( - request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest, + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.IBillingAccount, - protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, {} | undefined ] >; getBillingAccount( - request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest, + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, - {} | undefined + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IGetBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getBillingAccount( + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IGetBillingAccountRequest + | null + | undefined, + {} | null | undefined > ): void; /** @@ -358,24 +366,27 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ getBillingAccount( - request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest, + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - | protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IGetBillingAccountRequest + | null | undefined, - {} | undefined + {} | null | undefined >, callback?: Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, - {} | undefined + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IGetBillingAccountRequest + | null + | undefined, + {} | null | undefined > ): Promise< [ - protosTypes.google.cloud.billing.v1.IBillingAccount, - protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, {} | undefined ] > | void { @@ -396,29 +407,37 @@ export class CloudBillingClient { name: request.name || '', }); this.initialize(); - return this._innerApiCalls.getBillingAccount(request, options, callback); + return this.innerApiCalls.getBillingAccount(request, options, callback); } updateBillingAccount( - request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest, + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.IBillingAccount, - ( - | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest - | undefined - ), + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest | undefined, {} | undefined ] >; updateBillingAccount( - request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest, + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest + | null | undefined, - {} | undefined + {} | null | undefined + > + ): void; + updateBillingAccount( + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest + | null + | undefined, + {} | null | undefined > ): void; /** @@ -445,28 +464,27 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ updateBillingAccount( - request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest, + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest + | null | undefined, - {} | undefined + {} | null | undefined >, callback?: Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest + | null | undefined, - {} | undefined + {} | null | undefined > ): Promise< [ - protosTypes.google.cloud.billing.v1.IBillingAccount, - ( - | protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest - | undefined - ), + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest | undefined, {} | undefined ] > | void { @@ -487,29 +505,37 @@ export class CloudBillingClient { name: request.name || '', }); this.initialize(); - return this._innerApiCalls.updateBillingAccount(request, options, callback); + return this.innerApiCalls.updateBillingAccount(request, options, callback); } createBillingAccount( - request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest, + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.IBillingAccount, - ( - | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest - | undefined - ), + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest | undefined, {} | undefined ] >; createBillingAccount( - request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest, + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.ICreateBillingAccountRequest + | null | undefined, - {} | undefined + {} | null | undefined + > + ): void; + createBillingAccount( + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.ICreateBillingAccountRequest + | null + | undefined, + {} | null | undefined > ): void; /** @@ -538,28 +564,27 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ createBillingAccount( - request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest, + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.ICreateBillingAccountRequest + | null | undefined, - {} | undefined + {} | null | undefined >, callback?: Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount, - | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.ICreateBillingAccountRequest + | null | undefined, - {} | undefined + {} | null | undefined > ): Promise< [ - protosTypes.google.cloud.billing.v1.IBillingAccount, - ( - | protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest - | undefined - ), + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest | undefined, {} | undefined ] > | void { @@ -573,29 +598,37 @@ export class CloudBillingClient { } options = options || {}; this.initialize(); - return this._innerApiCalls.createBillingAccount(request, options, callback); + return this.innerApiCalls.createBillingAccount(request, options, callback); } getProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, - ( - | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest - | undefined - ), + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest | undefined, {} | undefined ] >; getProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, - | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | null | undefined, - {} | undefined + {} | null | undefined + > + ): void; + getProjectBillingInfo( + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined > ): void; /** @@ -616,28 +649,27 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ getProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, - | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | null | undefined, - {} | undefined + {} | null | undefined >, callback?: Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, - | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | null | undefined, - {} | undefined + {} | null | undefined > ): Promise< [ - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, - ( - | protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest - | undefined - ), + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest | undefined, {} | undefined ] > | void { @@ -658,33 +690,40 @@ export class CloudBillingClient { name: request.name || '', }); this.initialize(); - return this._innerApiCalls.getProjectBillingInfo( - request, - options, - callback - ); + return this.innerApiCalls.getProjectBillingInfo(request, options, callback); } updateProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IProjectBillingInfo, ( - | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest | undefined ), {} | undefined ] >; updateProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, - | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null | undefined, - {} | undefined + {} | null | undefined + > + ): void; + updateProjectBillingInfo( + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined > ): void; /** @@ -735,26 +774,28 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ updateProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, - | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null | undefined, - {} | undefined + {} | null | undefined >, callback?: Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, - | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null | undefined, - {} | undefined + {} | null | undefined > ): Promise< [ - protosTypes.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IProjectBillingInfo, ( - | protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest | undefined ), {} | undefined @@ -777,29 +818,37 @@ export class CloudBillingClient { name: request.name || '', }); this.initialize(); - return this._innerApiCalls.updateProjectBillingInfo( + return this.innerApiCalls.updateProjectBillingInfo( request, options, callback ); } getIamPolicy( - request: protosTypes.google.iam.v1.IGetIamPolicyRequest, + request: protos.google.iam.v1.IGetIamPolicyRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | undefined, {} | undefined ] >; getIamPolicy( - request: protosTypes.google.iam.v1.IGetIamPolicyRequest, + request: protos.google.iam.v1.IGetIamPolicyRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined + 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; /** @@ -817,23 +866,23 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ getIamPolicy( - request: protosTypes.google.iam.v1.IGetIamPolicyRequest, + request: protos.google.iam.v1.IGetIamPolicyRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined >, callback?: Callback< - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined > ): Promise< [ - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.IGetIamPolicyRequest | undefined, + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | undefined, {} | undefined ] > | void { @@ -854,25 +903,33 @@ export class CloudBillingClient { resource: request.resource || '', }); this.initialize(); - return this._innerApiCalls.getIamPolicy(request, options, callback); + return this.innerApiCalls.getIamPolicy(request, options, callback); } setIamPolicy( - request: protosTypes.google.iam.v1.ISetIamPolicyRequest, + request: protos.google.iam.v1.ISetIamPolicyRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | undefined, {} | undefined ] >; setIamPolicy( - request: protosTypes.google.iam.v1.ISetIamPolicyRequest, + request: protos.google.iam.v1.ISetIamPolicyRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, - {} | undefined + 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; /** @@ -891,23 +948,23 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ setIamPolicy( - request: protosTypes.google.iam.v1.ISetIamPolicyRequest, + request: protos.google.iam.v1.ISetIamPolicyRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, - {} | undefined + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined >, callback?: Callback< - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, - {} | undefined + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined > ): Promise< [ - protosTypes.google.iam.v1.IPolicy, - protosTypes.google.iam.v1.ISetIamPolicyRequest | undefined, + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | undefined, {} | undefined ] > | void { @@ -928,25 +985,33 @@ export class CloudBillingClient { resource: request.resource || '', }); this.initialize(); - return this._innerApiCalls.setIamPolicy(request, options, callback); + return this.innerApiCalls.setIamPolicy(request, options, callback); } testIamPermissions( - request: protosTypes.google.iam.v1.ITestIamPermissionsRequest, + request: protos.google.iam.v1.ITestIamPermissionsRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.iam.v1.ITestIamPermissionsResponse, - protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | undefined, {} | undefined ] >; testIamPermissions( - request: protosTypes.google.iam.v1.ITestIamPermissionsRequest, + request: protos.google.iam.v1.ITestIamPermissionsRequest, options: gax.CallOptions, callback: Callback< - protosTypes.google.iam.v1.ITestIamPermissionsResponse, - protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined + 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; /** @@ -963,23 +1028,23 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ testIamPermissions( - request: protosTypes.google.iam.v1.ITestIamPermissionsRequest, + request: protos.google.iam.v1.ITestIamPermissionsRequest, optionsOrCallback?: | gax.CallOptions | Callback< - protosTypes.google.iam.v1.ITestIamPermissionsResponse, - protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined >, callback?: Callback< - protosTypes.google.iam.v1.ITestIamPermissionsResponse, - protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined > ): Promise< [ - protosTypes.google.iam.v1.ITestIamPermissionsResponse, - protosTypes.google.iam.v1.ITestIamPermissionsRequest | undefined, + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | undefined, {} | undefined ] > | void { @@ -1000,26 +1065,38 @@ export class CloudBillingClient { resource: request.resource || '', }); this.initialize(); - return this._innerApiCalls.testIamPermissions(request, options, callback); + return this.innerApiCalls.testIamPermissions(request, options, callback); } listBillingAccounts( - request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest, + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.IBillingAccount[], - protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, - protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + protos.google.cloud.billing.v1.IBillingAccount[], + protos.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protos.google.cloud.billing.v1.IListBillingAccountsResponse ] >; listBillingAccounts( - request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest, + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, options: gax.CallOptions, - callback: Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount[], - protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, - protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount + > + ): void; + listBillingAccounts( + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount > ): void; /** @@ -1062,24 +1139,28 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ listBillingAccounts( - request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest, + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, optionsOrCallback?: | gax.CallOptions - | Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount[], - protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, - protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + | PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount >, - callback?: Callback< - protosTypes.google.cloud.billing.v1.IBillingAccount[], - protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, - protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount > ): Promise< [ - protosTypes.google.cloud.billing.v1.IBillingAccount[], - protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest | null, - protosTypes.google.cloud.billing.v1.IListBillingAccountsResponse + protos.google.cloud.billing.v1.IBillingAccount[], + protos.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protos.google.cloud.billing.v1.IListBillingAccountsResponse ] > | void { request = request || {}; @@ -1092,7 +1173,7 @@ export class CloudBillingClient { } options = options || {}; this.initialize(); - return this._innerApiCalls.listBillingAccounts(request, options, callback); + return this.innerApiCalls.listBillingAccounts(request, options, callback); } /** @@ -1130,36 +1211,90 @@ export class CloudBillingClient { * An object stream which emits an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} on 'data' event. */ listBillingAccountsStream( - request?: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest, + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, options?: gax.CallOptions ): Transform { request = request || {}; options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); - return this._descriptors.page.listBillingAccounts.createStream( - this._innerApiCalls.listBillingAccounts as gax.GaxCall, + return this.descriptors.page.listBillingAccounts.createStream( + this.innerApiCalls.listBillingAccounts as gax.GaxCall, request, callSettings ); } + + /** + * Equivalent to {@link listBillingAccounts}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listBillingAccountsAsync( + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listBillingAccounts.asyncIterate( + this.innerApiCalls['listBillingAccounts'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } listProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + protos.google.cloud.billing.v1.IProjectBillingInfo[], + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse ] >; listProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, options: gax.CallOptions, - callback: Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo + > + ): void; + listProjectBillingInfo( + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo > ): void; /** @@ -1199,24 +1334,28 @@ export class CloudBillingClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ listProjectBillingInfo( - request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest, + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, optionsOrCallback?: | gax.CallOptions - | Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + | PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo >, - callback?: Callback< - protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo > ): Promise< [ - protosTypes.google.cloud.billing.v1.IProjectBillingInfo[], - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, - protosTypes.google.cloud.billing.v1.IListProjectBillingInfoResponse + protos.google.cloud.billing.v1.IProjectBillingInfo[], + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse ] > | void { request = request || {}; @@ -1236,7 +1375,7 @@ export class CloudBillingClient { name: request.name || '', }); this.initialize(); - return this._innerApiCalls.listProjectBillingInfo( + return this.innerApiCalls.listProjectBillingInfo( request, options, callback @@ -1274,7 +1413,7 @@ export class CloudBillingClient { * An object stream which emits an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} on 'data' event. */ listProjectBillingInfoStream( - request?: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest, + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, options?: gax.CallOptions ): Transform { request = request || {}; @@ -1288,12 +1427,57 @@ export class CloudBillingClient { }); const callSettings = new gax.CallSettings(options); this.initialize(); - return this._descriptors.page.listProjectBillingInfo.createStream( - this._innerApiCalls.listProjectBillingInfo as gax.GaxCall, + return this.descriptors.page.listProjectBillingInfo.createStream( + this.innerApiCalls.listProjectBillingInfo as gax.GaxCall, request, callSettings ); } + + /** + * Equivalent to {@link listProjectBillingInfo}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listProjectBillingInfoAsync( + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listProjectBillingInfo.asyncIterate( + this.innerApiCalls['listProjectBillingInfo'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- @@ -1305,7 +1489,7 @@ export class CloudBillingClient { * @returns {string} Resource name string. */ billingAccountPath(billingAccount: string) { - return this._pathTemplates.billingAccountPathTemplate.render({ + return this.pathTemplates.billingAccountPathTemplate.render({ billing_account: billingAccount, }); } @@ -1318,7 +1502,7 @@ export class CloudBillingClient { * @returns {string} A string representing the billing_account. */ matchBillingAccountFromBillingAccountName(billingAccountName: string) { - return this._pathTemplates.billingAccountPathTemplate.match( + return this.pathTemplates.billingAccountPathTemplate.match( billingAccountName ).billing_account; } @@ -1330,8 +1514,8 @@ export class CloudBillingClient { * @returns {string} Resource name string. */ servicePath(service: string) { - return this._pathTemplates.servicePathTemplate.render({ - service, + return this.pathTemplates.servicePathTemplate.render({ + service: service, }); } @@ -1343,7 +1527,7 @@ export class CloudBillingClient { * @returns {string} A string representing the service. */ matchServiceFromServiceName(serviceName: string) { - return this._pathTemplates.servicePathTemplate.match(serviceName).service; + return this.pathTemplates.servicePathTemplate.match(serviceName).service; } /** @@ -1354,9 +1538,9 @@ export class CloudBillingClient { * @returns {string} Resource name string. */ skuPath(service: string, sku: string) { - return this._pathTemplates.skuPathTemplate.render({ - service, - sku, + return this.pathTemplates.skuPathTemplate.render({ + service: service, + sku: sku, }); } @@ -1368,7 +1552,7 @@ export class CloudBillingClient { * @returns {string} A string representing the service. */ matchServiceFromSkuName(skuName: string) { - return this._pathTemplates.skuPathTemplate.match(skuName).service; + return this.pathTemplates.skuPathTemplate.match(skuName).service; } /** @@ -1379,7 +1563,7 @@ export class CloudBillingClient { * @returns {string} A string representing the sku. */ matchSkuFromSkuName(skuName: string) { - return this._pathTemplates.skuPathTemplate.match(skuName).sku; + return this.pathTemplates.skuPathTemplate.match(skuName).sku; } /** diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index b932e4b7b09..a714061632a 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -18,18 +18,18 @@ import * as gax from 'google-gax'; import { - APICallback, + GaxCall, Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, - PaginationResponse, } from 'google-gax'; import * as path from 'path'; import {Transform} from 'stream'; -import * as protosTypes from '../../protos/protos'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; import * as gapicConfig from './cloud_catalog_client_config.json'; const version = require('../../../package.json').version; @@ -42,14 +42,6 @@ const version = require('../../../package.json').version; * @memberof v1 */ export class CloudCatalogClient { - private _descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - private _innerApiCalls: {[name: string]: Function}; - private _pathTemplates: {[name: string]: gax.PathTemplate}; private _terminated = false; private _opts: ClientOptions; private _gaxModule: typeof gax | typeof gax.fallback; @@ -57,6 +49,14 @@ export class CloudCatalogClient { private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; cloudCatalogStub?: Promise<{[name: string]: Function}>; /** @@ -148,13 +148,16 @@ export class CloudCatalogClient { 'protos.json' ); this._protos = this._gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. - this._pathTemplates = { + this.pathTemplates = { servicePathTemplate: new this._gaxModule.PathTemplate( 'services/{service}' ), @@ -166,7 +169,7 @@ export class CloudCatalogClient { // 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 = { + this.descriptors.page = { listServices: new this._gaxModule.PageDescriptor( 'pageToken', 'nextPageToken', @@ -190,7 +193,7 @@ export class CloudCatalogClient { // 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 = {}; + this.innerApiCalls = {}; } /** @@ -217,7 +220,7 @@ export class CloudCatalogClient { ? (this._protos as protobuf.Root).lookupService( 'google.cloud.billing.v1.CloudCatalog' ) - : // tslint:disable-next-line no-any + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.billing.v1.CloudCatalog, this._opts ) as Promise<{[method: string]: Function}>; @@ -225,9 +228,8 @@ export class CloudCatalogClient { // Iterate over each of the methods that the service provides // and create an API call method for each. const cloudCatalogStubMethods = ['listServices', 'listSkus']; - for (const methodName of cloudCatalogStubMethods) { - const innerCallPromise = this.cloudCatalogStub.then( + const callPromise = this.cloudCatalogStub.then( stub => (...args: Array<{}>) => { if (this._terminated) { return Promise.reject('The client has already been closed.'); @@ -241,20 +243,14 @@ export class CloudCatalogClient { ); const apiCall = this._gaxModule.createApiCall( - innerCallPromise, + callPromise, this._defaults[methodName], - this._descriptors.page[methodName] || - this._descriptors.stream[methodName] || - this._descriptors.longrunning[methodName] + this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] ); - this._innerApiCalls[methodName] = ( - argument: {}, - callOptions?: CallOptions, - callback?: APICallback - ) => { - return apiCall(argument, callOptions, callback); - }; + this.innerApiCalls[methodName] = apiCall; } return this.cloudCatalogStub; @@ -312,22 +308,30 @@ export class CloudCatalogClient { // ------------------- listServices( - request: protosTypes.google.cloud.billing.v1.IListServicesRequest, + request: protos.google.cloud.billing.v1.IListServicesRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.IService[], - protosTypes.google.cloud.billing.v1.IListServicesRequest | null, - protosTypes.google.cloud.billing.v1.IListServicesResponse + protos.google.cloud.billing.v1.IService[], + protos.google.cloud.billing.v1.IListServicesRequest | null, + protos.google.cloud.billing.v1.IListServicesResponse ] >; listServices( - request: protosTypes.google.cloud.billing.v1.IListServicesRequest, + request: protos.google.cloud.billing.v1.IListServicesRequest, options: gax.CallOptions, - callback: Callback< - protosTypes.google.cloud.billing.v1.IService[], - protosTypes.google.cloud.billing.v1.IListServicesRequest | null, - protosTypes.google.cloud.billing.v1.IListServicesResponse + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, + protos.google.cloud.billing.v1.IService + > + ): void; + listServices( + request: protos.google.cloud.billing.v1.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, + protos.google.cloud.billing.v1.IService > ): void; /** @@ -360,24 +364,26 @@ export class CloudCatalogClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ listServices( - request: protosTypes.google.cloud.billing.v1.IListServicesRequest, + request: protos.google.cloud.billing.v1.IListServicesRequest, optionsOrCallback?: | gax.CallOptions - | Callback< - protosTypes.google.cloud.billing.v1.IService[], - protosTypes.google.cloud.billing.v1.IListServicesRequest | null, - protosTypes.google.cloud.billing.v1.IListServicesResponse + | PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + | protos.google.cloud.billing.v1.IListServicesResponse + | null + | undefined, + protos.google.cloud.billing.v1.IService >, - callback?: Callback< - protosTypes.google.cloud.billing.v1.IService[], - protosTypes.google.cloud.billing.v1.IListServicesRequest | null, - protosTypes.google.cloud.billing.v1.IListServicesResponse + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, + protos.google.cloud.billing.v1.IService > ): Promise< [ - protosTypes.google.cloud.billing.v1.IService[], - protosTypes.google.cloud.billing.v1.IListServicesRequest | null, - protosTypes.google.cloud.billing.v1.IListServicesResponse + protos.google.cloud.billing.v1.IService[], + protos.google.cloud.billing.v1.IListServicesRequest | null, + protos.google.cloud.billing.v1.IListServicesResponse ] > | void { request = request || {}; @@ -390,7 +396,7 @@ export class CloudCatalogClient { } options = options || {}; this.initialize(); - return this._innerApiCalls.listServices(request, options, callback); + return this.innerApiCalls.listServices(request, options, callback); } /** @@ -420,36 +426,78 @@ export class CloudCatalogClient { * An object stream which emits an object representing [Service]{@link google.cloud.billing.v1.Service} on 'data' event. */ listServicesStream( - request?: protosTypes.google.cloud.billing.v1.IListServicesRequest, + request?: protos.google.cloud.billing.v1.IListServicesRequest, options?: gax.CallOptions ): Transform { request = request || {}; options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); - return this._descriptors.page.listServices.createStream( - this._innerApiCalls.listServices as gax.GaxCall, + return this.descriptors.page.listServices.createStream( + this.innerApiCalls.listServices as gax.GaxCall, request, callSettings ); } + + /** + * Equivalent to {@link listServices}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listServicesAsync( + request?: protos.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listServices.asyncIterate( + this.innerApiCalls['listServices'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } listSkus( - request: protosTypes.google.cloud.billing.v1.IListSkusRequest, + request: protos.google.cloud.billing.v1.IListSkusRequest, options?: gax.CallOptions ): Promise< [ - protosTypes.google.cloud.billing.v1.ISku[], - protosTypes.google.cloud.billing.v1.IListSkusRequest | null, - protosTypes.google.cloud.billing.v1.IListSkusResponse + protos.google.cloud.billing.v1.ISku[], + protos.google.cloud.billing.v1.IListSkusRequest | null, + protos.google.cloud.billing.v1.IListSkusResponse ] >; listSkus( - request: protosTypes.google.cloud.billing.v1.IListSkusRequest, + request: protos.google.cloud.billing.v1.IListSkusRequest, options: gax.CallOptions, - callback: Callback< - protosTypes.google.cloud.billing.v1.ISku[], - protosTypes.google.cloud.billing.v1.IListSkusRequest | null, - protosTypes.google.cloud.billing.v1.IListSkusResponse + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku + > + ): void; + listSkus( + request: protos.google.cloud.billing.v1.IListSkusRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku > ): void; /** @@ -503,24 +551,24 @@ export class CloudCatalogClient { * The promise has a method named "cancel" which cancels the ongoing API call. */ listSkus( - request: protosTypes.google.cloud.billing.v1.IListSkusRequest, + request: protos.google.cloud.billing.v1.IListSkusRequest, optionsOrCallback?: | gax.CallOptions - | Callback< - protosTypes.google.cloud.billing.v1.ISku[], - protosTypes.google.cloud.billing.v1.IListSkusRequest | null, - protosTypes.google.cloud.billing.v1.IListSkusResponse + | PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku >, - callback?: Callback< - protosTypes.google.cloud.billing.v1.ISku[], - protosTypes.google.cloud.billing.v1.IListSkusRequest | null, - protosTypes.google.cloud.billing.v1.IListSkusResponse + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku > ): Promise< [ - protosTypes.google.cloud.billing.v1.ISku[], - protosTypes.google.cloud.billing.v1.IListSkusRequest | null, - protosTypes.google.cloud.billing.v1.IListSkusResponse + protos.google.cloud.billing.v1.ISku[], + protos.google.cloud.billing.v1.IListSkusRequest | null, + protos.google.cloud.billing.v1.IListSkusResponse ] > | void { request = request || {}; @@ -540,7 +588,7 @@ export class CloudCatalogClient { parent: request.parent || '', }); this.initialize(); - return this._innerApiCalls.listSkus(request, options, callback); + return this.innerApiCalls.listSkus(request, options, callback); } /** @@ -591,7 +639,7 @@ export class CloudCatalogClient { * An object stream which emits an object representing [Sku]{@link google.cloud.billing.v1.Sku} on 'data' event. */ listSkusStream( - request?: protosTypes.google.cloud.billing.v1.IListSkusRequest, + request?: protos.google.cloud.billing.v1.IListSkusRequest, options?: gax.CallOptions ): Transform { request = request || {}; @@ -605,12 +653,74 @@ export class CloudCatalogClient { }); const callSettings = new gax.CallSettings(options); this.initialize(); - return this._descriptors.page.listSkus.createStream( - this._innerApiCalls.listSkus as gax.GaxCall, + return this.descriptors.page.listSkus.createStream( + this.innerApiCalls.listSkus as gax.GaxCall, request, callSettings ); } + + /** + * Equivalent to {@link listSkus}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listSkusAsync( + request?: protos.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listSkus.asyncIterate( + this.innerApiCalls['listSkus'] as GaxCall, + (request as unknown) as RequestType, + callSettings + ) as AsyncIterable; + } // -------------------- // -- Path templates -- // -------------------- @@ -622,8 +732,8 @@ export class CloudCatalogClient { * @returns {string} Resource name string. */ servicePath(service: string) { - return this._pathTemplates.servicePathTemplate.render({ - service, + return this.pathTemplates.servicePathTemplate.render({ + service: service, }); } @@ -635,7 +745,7 @@ export class CloudCatalogClient { * @returns {string} A string representing the service. */ matchServiceFromServiceName(serviceName: string) { - return this._pathTemplates.servicePathTemplate.match(serviceName).service; + return this.pathTemplates.servicePathTemplate.match(serviceName).service; } /** @@ -646,9 +756,9 @@ export class CloudCatalogClient { * @returns {string} Resource name string. */ skuPath(service: string, sku: string) { - return this._pathTemplates.skuPathTemplate.render({ - service, - sku, + return this.pathTemplates.skuPathTemplate.render({ + service: service, + sku: sku, }); } @@ -660,7 +770,7 @@ export class CloudCatalogClient { * @returns {string} A string representing the service. */ matchServiceFromSkuName(skuName: string) { - return this._pathTemplates.skuPathTemplate.match(skuName).service; + return this.pathTemplates.skuPathTemplate.match(skuName).service; } /** @@ -671,7 +781,7 @@ export class CloudCatalogClient { * @returns {string} A string representing the sku. */ matchSkuFromSkuName(skuName: string) { - return this._pathTemplates.skuPathTemplate.match(skuName).sku; + return this.pathTemplates.skuPathTemplate.match(skuName).sku; } /** diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 0a7766ec42b..d83e2f82b70 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,23 +1,5 @@ { - "updateTime": "2020-03-22T11:17:07.647933Z", - "sources": [ - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "0be7105dc52590fa9a24e784052298ae37ce53aa", - "internalRef": "302154871", - "log": "0be7105dc52590fa9a24e784052298ae37ce53aa\nAdd BUILD.bazel file to asset/v1p1beta1\n\nPiperOrigin-RevId: 302154871\n\n6c248fd13e8543f8d22cbf118d978301a9fbe2a8\nAdd missing resource annotations and additional_bindings to dialogflow v2 API.\n\nPiperOrigin-RevId: 302063117\n\n9a3a7f33be9eeacf7b3e98435816b7022d206bd7\nChange the service name from \"chromeos-moblab.googleapis.com\" to \"chromeosmoblab.googleapis.com\"\n\nPiperOrigin-RevId: 302060989\n\n98a339237577e3de26cb4921f75fb5c57cc7a19f\nfeat: devtools/build/v1 publish client library config annotations\n\n* add details field to some of the BuildEvents\n* add final_invocation_id and build_tool_exit_code fields to BuildStatus\n\nPiperOrigin-RevId: 302044087\n\ncfabc98c6bbbb22d1aeaf7612179c0be193b3a13\nfeat: home/graph/v1 publish client library config annotations & comment updates\n\nThis change includes adding the client library configuration annotations, updated proto comments, and some client library configuration files.\n\nPiperOrigin-RevId: 302042647\n\nc8c8c0bd15d082db9546253dbaad1087c7a9782c\nchore: use latest gapic-generator in bazel WORKSPACE.\nincluding the following commits from gapic-generator:\n- feat: take source protos in all sub-packages (#3144)\n\nPiperOrigin-RevId: 301843591\n\ne4daf5202ea31cb2cb6916fdbfa9d6bd771aeb4c\nAdd bazel file for v1 client lib generation\n\nPiperOrigin-RevId: 301802926\n\n275fbcce2c900278d487c33293a3c7e1fbcd3a34\nfeat: pubsub/v1 add an experimental filter field to Subscription\n\nPiperOrigin-RevId: 301661567\n\nf2b18cec51d27c999ad30011dba17f3965677e9c\nFix: UpdateBackupRequest.backup is a resource, not a resource reference - remove annotation.\n\nPiperOrigin-RevId: 301636171\n\n800384063ac93a0cac3a510d41726fa4b2cd4a83\nCloud Billing Budget API v1beta1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301634389\n\n0cc6c146b660db21f04056c3d58a4b752ee445e3\nCloud Billing Budget API v1alpha1\nModified api documentation to include warnings about the new filter field.\n\nPiperOrigin-RevId: 301630018\n\nff2ea00f69065585c3ac0993c8b582af3b6fc215\nFix: Add resource definition for a parent of InspectTemplate which was otherwise missing.\n\nPiperOrigin-RevId: 301623052\n\n55fa441c9daf03173910760191646399338f2b7c\nAdd proto definition for AccessLevel, AccessPolicy, and ServicePerimeter.\n\nPiperOrigin-RevId: 301620844\n\ne7b10591c5408a67cf14ffafa267556f3290e262\nCloud Bigtable Managed Backup service and message proto files.\n\nPiperOrigin-RevId: 301585144\n\nd8e226f702f8ddf92915128c9f4693b63fb8685d\nfeat: Add time-to-live in a queue for builds\n\nPiperOrigin-RevId: 301579876\n\n430375af011f8c7a5174884f0d0e539c6ffa7675\ndocs: add missing closing backtick\n\nPiperOrigin-RevId: 301538851\n\n0e9f1f60ded9ad1c2e725e37719112f5b487ab65\nbazel: Use latest release of gax_java\n\nPiperOrigin-RevId: 301480457\n\n5058c1c96d0ece7f5301a154cf5a07b2ad03a571\nUpdate GAPIC v2 with batching parameters for Logging API\n\nPiperOrigin-RevId: 301443847\n\n64ab9744073de81fec1b3a6a931befc8a90edf90\nFix: Introduce location-based organization/folder/billing-account resources\nChore: Update copyright years\n\nPiperOrigin-RevId: 301373760\n\n23d5f09e670ebb0c1b36214acf78704e2ecfc2ac\nUpdate field_behavior annotations in V1 and V2.\n\nPiperOrigin-RevId: 301337970\n\nb2cf37e7fd62383a811aa4d54d013ecae638851d\nData Catalog V1 API\n\nPiperOrigin-RevId: 301282503\n\n1976b9981e2900c8172b7d34b4220bdb18c5db42\nCloud DLP api update. Adds missing fields to Finding and adds support for hybrid jobs.\n\nPiperOrigin-RevId: 301205325\n\nae78682c05e864d71223ce22532219813b0245ac\nfix: several sample code blocks in comments are now properly indented for markdown\n\nPiperOrigin-RevId: 301185150\n\ndcd171d04bda5b67db13049320f97eca3ace3731\nPublish Media Translation API V1Beta1\n\nPiperOrigin-RevId: 301180096\n\nff1713453b0fbc5a7544a1ef6828c26ad21a370e\nAdd protos and BUILD rules for v1 API.\n\nPiperOrigin-RevId: 301179394\n\n8386761d09819b665b6a6e1e6d6ff884bc8ff781\nfeat: chromeos/modlab publish protos and config for Chrome OS Moblab API.\n\nPiperOrigin-RevId: 300843960\n\nb2e2bc62fab90e6829e62d3d189906d9b79899e4\nUpdates to GCS gRPC API spec:\n\n1. Changed GetIamPolicy and TestBucketIamPermissions to use wrapper messages around google.iam.v1 IAM requests messages, and added CommonRequestParams. This lets us support RequesterPays buckets.\n2. Added a metadata field to GetObjectMediaResponse, to support resuming an object media read safely (by extracting the generation of the object being read, and using it in the resumed read request).\n\nPiperOrigin-RevId: 300817706\n\n7fd916ce12335cc9e784bb9452a8602d00b2516c\nAdd deprecated_collections field for backward-compatiblity in PHP and monolith-generated Python and Ruby clients.\n\nGenerate TopicName class in Java which covers the functionality of both ProjectTopicName and DeletedTopicName. Introduce breaking changes to be fixed by synth.py.\n\nDelete default retry parameters.\n\nRetry codes defs can be deleted once # https://github.com/googleapis/gapic-generator/issues/3137 is fixed.\n\nPiperOrigin-RevId: 300813135\n\n047d3a8ac7f75383855df0166144f891d7af08d9\nfix!: google/rpc refactor ErrorInfo.type to ErrorInfo.reason and comment updates.\n\nPiperOrigin-RevId: 300773211\n\nfae4bb6d5aac52aabe5f0bb4396466c2304ea6f6\nAdding RetryPolicy to pubsub.proto\n\nPiperOrigin-RevId: 300769420\n\n7d569be2928dbd72b4e261bf9e468f23afd2b950\nAdding additional protocol buffer annotations to v3.\n\nPiperOrigin-RevId: 300718800\n\n13942d1a85a337515040a03c5108993087dc0e4f\nAdd logging protos for Recommender v1.\n\nPiperOrigin-RevId: 300689896\n\na1a573c3eecfe2c404892bfa61a32dd0c9fb22b6\nfix: change go package to use cloud.google.com/go/maps\n\nPiperOrigin-RevId: 300661825\n\nc6fbac11afa0c7ab2972d9df181493875c566f77\nfeat: publish documentai/v1beta2 protos\n\nPiperOrigin-RevId: 300656808\n\n5202a9e0d9903f49e900f20fe5c7f4e42dd6588f\nProtos for v1beta1 release of Cloud Security Center Settings API\n\nPiperOrigin-RevId: 300580858\n\n83518e18655d9d4ac044acbda063cc6ecdb63ef8\nAdds gapic.yaml file and BUILD.bazel file.\n\nPiperOrigin-RevId: 300554200\n\n836c196dc8ef8354bbfb5f30696bd3477e8db5e2\nRegenerate recommender v1beta1 gRPC ServiceConfig file for Insights methods.\n\nPiperOrigin-RevId: 300549302\n\n34a5450c591b6be3d6566f25ac31caa5211b2f3f\nIncreases the default timeout from 20s to 30s for MetricService\n\nPiperOrigin-RevId: 300474272\n\n5d8bffe87cd01ba390c32f1714230e5a95d5991d\nfeat: use the latest gapic-generator in WORKSPACE for bazel build.\n\nPiperOrigin-RevId: 300461878\n\nd631c651e3bcfac5d371e8560c27648f7b3e2364\nUpdated the GAPIC configs to include parameters for Backups APIs.\n\nPiperOrigin-RevId: 300443402\n\n678afc7055c1adea9b7b54519f3bdb228013f918\nAdding Game Servers v1beta API.\n\nPiperOrigin-RevId: 300433218\n\n80d2bd2c652a5e213302041b0620aff423132589\nEnable proto annotation and gapic v2 for talent API.\n\nPiperOrigin-RevId: 300393997\n\n85e454be7a353f7fe1bf2b0affb753305785b872\ndocs(google/maps/roads): remove mention of nonexported api\n\nPiperOrigin-RevId: 300367734\n\nbf839ae632e0f263a729569e44be4b38b1c85f9c\nAdding protocol buffer annotations and updated config info for v1 and v2.\n\nPiperOrigin-RevId: 300276913\n\n309b899ca18a4c604bce63882a161d44854da549\nPublish `Backup` APIs and protos.\n\nPiperOrigin-RevId: 300246038\n\neced64c3f122421350b4aca68a28e89121d20db8\nadd PHP client libraries\n\nPiperOrigin-RevId: 300193634\n\n7727af0e39df1ae9ad715895c8576d7b65cf6c6d\nfeat: use the latest gapic-generator and protoc-java-resource-name-plugin in googleapis/WORKSPACE.\n\nPiperOrigin-RevId: 300188410\n\n2a25aa351dd5b5fe14895266aff5824d90ce757b\nBreaking change: remove the ProjectOrTenant resource and its references.\n\nPiperOrigin-RevId: 300182152\n\na499dbb28546379415f51803505cfb6123477e71\nUpdate web risk v1 gapic config and BUILD file.\n\nPiperOrigin-RevId: 300152177\n\n52701da10fec2a5f9796e8d12518c0fe574488fe\nFix: apply appropriate namespace/package options for C#, PHP and Ruby.\n\nPiperOrigin-RevId: 300123508\n\n365c029b8cdb63f7751b92ab490f1976e616105c\nAdd CC targets to the kms protos.\n\nThese are needed by go/tink.\n\nPiperOrigin-RevId: 300038469\n\n4ba9aa8a4a1413b88dca5a8fa931824ee9c284e6\nExpose logo recognition API proto for GA.\n\nPiperOrigin-RevId: 299971671\n\n1c9fc2c9e03dadf15f16b1c4f570955bdcebe00e\nAdding ruby_package option to accessapproval.proto for the Ruby client libraries generation.\n\nPiperOrigin-RevId: 299955924\n\n1cc6f0a7bfb147e6f2ede911d9b01e7a9923b719\nbuild(google/maps/routes): generate api clients\n\nPiperOrigin-RevId: 299955905\n\n29a47c965aac79e3fe8e3314482ca0b5967680f0\nIncrease timeout to 1hr for method `dropRange` in bigtable/admin/v2, which is\nsynced with the timeout setting in gapic_yaml.\n\nPiperOrigin-RevId: 299917154\n\n8f631c4c70a60a9c7da3749511ee4ad432b62898\nbuild(google/maps/roads/v1op): move go to monorepo pattern\n\nPiperOrigin-RevId: 299885195\n\nd66816518844ebbf63504c9e8dfc7133921dd2cd\nbuild(google/maps/roads/v1op): Add bazel build files to generate clients.\n\nPiperOrigin-RevId: 299851148\n\naf7dff701fabe029672168649c62356cf1bb43d0\nAdd LogPlayerReports and LogImpressions to Playable Locations service\n\nPiperOrigin-RevId: 299724050\n\nb6927fca808f38df32a642c560082f5bf6538ced\nUpdate BigQuery Connection API v1beta1 proto: added credential to CloudSqlProperties.\n\nPiperOrigin-RevId: 299503150\n\n91e1fb5ef9829c0c7a64bfa5bde330e6ed594378\nchore: update protobuf (protoc) version to 3.11.2\n\nPiperOrigin-RevId: 299404145\n\n30e36b4bee6749c4799f4fc1a51cc8f058ba167d\nUpdate cloud asset api v1p4beta1.\n\nPiperOrigin-RevId: 299399890\n\nffbb493674099f265693872ae250711b2238090c\nfeat: cloudbuild/v1 add new fields and annotate OUTPUT_OUT fields.\n\nPiperOrigin-RevId: 299397780\n\nbc973a15818e00c19e121959832676e9b7607456\nbazel: Fix broken common dependency\n\nPiperOrigin-RevId: 299397431\n\n71094a343e3b962e744aa49eb9338219537474e4\nchore: bigtable/admin/v2 publish retry config\n\nPiperOrigin-RevId: 299391875\n\n8f488efd7bda33885cb674ddd023b3678c40bd82\nfeat: Migrate logging to GAPIC v2; release new features.\n\nIMPORTANT: This is a breaking change for client libraries\nin all languages.\n\nCommitter: @lukesneeringer, @jskeet\nPiperOrigin-RevId: 299370279\n\n007605bf9ad3a1fd775014ebefbf7f1e6b31ee71\nUpdate API for bigqueryreservation v1beta1.\n- Adds flex capacity commitment plan to CapacityCommitment.\n- Adds methods for getting and updating BiReservations.\n- Adds methods for updating/splitting/merging CapacityCommitments.\n\nPiperOrigin-RevId: 299368059\n\n" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "7e98e1609c91082f4eeb63b530c6468aefd18cfd" - } - } - ], + "updateTime": "2020-03-31T19:17:16.494831Z", "destinations": [ { "client": { diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js index e2595373d29..44b4cebd3a2 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js @@ -16,7 +16,6 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** - /* eslint-disable node/no-missing-require, no-unused-vars */ const billing = require('@google-cloud/billing'); diff --git a/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts b/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts deleted file mode 100644 index b1fe2068293..00000000000 --- a/packages/google-cloud-billing/test/gapic-cloud_billing-v1.ts +++ /dev/null @@ -1,641 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 protosTypes from '../protos/protos'; -import * as assert from 'assert'; -import {describe, it} from 'mocha'; -const cloudbillingModule = require('../src'); - -const FAKE_STATUS_CODE = 1; -class FakeError { - name: string; - message: string; - code: number; - constructor(n: number) { - this.name = 'fakeName'; - this.message = 'fake message'; - this.code = n; - } -} -const error = new FakeError(FAKE_STATUS_CODE); -export interface Callback { - (err: FakeError | null, response?: {} | null): void; -} - -export class Operation { - constructor() {} - promise() {} -} -function mockSimpleGrpcMethod( - expectedRequest: {}, - response: {} | null, - error: FakeError | null -) { - return (actualRequest: {}, options: {}, callback: Callback) => { - assert.deepStrictEqual(actualRequest, expectedRequest); - if (error) { - callback(error); - } else if (response) { - callback(null, response); - } else { - callback(null); - } - }; -} -describe('v1.CloudBillingClient', () => { - it('has servicePath', () => { - const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; - assert(servicePath); - }); - it('has apiEndpoint', () => { - const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; - assert(apiEndpoint); - }); - it('has port', () => { - const port = cloudbillingModule.v1.CloudBillingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - it('should create a client with no option', () => { - const client = new cloudbillingModule.v1.CloudBillingClient(); - assert(client); - }); - it('should create a client with gRPC fallback', () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - fallback: true, - }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudBillingStub, undefined); - await client.initialize(); - assert(client.cloudBillingStub); - }); - it('has close method', () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - describe('getBillingAccount', () => { - it('invokes getBillingAccount without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.getBillingAccount = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.getBillingAccount(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getBillingAccount with error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IGetBillingAccountRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.getBillingAccount = mockSimpleGrpcMethod( - request, - null, - error - ); - client.getBillingAccount(request, (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - describe('updateBillingAccount', () => { - it('invokes updateBillingAccount without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.updateBillingAccount = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.updateBillingAccount(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes updateBillingAccount with error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IUpdateBillingAccountRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.updateBillingAccount = mockSimpleGrpcMethod( - request, - null, - error - ); - client.updateBillingAccount(request, (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - describe('createBillingAccount', () => { - it('invokes createBillingAccount without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest = {}; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.createBillingAccount = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.createBillingAccount(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createBillingAccount with error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.ICreateBillingAccountRequest = {}; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.createBillingAccount = mockSimpleGrpcMethod( - request, - null, - error - ); - client.createBillingAccount(request, (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - describe('getProjectBillingInfo', () => { - it('invokes getProjectBillingInfo without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.getProjectBillingInfo = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.getProjectBillingInfo(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getProjectBillingInfo with error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IGetProjectBillingInfoRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.getProjectBillingInfo = mockSimpleGrpcMethod( - request, - null, - error - ); - client.getProjectBillingInfo(request, (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - describe('updateProjectBillingInfo', () => { - it('invokes updateProjectBillingInfo without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.updateProjectBillingInfo = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.updateProjectBillingInfo(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes updateProjectBillingInfo with error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.updateProjectBillingInfo = mockSimpleGrpcMethod( - request, - null, - error - ); - client.updateProjectBillingInfo( - request, - (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - } - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; - request.resource = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.getIamPolicy = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.getIamPolicy(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getIamPolicy with error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.iam.v1.IGetIamPolicyRequest = {}; - request.resource = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.getIamPolicy = mockSimpleGrpcMethod( - request, - null, - error - ); - client.getIamPolicy(request, (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; - request.resource = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.setIamPolicy = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.setIamPolicy(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes setIamPolicy with error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.iam.v1.ISetIamPolicyRequest = {}; - request.resource = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.setIamPolicy = mockSimpleGrpcMethod( - request, - null, - error - ); - client.setIamPolicy(request, (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; - request.resource = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.testIamPermissions = mockSimpleGrpcMethod( - request, - expectedResponse, - null - ); - client.testIamPermissions(request, (err: {}, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes testIamPermissions with error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.iam.v1.ITestIamPermissionsRequest = {}; - request.resource = ''; - // Mock response - const expectedResponse = {}; - // Mock gRPC layer - client._innerApiCalls.testIamPermissions = mockSimpleGrpcMethod( - request, - null, - error - ); - client.testIamPermissions(request, (err: FakeError, response: {}) => { - assert(err instanceof FakeError); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - describe('listBillingAccounts', () => { - it('invokes listBillingAccounts without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest = {}; - // Mock response - const expectedResponse = {}; - // Mock Grpc layer - client._innerApiCalls.listBillingAccounts = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - client.listBillingAccounts(request, (err: FakeError, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - }); - describe('listBillingAccountsStream', () => { - it('invokes listBillingAccountsStream without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IListBillingAccountsRequest = {}; - // Mock response - const expectedResponse = {response: 'data'}; - // Mock Grpc layer - client._innerApiCalls.listBillingAccounts = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - const stream = client - .listBillingAccountsStream(request, {}) - .on('data', (response: {}) => { - assert.deepStrictEqual(response, expectedResponse); - done(); - }) - .on('error', (err: FakeError) => { - done(err); - }); - stream.write(expectedResponse); - }); - }); - describe('listProjectBillingInfo', () => { - it('invokes listProjectBillingInfo without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {}; - // Mock Grpc layer - client._innerApiCalls.listProjectBillingInfo = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - client.listProjectBillingInfo(request, (err: FakeError, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - }); - describe('listProjectBillingInfoStream', () => { - it('invokes listProjectBillingInfoStream without error', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IListProjectBillingInfoRequest = {}; - request.name = ''; - // Mock response - const expectedResponse = {response: 'data'}; - // Mock Grpc layer - client._innerApiCalls.listProjectBillingInfo = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - const stream = client - .listProjectBillingInfoStream(request, {}) - .on('data', (response: {}) => { - assert.deepStrictEqual(response, expectedResponse); - done(); - }) - .on('error', (err: FakeError) => { - done(err); - }); - stream.write(expectedResponse); - }); - }); -}); diff --git a/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts b/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts deleted file mode 100644 index 9e6d72d13ca..00000000000 --- a/packages/google-cloud-billing/test/gapic-cloud_catalog-v1.ts +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 protosTypes from '../protos/protos'; -import * as assert from 'assert'; -import {describe, it} from 'mocha'; -const cloudcatalogModule = require('../src'); - -const FAKE_STATUS_CODE = 1; -class FakeError { - name: string; - message: string; - code: number; - constructor(n: number) { - this.name = 'fakeName'; - this.message = 'fake message'; - this.code = n; - } -} -const error = new FakeError(FAKE_STATUS_CODE); -export interface Callback { - (err: FakeError | null, response?: {} | null): void; -} - -export class Operation { - constructor() {} - promise() {} -} -describe('v1.CloudCatalogClient', () => { - it('has servicePath', () => { - const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; - assert(servicePath); - }); - it('has apiEndpoint', () => { - const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; - assert(apiEndpoint); - }); - it('has port', () => { - const port = cloudcatalogModule.v1.CloudCatalogClient.port; - assert(port); - assert(typeof port === 'number'); - }); - it('should create a client with no option', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient(); - assert(client); - }); - it('should create a client with gRPC fallback', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - fallback: true, - }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudCatalogStub, undefined); - await client.initialize(); - assert(client.cloudCatalogStub); - }); - it('has close method', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - describe('listServices', () => { - it('invokes listServices without error', done => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IListServicesRequest = {}; - // Mock response - const expectedResponse = {}; - // Mock Grpc layer - client._innerApiCalls.listServices = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - client.listServices(request, (err: FakeError, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - }); - describe('listServicesStream', () => { - it('invokes listServicesStream without error', done => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IListServicesRequest = {}; - // Mock response - const expectedResponse = {response: 'data'}; - // Mock Grpc layer - client._innerApiCalls.listServices = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - const stream = client - .listServicesStream(request, {}) - .on('data', (response: {}) => { - assert.deepStrictEqual(response, expectedResponse); - done(); - }) - .on('error', (err: FakeError) => { - done(err); - }); - stream.write(expectedResponse); - }); - }); - describe('listSkus', () => { - it('invokes listSkus without error', done => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IListSkusRequest = {}; - request.parent = ''; - // Mock response - const expectedResponse = {}; - // Mock Grpc layer - client._innerApiCalls.listSkus = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - client.listSkus(request, (err: FakeError, response: {}) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - }); - describe('listSkusStream', () => { - it('invokes listSkusStream without error', done => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - // Initialize client before mocking - client.initialize(); - // Mock request - const request: protosTypes.google.cloud.billing.v1.IListSkusRequest = {}; - request.parent = ''; - // Mock response - const expectedResponse = {response: 'data'}; - // Mock Grpc layer - client._innerApiCalls.listSkus = ( - actualRequest: {}, - options: {}, - callback: Callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse); - }; - const stream = client - .listSkusStream(request, {}) - .on('data', (response: {}) => { - assert.deepStrictEqual(response, expectedResponse); - done(); - }) - .on('error', (err: FakeError) => { - done(err); - }); - stream.write(expectedResponse); - }); - }); -}); diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts new file mode 100644 index 00000000000..bbe2ebac59a --- /dev/null +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -0,0 +1,1805 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as cloudbillingModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function 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.CloudBillingClient', () => { + it('has servicePath', () => { + const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudbillingModule.v1.CloudBillingClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudbillingModule.v1.CloudBillingClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBillingStub, undefined); + await client.initialize(); + assert(client.cloudBillingStub); + }); + + it('has close method', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbillingModule.v1.CloudBillingClient({ + 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 cloudbillingModule.v1.CloudBillingClient({ + 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('getBillingAccount', () => { + it('invokes getBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.getBillingAccount = stubSimpleCall(expectedResponse); + const [response] = await client.getBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.getBillingAccount = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getBillingAccount( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IBillingAccount | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBillingAccount = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.getBillingAccount(request); + }, expectedError); + assert( + (client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateBillingAccount', () => { + it('invokes updateBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.updateBillingAccount = stubSimpleCall( + expectedResponse + ); + const [response] = await client.updateBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.updateBillingAccount = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateBillingAccount( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IBillingAccount | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBillingAccount = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.updateBillingAccount(request); + }, expectedError); + assert( + (client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createBillingAccount', () => { + it('invokes createBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.CreateBillingAccountRequest() + ); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.createBillingAccount = stubSimpleCall( + expectedResponse + ); + const [response] = await client.createBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.CreateBillingAccountRequest() + ); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.createBillingAccount = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createBillingAccount( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IBillingAccount | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.CreateBillingAccountRequest() + ); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.createBillingAccount = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.createBillingAccount(request); + }, expectedError); + assert( + (client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getProjectBillingInfo', () => { + it('invokes getProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCall( + expectedResponse + ); + const [response] = await client.getProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getProjectBillingInfo( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IProjectBillingInfo | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.getProjectBillingInfo(request); + }, expectedError); + assert( + (client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateProjectBillingInfo', () => { + it('invokes updateProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall( + expectedResponse + ); + const [response] = await client.updateProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateProjectBillingInfo( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IProjectBillingInfo | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.updateProjectBillingInfo(request); + }, expectedError); + assert( + (client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.IPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.getIamPolicy(request); + }, expectedError); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.IPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.setIamPolicy(request); + }, expectedError); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCall( + expectedResponse + ); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.ITestIamPermissionsResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.testIamPermissions(request); + }, expectedError); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listBillingAccounts', () => { + it('invokes listBillingAccounts without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + ]; + client.innerApiCalls.listBillingAccounts = stubSimpleCall( + expectedResponse + ); + const [response] = await client.listBillingAccounts(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listBillingAccounts without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + ]; + client.innerApiCalls.listBillingAccounts = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listBillingAccounts( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IBillingAccount[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listBillingAccounts with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listBillingAccounts = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.listBillingAccounts(request); + }, expectedError); + assert( + (client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listBillingAccountsStream without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + ]; + client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listBillingAccountsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.BillingAccount) => { + 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.listBillingAccounts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBillingAccounts, request) + ); + }); + + it('invokes listBillingAccountsStream with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listBillingAccountsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.BillingAccount) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + assert.rejects(async () => { + await promise; + }, expectedError); + assert( + (client.descriptors.page.listBillingAccounts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBillingAccounts, request) + ); + }); + + it('uses async iteration with listBillingAccounts without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + ]; + client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; + const iterable = client.listBillingAccountsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBillingAccounts + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + }); + + it('uses async iteration with listBillingAccounts with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listBillingAccountsAsync(request); + assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBillingAccounts + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + }); + }); + + describe('listProjectBillingInfo', () => { + it('invokes listProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + ]; + client.innerApiCalls.listProjectBillingInfo = stubSimpleCall( + expectedResponse + ); + const [response] = await client.listProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + ]; + client.innerApiCalls.listProjectBillingInfo = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listProjectBillingInfo( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IProjectBillingInfo[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProjectBillingInfo = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.listProjectBillingInfo(request); + }, expectedError); + assert( + (client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProjectBillingInfoStream without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + ]; + client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listProjectBillingInfoStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { + 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.listProjectBillingInfo + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProjectBillingInfo, request) + ); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('invokes listProjectBillingInfoStream with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listProjectBillingInfoStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + assert.rejects(async () => { + await promise; + }, expectedError); + assert( + (client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProjectBillingInfo, request) + ); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + ]; + client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; + const iterable = client.listProjectBillingInfoAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listProjectBillingInfoAsync(request); + assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('billingAccount', () => { + const fakePath = '/rendered/path/billingAccount'; + const expectedParameters = { + billing_account: 'billingAccountValue', + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.billingAccountPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('billingAccountPath', () => { + const result = client.billingAccountPath('billingAccountValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.billingAccountPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchBillingAccountFromBillingAccountName', () => { + const result = client.matchBillingAccountFromBillingAccountName( + fakePath + ); + assert.strictEqual(result, 'billingAccountValue'); + assert( + (client.pathTemplates.billingAccountPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('service', () => { + const fakePath = '/rendered/path/service'; + const expectedParameters = { + service: 'serviceValue', + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + 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('serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('sku', () => { + const fakePath = '/rendered/path/sku'; + const expectedParameters = { + service: 'serviceValue', + sku: 'skuValue', + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.skuPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.skuPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('skuPath', () => { + const result = client.skuPath('serviceValue', 'skuValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.skuPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchServiceFromSkuName', () => { + const result = client.matchServiceFromSkuName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSkuFromSkuName', () => { + const result = client.matchSkuFromSkuName(fakePath); + assert.strictEqual(result, 'skuValue'); + assert( + (client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts new file mode 100644 index 00000000000..21b625c47f9 --- /dev/null +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -0,0 +1,796 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as cloudcatalogModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function 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.CloudCatalogClient', () => { + it('has servicePath', () => { + const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudcatalogModule.v1.CloudCatalogClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudCatalogStub, undefined); + await client.initialize(); + assert(client.cloudCatalogStub); + }); + + it('has close method', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + 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 cloudcatalogModule.v1.CloudCatalogClient({ + 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('listServices', () => { + it('invokes listServices without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServices as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServices without error using callback', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IService[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServices as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listServices with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall( + undefined, + expectedError + ); + assert.rejects(async () => { + await client.listServices(request); + }, expectedError); + assert( + (client.innerApiCalls.listServices as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServicesStream without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Service[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.Service) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServices, request) + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Service[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.Service) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + assert.rejects(async () => { + await promise; + }, expectedError); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServices, request) + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.billing.v1.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listServicesAsync(request); + assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + }); + }); + + describe('listSkus', () => { + it('invokes listSkus without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.innerApiCalls.listSkus = stubSimpleCall(expectedResponse); + const [response] = await client.listSkus(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listSkus as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listSkus without error using callback', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.innerApiCalls.listSkus = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listSkus( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.ISku[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listSkus as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listSkus with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSkus = stubSimpleCall(undefined, expectedError); + assert.rejects(async () => { + await client.listSkus(request); + }, expectedError); + assert( + (client.innerApiCalls.listSkus as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listSkusStream without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.descriptors.page.listSkus.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listSkusStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Sku[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { + 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.listSkus.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSkus, request) + ); + assert.strictEqual( + (client.descriptors.page.listSkus.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSkusStream with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listSkus.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listSkusStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Sku[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + assert.rejects(async () => { + await promise; + }, expectedError); + assert( + (client.descriptors.page.listSkus.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSkus, request) + ); + assert.strictEqual( + (client.descriptors.page.listSkus.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSkus without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.billing.v1.ISku[] = []; + const iterable = client.listSkusAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSkus with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listSkusAsync(request); + assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.ISku[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('service', () => { + const fakePath = '/rendered/path/service'; + const expectedParameters = { + service: 'serviceValue', + }; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + 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('serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('sku', () => { + const fakePath = '/rendered/path/sku'; + const expectedParameters = { + service: 'serviceValue', + sku: 'skuValue', + }; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.skuPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.skuPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('skuPath', () => { + const result = client.skuPath('serviceValue', 'skuValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.skuPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchServiceFromSkuName', () => { + const result = client.matchServiceFromSkuName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSkuFromSkuName', () => { + const result = client.matchSkuFromSkuName(fakePath); + assert.strictEqual(result, 'skuValue'); + assert( + (client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-billing/webpack.config.js b/packages/google-cloud-billing/webpack.config.js index e4c1e9dff02..21d8795fa42 100644 --- a/packages/google-cloud-billing/webpack.config.js +++ b/packages/google-cloud-billing/webpack.config.js @@ -36,27 +36,27 @@ module.exports = { { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]grpc/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]retry-request/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]gtoken/, - use: 'null-loader' + use: 'null-loader', }, ], }, From 1404996dbdfaf8e4c4b4df69b761f620072ad0c9 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 31 Mar 2020 18:35:18 -0700 Subject: [PATCH 019/169] build: set AUTOSYNTH_MULTIPLE_COMMITS=true for context aware commits (#29) --- packages/google-cloud-billing/synth.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/google-cloud-billing/synth.py b/packages/google-cloud-billing/synth.py index 4acc1c852b9..ab5523c631f 100644 --- a/packages/google-cloud-billing/synth.py +++ b/packages/google-cloud-billing/synth.py @@ -20,6 +20,9 @@ logging.basicConfig(level=logging.DEBUG) +AUTOSYNTH_MULTIPLE_COMMITS = True + + # run the gapic generator name = 'billing' gapic = gcp.GAPICMicrogenerator() From b1c6af668f3d63cac2271ff6cc7973158013425b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 1 Apr 2020 23:34:45 +0200 Subject: [PATCH 020/169] chore(deps): update dependency @types/sinon to v9 (#30) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^7.5.2` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/7.5.2/9.0.0) | --- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index b6189568002..69a01520ca6 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -31,7 +31,7 @@ "devDependencies": { "@types/mocha": "^7.0.0", "@types/node": "^12.0.0", - "@types/sinon": "^7.5.2", + "@types/sinon": "^9.0.0", "c8": "^7.0.0", "eslint": "^6.0.0", "eslint-config-prettier": "^6.0.0", From e4278f9ea3a1ce7e7708ea968119f436c869d0a4 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 2 Apr 2020 15:17:55 -0700 Subject: [PATCH 021/169] chore: linting (#32) --- .../src/v1/cloud_billing_client.ts | 2 +- .../src/v1/cloud_catalog_client.ts | 2 +- packages/google-cloud-billing/synth.metadata | 19 ++++++++++++++++++- .../system-test/fixtures/sample/src/index.ts | 4 ++-- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 9903256b706..ebae9729e81 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -18,12 +18,12 @@ import * as gax from 'google-gax'; import { - GaxCall, Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, + GaxCall, } from 'google-gax'; import * as path from 'path'; diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index a714061632a..b32427443de 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -18,12 +18,12 @@ import * as gax from 'google-gax'; import { - GaxCall, Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, + GaxCall, } from 'google-gax'; import * as path from 'path'; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index d83e2f82b70..d9ec68856cf 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,5 +1,22 @@ { - "updateTime": "2020-03-31T19:17:16.494831Z", + "updateTime": "2020-04-02T11:15:49.576865Z", + "sources": [ + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "75047719f704d61f405cac6d7439637ab36c1232", + "internalRef": "304305096" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "99820243d348191bc9c634f2b48ddf65096285ed" + } + } + ], "destinations": [ { "client": { diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts index 57c9ada62c7..f9b03e70d14 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts @@ -19,8 +19,8 @@ import {CloudBillingClient, CloudCatalogClient} from '@google-cloud/billing'; function main() { - const cloudBillingClient = new CloudBillingClient(); - const cloudCatalogClient = new CloudCatalogClient(); + new CloudBillingClient(); + new CloudCatalogClient(); } main(); From 2949cf9280c852f121f4cbbc4b4ce17e6fbbad55 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 5 Apr 2020 12:46:26 -0700 Subject: [PATCH 022/169] chore: remove duplicate mocha config (#34) --- packages/google-cloud-billing/.mocharc.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 packages/google-cloud-billing/.mocharc.json diff --git a/packages/google-cloud-billing/.mocharc.json b/packages/google-cloud-billing/.mocharc.json deleted file mode 100644 index 670c5e2c24b..00000000000 --- a/packages/google-cloud-billing/.mocharc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} From cbc445ca3f6fb8e143ef1e09cb972166089b80fe Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 7 Apr 2020 00:12:17 -0700 Subject: [PATCH 023/169] fix: export explicit version from protos.js (#33) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/1630485f-7526-4afd-9c13-b5660664d6a2/targets --- packages/google-cloud-billing/protos/protos.js | 2 +- packages/google-cloud-billing/synth.metadata | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index 4ae995e9d2f..de021808788 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -28,7 +28,7 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace - var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + var $root = $protobuf.roots._google_cloud_billing_1_2_0_protos || ($protobuf.roots._google_cloud_billing_1_2_0_protos = {}); $root.google = (function() { diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index d9ec68856cf..f9f7e063b91 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-04-02T11:15:49.576865Z", + "updateTime": "2020-04-03T11:22:59.861735Z", "sources": [ { "git": { From ba1d495139cc982818dae5cf8160599ed94649c7 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 7 Apr 2020 12:16:29 -0700 Subject: [PATCH 024/169] build: new mocha configuration/await assert.rejects (#35) --- packages/google-cloud-billing/.jsdoc.js | 2 +- packages/google-cloud-billing/.mocharc.json | 5 ++++ packages/google-cloud-billing/.prettierrc.js | 2 +- packages/google-cloud-billing/synth.metadata | 10 ++++--- .../test/gapic_cloud_billing_v1.ts | 28 +++++++++---------- .../test/gapic_cloud_catalog_v1.ts | 12 ++++---- 6 files changed, 33 insertions(+), 26 deletions(-) create mode 100644 packages/google-cloud-billing/.mocharc.json diff --git a/packages/google-cloud-billing/.jsdoc.js b/packages/google-cloud-billing/.jsdoc.js index e05890800b6..70028a95946 100644 --- a/packages/google-cloud-billing/.jsdoc.js +++ b/packages/google-cloud-billing/.jsdoc.js @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2019 Google, LLC.', + copyright: 'Copyright 2020 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/billing', diff --git a/packages/google-cloud-billing/.mocharc.json b/packages/google-cloud-billing/.mocharc.json new file mode 100644 index 00000000000..670c5e2c24b --- /dev/null +++ b/packages/google-cloud-billing/.mocharc.json @@ -0,0 +1,5 @@ +{ + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} diff --git a/packages/google-cloud-billing/.prettierrc.js b/packages/google-cloud-billing/.prettierrc.js index 08cba3775be..d1b95106f4c 100644 --- a/packages/google-cloud-billing/.prettierrc.js +++ b/packages/google-cloud-billing/.prettierrc.js @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index f9f7e063b91..daa054da93b 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,19 +1,21 @@ { - "updateTime": "2020-04-03T11:22:59.861735Z", + "updateTime": "2020-04-07T11:57:07.680272Z", "sources": [ { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "75047719f704d61f405cac6d7439637ab36c1232", - "internalRef": "304305096" + "sha": "823facb4ca6a4b36b817ce955a790dcb40cf808f", + "internalRef": "305155214", + "log": "823facb4ca6a4b36b817ce955a790dcb40cf808f\nchore: enable gapicv2 for videointelligence/v1p3beta1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305155214\n\n6b9c969d42bcb0f8206675bd868ed7d1ddcdaef9\nAdd API for bigqueryreservation v1.\n\nPiperOrigin-RevId: 305151484\n\n514f7d27811832a9f58b83d6f6305d894b097cf6\nchore: enable gapicv2 for phishingprotection/v1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305126983\n\nff74d47d47280e6bbcbad1a7c82b1e0959c472ec\nfix: PHP-related fixes in BUILD.bazel and service.yamls\n\nThis PR also adds the rules for all 7 langauges in OsLogin and Kms BUILD.bazel files. Those build files were missing rules for 5 langagues, including PHP.\n\nThis PR is the prerequisite for migrating PHP synth.py scripts from artman to bazel.\n\nThe fixes in service.yaml fix regression made during proto annotation migration. This became visible only during PHP generation, because only PHP depends on the affected sections of the service.yaml config.\n\nPiperOrigin-RevId: 305108224\n\nfdbc7b1f63969307c71143a0c24fdfd02e739df6\nEnable gapicv2 for osconfig/agentendpoint/v1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305086443\n\n1490d30e1ae339570dd7826ba625a603ede91a08\nEnable gapicv2 for osconfig/v1beta\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305069755\n\n7bf824e82e5c3549642b150dc4a9579602000f34\nEnable gapicv2 for iam/credentials/v1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305065283\n\n9ff6fd3b22f99167827e89aae7778408b5e82425\nUpdates Dataproc v1 API:\n- Adds Dataproc Jobs.SubmitJobAsOperation RPC\n- Adds SparkR and Presto job types to WorkflowTemplates\n- Adds new Optional Components\n- Clarifies usage of some APIs\n\nPiperOrigin-RevId: 305053617\n\ncad0f5137a70d0d14a8d9acbfcee98e4cd3e9662\nUpdates to Dataproc v1beta2 API:\n- Adds SparkR and Presto job types to WorkflowTemplates\n- Adds new Optional Components\n- Clarifies usage of some APIs\n\nPiperOrigin-RevId: 305053062\n\na005f045a301535eeb4c4b3fa7bb94eec9d22a8b\nAdd support for Cloud EKM to the Cloud KMS service and resource protos.\n\nPiperOrigin-RevId: 305026790\n\n5077b1e4674afdbbf11dac3f5f43d36285ba53ff\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304836531\n\nd6cb4997910eda04c0c66c0f2fd043eeaa0f660d\nchore: enable gapic v2 and proto annotation for documentai API.\n\ncommitter @summer-ji-eng\n\nPiperOrigin-RevId: 304724866\n\n490bc556608bfa5b1548c9374b06152fa33d657e\nEnable gapicv2 for devtools/remoteworkers/v1test2\n\nCommitter: @miraleung\nPiperOrigin-RevId: 304718691\n\n9f78ce31a5bd7f4a63e3cf0ddf28221557adb7ed\nEnable gapicv2 for managedidentities/v1beta1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 304718676\n\n6e17d259b8e320bc51aa240cefef05ec753e2b83\ndocs: treat a dummy example URL as a string literal instead of a link\n\nPiperOrigin-RevId: 304716376\n\na8d76f99d3073aaccabdcc122c798a63e812c4fe\ndocs: change relative URLs to absolute URLs to fix broken links.\n\nPiperOrigin-RevId: 304702368\n\n65c749bc6a1d240416a0e6979381b67f97aff907\ndocs: fix formatting of some regexes and string literals.\n\nPiperOrigin-RevId: 304701150\n\n9119eefcd2b5ce845a680fa4ec4093ed733498f0\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304698702\n\n62a2a7cc33d3535638d220df238823eefcca930d\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304696461\n\n23848c8f64a5e81a239d6133378468185f1756dc\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304696192\n\n9514fa9e390a4c0715972c5b510cf4c10ad049a1\ndocs: change relative URLs to absolute URLs to fix broken links.\n\nPiperOrigin-RevId: 304695334\n\n0f7b1509a9a452808c3d07fe90fedfcea763d7d5\nfix: change config_schema_version to 2.0.0 for containeranalysis v1 gapic config.\n\ncommitter: @hzyi-google\nPiperOrigin-RevId: 304672648\n\n3d52f3c126fbfc31f067a7f54737b7f0dfbce163\nDialogflow weekly v2 library update:\n- Change `parent` field's resource_reference to specify child_type instead of type per client library generation requirement;\n- Change Session with its child resource pattern to support both projects/{project}/agent/sessions/{session} and projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session};\n- Fix `method_signature`\n- Regular documentation update\n\nImportant updates are also posted at:\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 304635286\n\n4a6a01ce0ead505c245d11a2ce156de34800c58f\ndocs: change a relative URL to an absolute URL to fix broken links.\n\nPiperOrigin-RevId: 304633630\n\n1b969c28a6579265e89cd35e6c2ecacc89970e2d\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304620317\n\n5378173a889f9c7d83e36e52d38a6267190de692\nAdd v1beta2 SubmitJobAsOperation RPC to Dataproc.\n\nPiperOrigin-RevId: 304594381\n\n3d5d228a58bdf875e6147b228db3159010c735ee\nEnable visibility on the GetSnapshot and GetTopicSnapshots methods\n\nPiperOrigin-RevId: 304500143\n\n1346f5c11a0376bc82c5c03259b304de52671518\nRefresh public client library for Cloud Monitoring.\nIncrease default ListTimeSeries deadline to 90s.\n\nPiperOrigin-RevId: 304467075\n\n4a6cfccb4a32cb28db7366295d90078c6af3112f\ndocs: Fix link in monitoring summary description.\n\nPiperOrigin-RevId: 304438717\n\n6e2ea9a4b63a264090f1bd4b5b25766a3f634f3a\nfix: add interface name overrides back to logging gapic config.\n\ncommitter: @hzyi-google\nPiperOrigin-RevId: 304438432\n\n01f3ccbaa66cf3ae4e3b9fd140b1ecfbe54a3ed0\nFix: Add package/namespace options for C#, Ruby and PHP in remaining protos.\n\nPiperOrigin-RevId: 304416658\n\nb89abbf12cd3c086abddcd79adb0a653349f960a\nchore(google/maps): Rename nox.py to noxfile.py\n\nupstream wip fix here: https://github.com/googleapis/gapic-generator/pull/3156\n\nPiperOrigin-RevId: 304411146\n\nbbf26d7f11fae7789b13959bf100983c496c9807\nSynchronize new proto/yaml changes.\n\nPiperOrigin-RevId: 304409906\n\n" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "99820243d348191bc9c634f2b48ddf65096285ed" + "sha": "1df68ed6735ddce6797d0f83641a731c3c3f75b4", + "log": "1df68ed6735ddce6797d0f83641a731c3c3f75b4\nfix: apache license URL (#468)\n\n\nf4a59efa54808c4b958263de87bc666ce41e415f\nfeat: Add discogapic support for GAPICBazel generation (#459)\n\n* feat: Add discogapic support for GAPICBazel generation\n\n* reformat with black\n\n* Rename source repository variable\n\nCo-authored-by: Jeffrey Rennie \n" } } ], diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index bbe2ebac59a..87046296bd1 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -297,7 +297,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.getBillingAccount(request); }, expectedError); assert( @@ -413,7 +413,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.updateBillingAccount(request); }, expectedError); assert( @@ -505,7 +505,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.createBillingAccount(request); }, expectedError); assert( @@ -621,7 +621,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.getProjectBillingInfo(request); }, expectedError); assert( @@ -737,7 +737,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.updateProjectBillingInfo(request); }, expectedError); assert( @@ -851,7 +851,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.getIamPolicy(request); }, expectedError); assert( @@ -965,7 +965,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.setIamPolicy(request); }, expectedError); assert( @@ -1081,7 +1081,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.testIamPermissions(request); }, expectedError); assert( @@ -1189,7 +1189,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.listBillingAccounts(request); }, expectedError); assert( @@ -1277,7 +1277,7 @@ describe('v1.CloudBillingClient', () => { reject(err); }); }); - assert.rejects(async () => { + await assert.rejects(async () => { await promise; }, expectedError); assert( @@ -1338,7 +1338,7 @@ describe('v1.CloudBillingClient', () => { expectedError ); const iterable = client.listBillingAccountsAsync(request); - assert.rejects(async () => { + await assert.rejects(async () => { const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; for await (const resource of iterable) { responses.push(resource!); @@ -1473,7 +1473,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.listProjectBillingInfo(request); }, expectedError); assert( @@ -1573,7 +1573,7 @@ describe('v1.CloudBillingClient', () => { reject(err); }); }); - assert.rejects(async () => { + await assert.rejects(async () => { await promise; }, expectedError); assert( @@ -1653,7 +1653,7 @@ describe('v1.CloudBillingClient', () => { expectedError ); const iterable = client.listProjectBillingInfoAsync(request); - assert.rejects(async () => { + await assert.rejects(async () => { const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; for await (const resource of iterable) { responses.push(resource!); diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index 21b625c47f9..bfed12050b8 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -277,7 +277,7 @@ describe('v1.CloudCatalogClient', () => { undefined, expectedError ); - assert.rejects(async () => { + await assert.rejects(async () => { await client.listServices(request); }, expectedError); assert( @@ -359,7 +359,7 @@ describe('v1.CloudCatalogClient', () => { reject(err); }); }); - assert.rejects(async () => { + await assert.rejects(async () => { await promise; }, expectedError); assert( @@ -414,7 +414,7 @@ describe('v1.CloudCatalogClient', () => { expectedError ); const iterable = client.listServicesAsync(request); - assert.rejects(async () => { + await assert.rejects(async () => { const responses: protos.google.cloud.billing.v1.IService[] = []; for await (const resource of iterable) { responses.push(resource!); @@ -532,7 +532,7 @@ describe('v1.CloudCatalogClient', () => { }; const expectedError = new Error('expected'); client.innerApiCalls.listSkus = stubSimpleCall(undefined, expectedError); - assert.rejects(async () => { + await assert.rejects(async () => { await client.listSkus(request); }, expectedError); assert( @@ -617,7 +617,7 @@ describe('v1.CloudCatalogClient', () => { reject(err); }); }); - assert.rejects(async () => { + await assert.rejects(async () => { await promise; }, expectedError); assert( @@ -686,7 +686,7 @@ describe('v1.CloudCatalogClient', () => { expectedError ); const iterable = client.listSkusAsync(request); - assert.rejects(async () => { + await assert.rejects(async () => { const responses: protos.google.cloud.billing.v1.ISku[] = []; for await (const resource of iterable) { responses.push(resource!); From ba87cbd475d0390b1581df0444799bea3ea267e5 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 10 Apr 2020 20:57:01 +0200 Subject: [PATCH 025/169] chore(deps): update dependency gts to v2.0.0 (#36) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [gts](https://togithub.com/google/gts) | devDependencies | patch | [`2.0.0-alpha.9` -> `2.0.0`](https://renovatebot.com/diffs/npm/gts/2.0.0-alpha.9/2.0.0) | --- ### Release Notes
google/gts ### [`v2.0.0`](https://togithub.com/google/gts/blob/master/CHANGELOG.md#​200-httpswwwgithubcomgooglegtscomparev112v200-2020-04-02) [Compare Source](https://togithub.com/google/gts/compare/39a2705e51b4b6329a70f91f8293a2d7a363bf5d...v2.0.0) ##### ⚠ BREAKING CHANGES ⚠ This is a major rewrite of the tool. Based on community guidance, we've switched from using [tslint](https://palantir.github.io/tslint/) to [eslint](https://eslint.org/). _Please read all of the steps below to upgrade_. ##### Configuring `eslint` With the shift to `eslint`, `gts` now will format and lint JavaScript _as well_ as TypeScript. Upgrading will require a number of manual steps. To format JavaScript and TypeScript, you can run: $ npx gts fix To specify only TypeScript: $ npx gts fix '**/*.ts' ##### Delete `tslint.json` This file is no longer used, and can lead to confusion. ##### Create a `.eslintrc.json` Now that we're using eslint, you need to extend the eslint configuration baked into the module. Create a new file named `.eslintrc.json`, and paste the following: ```js { "extends": "./node_modules/gts" } ``` ##### Create a `.eslintignore` The `.eslintignore` file lets you ignore specific directories. This tool now lints and formats JavaScript, so it's _really_ important to ignore your build directory! Here is an example of a `.eslintignore` file: **/node_modules build/ ##### Rule changes The underlying linter was changed, so naturally there are going to be a variety of rule changes along the way. To see the full list, check out [.eslintrc.json](https://togithub.com/google/gts/blob/master/.eslintrc.json). ##### Require Node.js 10.x and up Node.js 8.x is now end of life - this module now requires Ndoe.js 10.x and up. ##### Features - add the eol-last rule ([#​425](https://www.github.com/google/gts/issues/425)) ([50ebd4d](https://www.github.com/google/gts/commit/50ebd4dbaf063615f4c025f567ca28076a734223)) - allow eslintrc to run over tsx files ([#​469](https://www.github.com/google/gts/issues/469)) ([a21db94](https://www.github.com/google/gts/commit/a21db94601def563952d677cb0980a12b6730f4c)) - disable global rule for checking TODO comments ([#​459](https://www.github.com/google/gts/issues/459)) ([96aa84a](https://www.github.com/google/gts/commit/96aa84a0a42181046daa248750cc8fef0c320619)) - override require-atomic-updates ([#​468](https://www.github.com/google/gts/issues/468)) ([8105c93](https://www.github.com/google/gts/commit/8105c9334ee5104b05f6b1b2f150e51419637262)) - prefer single quotes if possible ([#​475](https://www.github.com/google/gts/issues/475)) ([39a2705](https://www.github.com/google/gts/commit/39a2705e51b4b6329a70f91f8293a2d7a363bf5d)) - use eslint instead of tslint ([#​400](https://www.github.com/google/gts/issues/400)) ([b3096fb](https://www.github.com/google/gts/commit/b3096fbd5076d302d93c2307bf627e12c423e726)) ##### Bug Fixes - use .prettierrc.js ([#​437](https://www.github.com/google/gts/issues/437)) ([06efa84](https://www.github.com/google/gts/commit/06efa8444cdf1064b64f3e8d61ebd04f45d90b4c)) - **deps:** update dependency chalk to v4 ([#​477](https://www.github.com/google/gts/issues/477)) ([061d64e](https://www.github.com/google/gts/commit/061d64e29d37b93ce55228937cc100e05ddef352)) - **deps:** update dependency eslint-plugin-node to v11 ([#​426](https://www.github.com/google/gts/issues/426)) ([a394b7c](https://www.github.com/google/gts/commit/a394b7c1f80437f25017ca5c500b968ebb789ece)) - **deps:** update dependency execa to v4 ([#​427](https://www.github.com/google/gts/issues/427)) ([f42ef36](https://www.github.com/google/gts/commit/f42ef36709251553342e655e287e889df72ee3e3)) - **deps:** update dependency prettier to v2 ([#​464](https://www.github.com/google/gts/issues/464)) ([20ef43d](https://www.github.com/google/gts/commit/20ef43d566df17d3c93949ef7db3b72ee9123ca3)) - disable no-use-before-define ([#​431](https://www.github.com/google/gts/issues/431)) ([dea2c22](https://www.github.com/google/gts/commit/dea2c223d1d3a60a1786aa820eebb93be27016a7)) - **deps:** update dependency update-notifier to v4 ([#​403](https://www.github.com/google/gts/issues/403)) ([57393b7](https://www.github.com/google/gts/commit/57393b74c6cf299e8ae09311f0382226b8baa3e3)) - **deps:** upgrade to meow 6.x ([#​423](https://www.github.com/google/gts/issues/423)) ([8f93d00](https://www.github.com/google/gts/commit/8f93d0049337a832d9a22b6ae4e86fd41140ec56)) - align back to the google style guide ([#​440](https://www.github.com/google/gts/issues/440)) ([8bd78c4](https://www.github.com/google/gts/commit/8bd78c4c78526a72400f618a95a987d2a7c1a8db)) - disable empty-function check ([#​467](https://www.github.com/google/gts/issues/467)) ([6455d7a](https://www.github.com/google/gts/commit/6455d7a9d227320d3ffe1b00c9c739b846f339a8)) - drop support for node 8 ([#​422](https://www.github.com/google/gts/issues/422)) ([888c686](https://www.github.com/google/gts/commit/888c68692079065f38ce66ec84472f1f3311a050)) - emit .prettierrc.js with init ([#​462](https://www.github.com/google/gts/issues/462)) ([b114614](https://www.github.com/google/gts/commit/b114614d22ab5560d2d1dd5cb6695968cc80027b)) - enable trailing comma ([#​470](https://www.github.com/google/gts/issues/470)) ([6518f58](https://www.github.com/google/gts/commit/6518f5843d3093e3beb7d3371b56d9aecedf3924)) - include _.tsx and _.jsx in default fix command ([#​473](https://www.github.com/google/gts/issues/473)) ([0509780](https://www.github.com/google/gts/commit/050978005ad089d9b3b5d8895b25ea1175d75db2)) ##### [1.1.2](https://www.github.com/google/gts/compare/v1.1.1...v1.1.2) (2019-11-20) ##### Bug Fixes - **deps:** update to newest prettier (with support for optional chain) ([#​396](https://www.github.com/google/gts/issues/396)) ([ce8ad06](https://www.github.com/google/gts/commit/ce8ad06c8489c44a9e2ed5292382637b3ebb7601)) ##### [1.1.1](https://www.github.com/google/gts/compare/v1.1.0...v1.1.1) (2019-11-11) ##### Bug Fixes - **deps:** update dependency chalk to v3 ([#​389](https://www.github.com/google/gts/issues/389)) ([1ce0f45](https://www.github.com/google/gts/commit/1ce0f450677e143a27efc39def617d13c66503e8)) - **deps:** update dependency inquirer to v7 ([#​377](https://www.github.com/google/gts/issues/377)) ([bf2c349](https://www.github.com/google/gts/commit/bf2c349b2208ac63e551542599ac9cd27b461338)) - **deps:** update dependency rimraf to v3 ([#​374](https://www.github.com/google/gts/issues/374)) ([2058eaa](https://www.github.com/google/gts/commit/2058eaa682f4baae978b469fd708d1f866e7da74)) - **deps:** update dependency write-file-atomic to v3 ([#​353](https://www.github.com/google/gts/issues/353)) ([59e6aa8](https://www.github.com/google/gts/commit/59e6aa8580a2f8e9457d2d2b6fa9e18e86347592))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 69a01520ca6..cc7d7af25ca 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -37,7 +37,7 @@ "eslint-config-prettier": "^6.0.0", "eslint-plugin-node": "^11.0.0", "eslint-plugin-prettier": "^3.0.1", - "gts": "2.0.0-alpha.9", + "gts": "2.0.0", "jsdoc": "^3.5.5", "jsdoc-fresh": "^1.0.1", "jsdoc-region-tag": "^1.0.2", From 0d6621b0e66d0b6c7686198e1e66233a15156693 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Fri, 10 Apr 2020 18:48:09 -0700 Subject: [PATCH 026/169] fix: remove eslint, update gax, fix generated protos, run the generator (#37) Run the latest version of the generator, update google-gax, update gts, and remove direct dependencies on eslint. --- packages/google-cloud-billing/package.json | 14 +++++--------- packages/google-cloud-billing/synth.metadata | 15 +++------------ packages/google-cloud-billing/synth.py | 3 ++- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index cc7d7af25ca..5dabca7078e 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -16,9 +16,9 @@ "compile-protos": "compileProtos src", "docs": "jsdoc -c .jsdoc.js", "docs-test": "linkinator docs", - "fix": "gts fix && eslint samples --fix", - "lint": "gts check && eslint samples", - "prelint": "cd samples; npm link ../; npm i", + "fix": "gts fix", + "lint": "gts fix", + "prelint": "cd samples; npm link ../; npm install", "predocs-test": "npm run docs", "prepare": "npm run compile-protos && npm run compile", "system-test": "c8 mocha build/system-test", @@ -26,18 +26,14 @@ "samples-test": "cd samples/ && npm link ../ && npm test && cd ../" }, "dependencies": { - "google-gax": "^2.0.1" + "google-gax": "^2.1.0" }, "devDependencies": { "@types/mocha": "^7.0.0", "@types/node": "^12.0.0", "@types/sinon": "^9.0.0", "c8": "^7.0.0", - "eslint": "^6.0.0", - "eslint-config-prettier": "^6.0.0", - "eslint-plugin-node": "^11.0.0", - "eslint-plugin-prettier": "^3.0.1", - "gts": "2.0.0", + "gts": "^2.0.0", "jsdoc": "^3.5.5", "jsdoc-fresh": "^1.0.1", "jsdoc-region-tag": "^1.0.2", diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index daa054da93b..eec75c1f8cf 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,21 +1,12 @@ { - "updateTime": "2020-04-07T11:57:07.680272Z", + "updateTime": "2020-04-10T23:58:45.212942Z", "sources": [ - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "823facb4ca6a4b36b817ce955a790dcb40cf808f", - "internalRef": "305155214", - "log": "823facb4ca6a4b36b817ce955a790dcb40cf808f\nchore: enable gapicv2 for videointelligence/v1p3beta1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305155214\n\n6b9c969d42bcb0f8206675bd868ed7d1ddcdaef9\nAdd API for bigqueryreservation v1.\n\nPiperOrigin-RevId: 305151484\n\n514f7d27811832a9f58b83d6f6305d894b097cf6\nchore: enable gapicv2 for phishingprotection/v1beta1 API\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305126983\n\nff74d47d47280e6bbcbad1a7c82b1e0959c472ec\nfix: PHP-related fixes in BUILD.bazel and service.yamls\n\nThis PR also adds the rules for all 7 langauges in OsLogin and Kms BUILD.bazel files. Those build files were missing rules for 5 langagues, including PHP.\n\nThis PR is the prerequisite for migrating PHP synth.py scripts from artman to bazel.\n\nThe fixes in service.yaml fix regression made during proto annotation migration. This became visible only during PHP generation, because only PHP depends on the affected sections of the service.yaml config.\n\nPiperOrigin-RevId: 305108224\n\nfdbc7b1f63969307c71143a0c24fdfd02e739df6\nEnable gapicv2 for osconfig/agentendpoint/v1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305086443\n\n1490d30e1ae339570dd7826ba625a603ede91a08\nEnable gapicv2 for osconfig/v1beta\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305069755\n\n7bf824e82e5c3549642b150dc4a9579602000f34\nEnable gapicv2 for iam/credentials/v1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 305065283\n\n9ff6fd3b22f99167827e89aae7778408b5e82425\nUpdates Dataproc v1 API:\n- Adds Dataproc Jobs.SubmitJobAsOperation RPC\n- Adds SparkR and Presto job types to WorkflowTemplates\n- Adds new Optional Components\n- Clarifies usage of some APIs\n\nPiperOrigin-RevId: 305053617\n\ncad0f5137a70d0d14a8d9acbfcee98e4cd3e9662\nUpdates to Dataproc v1beta2 API:\n- Adds SparkR and Presto job types to WorkflowTemplates\n- Adds new Optional Components\n- Clarifies usage of some APIs\n\nPiperOrigin-RevId: 305053062\n\na005f045a301535eeb4c4b3fa7bb94eec9d22a8b\nAdd support for Cloud EKM to the Cloud KMS service and resource protos.\n\nPiperOrigin-RevId: 305026790\n\n5077b1e4674afdbbf11dac3f5f43d36285ba53ff\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304836531\n\nd6cb4997910eda04c0c66c0f2fd043eeaa0f660d\nchore: enable gapic v2 and proto annotation for documentai API.\n\ncommitter @summer-ji-eng\n\nPiperOrigin-RevId: 304724866\n\n490bc556608bfa5b1548c9374b06152fa33d657e\nEnable gapicv2 for devtools/remoteworkers/v1test2\n\nCommitter: @miraleung\nPiperOrigin-RevId: 304718691\n\n9f78ce31a5bd7f4a63e3cf0ddf28221557adb7ed\nEnable gapicv2 for managedidentities/v1beta1\n\nCommitter: @miraleung\nPiperOrigin-RevId: 304718676\n\n6e17d259b8e320bc51aa240cefef05ec753e2b83\ndocs: treat a dummy example URL as a string literal instead of a link\n\nPiperOrigin-RevId: 304716376\n\na8d76f99d3073aaccabdcc122c798a63e812c4fe\ndocs: change relative URLs to absolute URLs to fix broken links.\n\nPiperOrigin-RevId: 304702368\n\n65c749bc6a1d240416a0e6979381b67f97aff907\ndocs: fix formatting of some regexes and string literals.\n\nPiperOrigin-RevId: 304701150\n\n9119eefcd2b5ce845a680fa4ec4093ed733498f0\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304698702\n\n62a2a7cc33d3535638d220df238823eefcca930d\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304696461\n\n23848c8f64a5e81a239d6133378468185f1756dc\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304696192\n\n9514fa9e390a4c0715972c5b510cf4c10ad049a1\ndocs: change relative URLs to absolute URLs to fix broken links.\n\nPiperOrigin-RevId: 304695334\n\n0f7b1509a9a452808c3d07fe90fedfcea763d7d5\nfix: change config_schema_version to 2.0.0 for containeranalysis v1 gapic config.\n\ncommitter: @hzyi-google\nPiperOrigin-RevId: 304672648\n\n3d52f3c126fbfc31f067a7f54737b7f0dfbce163\nDialogflow weekly v2 library update:\n- Change `parent` field's resource_reference to specify child_type instead of type per client library generation requirement;\n- Change Session with its child resource pattern to support both projects/{project}/agent/sessions/{session} and projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session};\n- Fix `method_signature`\n- Regular documentation update\n\nImportant updates are also posted at:\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 304635286\n\n4a6a01ce0ead505c245d11a2ce156de34800c58f\ndocs: change a relative URL to an absolute URL to fix broken links.\n\nPiperOrigin-RevId: 304633630\n\n1b969c28a6579265e89cd35e6c2ecacc89970e2d\nchore: set Ruby namespace in proto options\n\nPiperOrigin-RevId: 304620317\n\n5378173a889f9c7d83e36e52d38a6267190de692\nAdd v1beta2 SubmitJobAsOperation RPC to Dataproc.\n\nPiperOrigin-RevId: 304594381\n\n3d5d228a58bdf875e6147b228db3159010c735ee\nEnable visibility on the GetSnapshot and GetTopicSnapshots methods\n\nPiperOrigin-RevId: 304500143\n\n1346f5c11a0376bc82c5c03259b304de52671518\nRefresh public client library for Cloud Monitoring.\nIncrease default ListTimeSeries deadline to 90s.\n\nPiperOrigin-RevId: 304467075\n\n4a6cfccb4a32cb28db7366295d90078c6af3112f\ndocs: Fix link in monitoring summary description.\n\nPiperOrigin-RevId: 304438717\n\n6e2ea9a4b63a264090f1bd4b5b25766a3f634f3a\nfix: add interface name overrides back to logging gapic config.\n\ncommitter: @hzyi-google\nPiperOrigin-RevId: 304438432\n\n01f3ccbaa66cf3ae4e3b9fd140b1ecfbe54a3ed0\nFix: Add package/namespace options for C#, Ruby and PHP in remaining protos.\n\nPiperOrigin-RevId: 304416658\n\nb89abbf12cd3c086abddcd79adb0a653349f960a\nchore(google/maps): Rename nox.py to noxfile.py\n\nupstream wip fix here: https://github.com/googleapis/gapic-generator/pull/3156\n\nPiperOrigin-RevId: 304411146\n\nbbf26d7f11fae7789b13959bf100983c496c9807\nSynchronize new proto/yaml changes.\n\nPiperOrigin-RevId: 304409906\n\n" - } - }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1df68ed6735ddce6797d0f83641a731c3c3f75b4", - "log": "1df68ed6735ddce6797d0f83641a731c3c3f75b4\nfix: apache license URL (#468)\n\n\nf4a59efa54808c4b958263de87bc666ce41e415f\nfeat: Add discogapic support for GAPICBazel generation (#459)\n\n* feat: Add discogapic support for GAPICBazel generation\n\n* reformat with black\n\n* Rename source repository variable\n\nCo-authored-by: Jeffrey Rennie \n" + "sha": "6f32150677c9784f3c3a7e1949472bd29c9d72c5", + "log": "6f32150677c9784f3c3a7e1949472bd29c9d72c5\nfix: installs test_utils from its common repo (#480)\n\n\n74ce986d3b5431eb66985e9a00c4eb45295a4020\nfix: stop recording update_time in synth.metadata (#478)\n\n\n7f8e62aa3edd225f76347a16f92e400661fdfb52\nchore(java): release-please only updates non maven versions in README (#476)\n\nPrevent release-please and synthtool from fighting over the released library version. Synthtool updates the install snippets from the samples pom.xml files so the bots fight if they are temporarily out of sync after a release.\nc7e0e517d7f46f77bebd27da2e5afcaa6eee7e25\nbuild(java): fix nightly integration test config to run integrations (#465)\n\nThis was only running the units.\nbd69a2aa7b70875f3c988e269706b22fefbef40e\nbuild(java): fix retry_with_backoff when -e option set (#475)\n\n\nd9b173c427bfa0c6cca818233562e7e8841a357c\nfix: record version of working repo in synth.metadata (#473)\n\nPartial revert of b37cf74d12e9a42b9de9e61a4f26133d7cd9c168.\nf73a541770d95a609e5be6bf6b3b220d17cefcbe\nfeat(discogapic): allow local discovery-artifact-manager (#474)\n\n\n8cf0f5d93a70c3dcb0b4999d3152c46d4d9264bf\ndoc: describe the Autosynth & Synthtool protocol (#472)\n\n* doc: describe the Autosynth & Synthtool protocol\n\n* Accommodate review comments.\n980baaa738a1ad8fa02b4fdbd56be075ee77ece5\nfix: pin sphinx to <3.0.0 as new version causes new error (#471)\n\nThe error `toctree contains reference to document changlelog that doesn't have a title: no link will be generated` occurs as of 3.0.0. Pinning to 2.x until we address the docs build issue.\n\nTowards #470\n\nI did this manually for python-datastore https://github.com/googleapis/python-datastore/pull/22\n928b2998ac5023e7c7e254ab935f9ef022455aad\nchore(deps): update dependency com.google.cloud.samples:shared-configuration to v1.0.15 (#466)\n\nCo-authored-by: Jeffrey Rennie \n188f1b1d53181f739b98f8aa5d40cfe99eb90c47\nfix: allow local and external deps to be specified (#469)\n\nModify noxfile.py to allow local and external dependencies for\nsystem tests to be specified.\n" } } ], diff --git a/packages/google-cloud-billing/synth.py b/packages/google-cloud-billing/synth.py index ab5523c631f..8698087182f 100644 --- a/packages/google-cloud-billing/synth.py +++ b/packages/google-cloud-billing/synth.py @@ -46,4 +46,5 @@ # Node.js specific cleanup subprocess.run(['npm', 'install']) -subprocess.run(['npm', 'run', 'fix']) +subprocess.run(['npm', 'run', 'lint']) +subprocess.run(['npx', 'compileProtos', 'src']) From a153abe93ba3ca829f16a86cfd44a27ffcfb0501 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sat, 11 Apr 2020 19:20:24 -0700 Subject: [PATCH 027/169] build: remove unused codecov config (#38) --- packages/google-cloud-billing/codecov.yaml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 packages/google-cloud-billing/codecov.yaml diff --git a/packages/google-cloud-billing/codecov.yaml b/packages/google-cloud-billing/codecov.yaml deleted file mode 100644 index 5724ea9478d..00000000000 --- a/packages/google-cloud-billing/codecov.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -codecov: - ci: - - source.cloud.google.com From ca147337a1610c9afb868d386b40306e167b5465 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 13 Apr 2020 14:58:31 -0700 Subject: [PATCH 028/169] chore: update lint ignore files (#39) --- packages/google-cloud-billing/.eslintignore | 3 ++- packages/google-cloud-billing/.prettierignore | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-billing/.eslintignore b/packages/google-cloud-billing/.eslintignore index 09b31fe735a..9340ad9b86d 100644 --- a/packages/google-cloud-billing/.eslintignore +++ b/packages/google-cloud-billing/.eslintignore @@ -1,5 +1,6 @@ **/node_modules -src/**/doc/* +**/coverage +test/fixtures build/ docs/ protos/ diff --git a/packages/google-cloud-billing/.prettierignore b/packages/google-cloud-billing/.prettierignore index f6fac98b0a8..9340ad9b86d 100644 --- a/packages/google-cloud-billing/.prettierignore +++ b/packages/google-cloud-billing/.prettierignore @@ -1,3 +1,6 @@ -node_modules/* -samples/node_modules/* -src/**/doc/* +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ From b5cbc95fdceab8667e7813a4e4aa81fe707adcb3 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 13 Apr 2020 19:29:18 -0700 Subject: [PATCH 029/169] chore: remove tslint.json (#40) --- packages/google-cloud-billing/tslint.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 packages/google-cloud-billing/tslint.json diff --git a/packages/google-cloud-billing/tslint.json b/packages/google-cloud-billing/tslint.json deleted file mode 100644 index 617dc975bae..00000000000 --- a/packages/google-cloud-billing/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "gts/tslint.json" -} From 32f9b7eaf6c53b133bbfecc4aae56bb3ba5910bb Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Tue, 14 Apr 2020 09:56:12 -0700 Subject: [PATCH 030/169] chore: remove unused dev packages (#41) --- packages/google-cloud-billing/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 5dabca7078e..8402715657e 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -41,7 +41,6 @@ "mocha": "^7.0.0", "null-loader": "^3.0.0", "pack-n-play": "^1.0.0-2", - "prettier": "^1.17.0", "sinon": "^9.0.1", "ts-loader": "^6.2.1", "typescript": "^3.8.3", From 1dc2c5eb20bf65735a9487775541e32e0f693fb8 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 15 Apr 2020 17:32:19 +0200 Subject: [PATCH 031/169] chore(deps): update dependency ts-loader to v7 (#42) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-loader](https://togithub.com/TypeStrong/ts-loader) | devDependencies | major | [`^6.2.1` -> `^7.0.0`](https://renovatebot.com/diffs/npm/ts-loader/6.2.2/7.0.0) | --- ### Release Notes
TypeStrong/ts-loader ### [`v7.0.0`](https://togithub.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md#v700) [Compare Source](https://togithub.com/TypeStrong/ts-loader/compare/v6.2.2...v7.0.0) - [Project reference support enhancements](https://togithub.com/TypeStrong/ts-loader/pull/1076) - thanks [@​sheetalkamat](https://togithub.com/sheetalkamat)! - Following the end of life of Node 8, `ts-loader` no longer supports Node 8 **BREAKING CHANGE**
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 8402715657e..b7c36edccd1 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -42,7 +42,7 @@ "null-loader": "^3.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^9.0.1", - "ts-loader": "^6.2.1", + "ts-loader": "^7.0.0", "typescript": "^3.8.3", "webpack": "^4.41.2", "webpack-cli": "^3.3.10" From 429a10fb5ff6ff093d588b437a5f5e14eb08b1d7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 15 Apr 2020 18:31:39 +0200 Subject: [PATCH 032/169] chore(deps): update dependency null-loader to v4 (#44) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [null-loader](https://togithub.com/webpack-contrib/null-loader) | devDependencies | major | [`^3.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/null-loader/3.0.0/4.0.0) | --- ### Release Notes
webpack-contrib/null-loader ### [`v4.0.0`](https://togithub.com/webpack-contrib/null-loader/blob/master/CHANGELOG.md#​400-httpsgithubcomwebpack-contribnull-loadercomparev300v400-2020-04-15) [Compare Source](https://togithub.com/webpack-contrib/null-loader/compare/v3.0.0...v4.0.0) ##### Bug Fixes - support `webpack@5` ##### ⚠ BREAKING CHANGES - minimum required Nodejs version is `10.13`
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index b7c36edccd1..fc4b6074126 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -39,7 +39,7 @@ "jsdoc-region-tag": "^1.0.2", "linkinator": "^2.0.0", "mocha": "^7.0.0", - "null-loader": "^3.0.0", + "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^9.0.1", "ts-loader": "^7.0.0", From 18f40c60e016fa3a141966a7ec9fb8a0274dfbf3 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Wed, 15 Apr 2020 10:32:12 -0700 Subject: [PATCH 033/169] chore: run fix instead of lint in synthfile (#45) --- packages/google-cloud-billing/synth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/synth.py b/packages/google-cloud-billing/synth.py index 8698087182f..6198d7dd0ba 100644 --- a/packages/google-cloud-billing/synth.py +++ b/packages/google-cloud-billing/synth.py @@ -46,5 +46,5 @@ # Node.js specific cleanup subprocess.run(['npm', 'install']) -subprocess.run(['npm', 'run', 'lint']) +subprocess.run(['npm', 'run', 'fix']) subprocess.run(['npx', 'compileProtos', 'src']) From 180b15ae930deeb0d543f4b29624933b79ee2652 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 20 Apr 2020 16:07:40 -0700 Subject: [PATCH 034/169] chore: linting (#46) --- packages/google-cloud-billing/src/index.ts | 2 +- .../src/v1/cloud_billing_client.ts | 1727 +++++----- .../src/v1/cloud_catalog_client.ts | 722 ++-- packages/google-cloud-billing/src/v1/index.ts | 3 +- packages/google-cloud-billing/synth.metadata | 19 +- .../system-test/fixtures/sample/src/index.js | 1 + .../system-test/install.ts | 28 +- .../test/gapic_cloud_billing_v1.ts | 2905 +++++++---------- .../test/gapic_cloud_catalog_v1.ts | 1264 ++++--- .../google-cloud-billing/webpack.config.js | 12 +- 10 files changed, 2874 insertions(+), 3809 deletions(-) diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index 41db5b4968b..524fece4c86 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -22,4 +22,4 @@ const CloudCatalogClient = v1.CloudCatalogClient; export {v1, CloudBillingClient, CloudCatalogClient}; export default {v1, CloudBillingClient, CloudCatalogClient}; import * as protos from '../protos/protos'; -export {protos}; +export {protos} diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index ebae9729e81..c4fcb547bfd 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -17,18 +17,11 @@ // ** All changes to this file may be overwritten. ** import * as gax from 'google-gax'; -import { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, -} from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; import * as path from 'path'; -import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import * as gapicConfig from './cloud_billing_client_config.json'; @@ -47,12 +40,7 @@ export class CloudBillingClient { private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; + descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}, batching: {}}; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; cloudBillingStub?: Promise<{[name: string]: Function}>; @@ -86,12 +74,10 @@ export class CloudBillingClient { constructor(opts?: ClientOptions) { // Ensure that options include the service address and port. const staticMembers = this.constructor as typeof CloudBillingClient; - const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; + const servicePath = opts && opts.servicePath ? + opts.servicePath : + ((opts && opts.apiEndpoint) ? opts.apiEndpoint : + staticMembers.servicePath); const port = opts && opts.port ? opts.port : staticMembers.port; if (!opts) { @@ -101,8 +87,8 @@ export class CloudBillingClient { opts.port = opts.port || port; opts.clientConfig = opts.clientConfig || {}; - const isBrowser = typeof window !== 'undefined'; - if (isBrowser) { + const isBrowser = (typeof window !== 'undefined'); + if (isBrowser){ opts.fallback = true; } // If we are in browser, we are already using fallback because of the @@ -119,10 +105,13 @@ export class CloudBillingClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -138,18 +127,12 @@ export class CloudBillingClient { // For Node.js, pass the path to JSON proto file. // For browsers, pass the JSON content. - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); + const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json'); this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath + opts.fallback ? + // eslint-disable-next-line @typescript-eslint/no-var-requires + require("../../protos/protos.json") : + nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated @@ -171,25 +154,16 @@ export class CloudBillingClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listBillingAccounts: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'billingAccounts' - ), - listProjectBillingInfo: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'projectBillingInfo' - ), + listBillingAccounts: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'billingAccounts'), + listProjectBillingInfo: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'projectBillingInfo') }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.billing.v1.CloudBilling', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); + 'google.cloud.billing.v1.CloudBilling', 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 @@ -217,29 +191,16 @@ export class CloudBillingClient { // Put together the "service stub" for // google.cloud.billing.v1.CloudBilling. this.cloudBillingStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.billing.v1.CloudBilling' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.billing.v1.CloudBilling') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.billing.v1.CloudBilling, - this._opts - ) as Promise<{[method: string]: Function}>; + this._opts) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const cloudBillingStubMethods = [ - 'getBillingAccount', - 'listBillingAccounts', - 'updateBillingAccount', - 'createBillingAccount', - 'listProjectBillingInfo', - 'getProjectBillingInfo', - 'updateProjectBillingInfo', - 'getIamPolicy', - 'setIamPolicy', - 'testIamPermissions', - ]; + const cloudBillingStubMethods = + ['getBillingAccount', 'listBillingAccounts', 'updateBillingAccount', 'createBillingAccount', 'listProjectBillingInfo', 'getProjectBillingInfo', 'updateProjectBillingInfo', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions']; for (const methodName of cloudBillingStubMethods) { const callPromise = this.cloudBillingStub.then( stub => (...args: Array<{}>) => { @@ -249,17 +210,16 @@ export class CloudBillingClient { const func = stub[methodName]; return func.apply(stub, args); }, - (err: Error | null | undefined) => () => { + (err: Error|null|undefined) => () => { throw err; - } - ); + }); const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] ); this.innerApiCalls[methodName] = apiCall; @@ -295,7 +255,9 @@ export class CloudBillingClient { * in this service. */ static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; } getProjectId(): Promise; @@ -305,9 +267,8 @@ export class CloudBillingClient { * @param {function(Error, string)} callback - the callback to * be called with the current project Id. */ - getProjectId( - callback?: Callback - ): Promise | void { + getProjectId(callback?: Callback): + Promise|void { if (callback) { this.auth.getProjectId(callback); return; @@ -319,83 +280,62 @@ export class CloudBillingClient { // -- Service calls -- // ------------------- getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, - {} | undefined - ] - >; + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest|undefined, {}|undefined + ]>; getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.IGetBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest|null|undefined, + {}|null|undefined>): void; getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.IGetBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): void; - /** - * Gets information about a billing account. The current authenticated user - * must be a [viewer of the billing - * account](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account to retrieve. For example, - * `billingAccounts/012345-567890-ABCDEF`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets information about a billing account. The current authenticated user + * must be a [viewer of the billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account to retrieve. For example, + * `billingAccounts/012345-567890-ABCDEF`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + optionsOrCallback?: gax.CallOptions|Callback< protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.IGetBillingAccountRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.IGetBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, - {} | undefined - ] - > | void { + protos.google.cloud.billing.v1.IGetBillingAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -404,96 +344,75 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - name: request.name || '', + 'name': request.name || '', }); this.initialize(); return this.innerApiCalls.getBillingAccount(request, options, callback); } updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IUpdateBillingAccountRequest | undefined, - {} | undefined - ] - >; + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|undefined, {}|undefined + ]>; updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|null|undefined, + {}|null|undefined>): void; updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): void; - /** - * Updates a billing account's fields. - * Currently the only field that can be edited is `display_name`. - * The current authenticated user must have the `billing.accounts.update` - * IAM permission, which is typically given to the - * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) - * of the billing account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the billing account resource to be updated. - * @param {google.cloud.billing.v1.BillingAccount} request.account - * Required. The billing account resource to replace the resource on the server. - * @param {google.protobuf.FieldMask} request.updateMask - * The update mask applied to the resource. - * Only "display_name" is currently supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|null|undefined, + {}|null|undefined>): void; +/** + * Updates a billing account's fields. + * Currently the only field that can be edited is `display_name`. + * The current authenticated user must have the `billing.accounts.update` + * IAM permission, which is typically given to the + * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) + * of the billing account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the billing account resource to be updated. + * @param {google.cloud.billing.v1.BillingAccount} request.account + * Required. The billing account resource to replace the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The update mask applied to the resource. + * Only "display_name" is currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IUpdateBillingAccountRequest | undefined, - {} | undefined - ] - > | void { + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -502,98 +421,77 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - name: request.name || '', + 'name': request.name || '', }); this.initialize(); return this.innerApiCalls.updateBillingAccount(request, options, callback); } createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.ICreateBillingAccountRequest | undefined, - {} | undefined - ] - >; + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest|undefined, {}|undefined + ]>; createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.ICreateBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest|null|undefined, + {}|null|undefined>): void; createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.ICreateBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): void; - /** - * Creates a billing account. - * This method can only be used to create - * [billing subaccounts](https://cloud.google.com/billing/docs/concepts) - * by GCP resellers. - * When creating a subaccount, the current authenticated user must have the - * `billing.accounts.update` IAM permission on the master account, which is - * typically given to billing account - * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). - * This method will return an error if the master account has not been - * provisioned as a reseller account. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.billing.v1.BillingAccount} request.billingAccount - * Required. The billing account resource to create. - * Currently CreateBillingAccount only supports subaccount creation, so - * any created billing accounts must be under a provided master billing - * account. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest|null|undefined, + {}|null|undefined>): void; +/** + * Creates a billing account. + * This method can only be used to create + * [billing subaccounts](https://cloud.google.com/billing/docs/concepts) + * by GCP resellers. + * When creating a subaccount, the current authenticated user must have the + * `billing.accounts.update` IAM permission on the master account, which is + * typically given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * This method will return an error if the master account has not been + * provisioned as a reseller account. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.billing.v1.BillingAccount} request.billingAccount + * Required. The billing account resource to create. + * Currently CreateBillingAccount only supports subaccount creation, so + * any created billing accounts must be under a provided master billing + * account. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.ICreateBillingAccountRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - | protos.google.cloud.billing.v1.ICreateBillingAccountRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.ICreateBillingAccountRequest | undefined, - {} | undefined - ] - > | void { + protos.google.cloud.billing.v1.ICreateBillingAccountRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -601,84 +499,63 @@ export class CloudBillingClient { return this.innerApiCalls.createBillingAccount(request, options, callback); } getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest | undefined, - {} | undefined - ] - >; + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|undefined, {}|undefined + ]>; getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|null|undefined, + {}|null|undefined>): void; getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - > - ): void; - /** - * Gets the billing information for a project. The current authenticated user - * must have [permission to view the - * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo - * ). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the project for which billing information is - * retrieved. For example, `projects/tokyo-rain-123`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets the billing information for a project. The current authenticated user + * must have [permission to view the + * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + * ). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the project for which billing information is + * retrieved. For example, `projects/tokyo-rain-123`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest | undefined, - {} | undefined - ] - > | void { + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -687,126 +564,99 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - name: request.name || '', + 'name': request.name || '', }); this.initialize(); return this.innerApiCalls.getProjectBillingInfo(request, options, callback); } updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IProjectBillingInfo, - ( - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | undefined - ), - {} | undefined - ] - >; + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|undefined, {}|undefined + ]>; updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - > - ): void; + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|null|undefined, + {}|null|undefined>): void; updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - > - ): void; - /** - * Sets or updates the billing account associated with a project. You specify - * the new billing account by setting the `billing_account_name` in the - * `ProjectBillingInfo` resource to the resource name of a billing account. - * Associating a project with an open billing account enables billing on the - * project and allows charges for resource usage. If the project already had a - * billing account, this method changes the billing account used for resource - * usage charges. - * - * *Note:* Incurred charges that have not yet been reported in the transaction - * history of the GCP Console might be billed to the new billing - * account, even if the charge occurred before the new billing account was - * assigned to the project. - * - * The current authenticated user must have ownership privileges for both the - * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo - * ) and the [billing - * account](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * You can disable billing on the project by setting the - * `billing_account_name` field to empty. This action disassociates the - * current billing account from the project. Any billable activity of your - * in-use services will stop, and your application could stop functioning as - * expected. Any unbilled charges to date will be billed to the previously - * associated account. The current authenticated user must be either an owner - * of the project or an owner of the billing account for the project. - * - * Note that associating a project with a *closed* billing account will have - * much the same effect as disabling billing on the project: any paid - * resources used by the project will be shut down. Thus, unless you wish to - * disable billing, you should always call this method with the name of an - * *open* billing account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the project associated with the billing information - * that you want to update. For example, `projects/tokyo-rain-123`. - * @param {google.cloud.billing.v1.ProjectBillingInfo} request.projectBillingInfo - * The new billing information for the project. Read-only fields are ignored; - * thus, you can leave empty all fields except `billing_account_name`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|null|undefined, + {}|null|undefined>): void; +/** + * Sets or updates the billing account associated with a project. You specify + * the new billing account by setting the `billing_account_name` in the + * `ProjectBillingInfo` resource to the resource name of a billing account. + * Associating a project with an open billing account enables billing on the + * project and allows charges for resource usage. If the project already had a + * billing account, this method changes the billing account used for resource + * usage charges. + * + * *Note:* Incurred charges that have not yet been reported in the transaction + * history of the GCP Console might be billed to the new billing + * account, even if the charge occurred before the new billing account was + * assigned to the project. + * + * The current authenticated user must have ownership privileges for both the + * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + * ) and the [billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * You can disable billing on the project by setting the + * `billing_account_name` field to empty. This action disassociates the + * current billing account from the project. Any billable activity of your + * in-use services will stop, and your application could stop functioning as + * expected. Any unbilled charges to date will be billed to the previously + * associated account. The current authenticated user must be either an owner + * of the project or an owner of the billing account for the project. + * + * Note that associating a project with a *closed* billing account will have + * much the same effect as disabling billing on the project: any paid + * resources used by the project will be shut down. Thus, unless you wish to + * disable billing, you should always call this method with the name of an + * *open* billing account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the project associated with the billing information + * that you want to update. For example, `projects/tokyo-rain-123`. + * @param {google.cloud.billing.v1.ProjectBillingInfo} request.projectBillingInfo + * The new billing information for the project. Read-only fields are ignored; + * thus, you can leave empty all fields except `billing_account_name`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + optionsOrCallback?: gax.CallOptions|Callback< protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.cloud.billing.v1.IProjectBillingInfo, - ( - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | undefined - ), - {} | undefined - ] - > | void { + protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -815,83 +665,68 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - name: request.name || '', + 'name': request.name || '', }); this.initialize(); - return this.innerApiCalls.updateProjectBillingInfo( - request, - options, - callback - ); + return this.innerApiCalls.updateProjectBillingInfo(request, options, callback); } getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined - ] - >; + request: protos.google.iam.v1.IGetIamPolicyRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; - /** - * Gets the access control policy for a billing account. - * The caller must have the `billing.accounts.getIamPolicy` permission on the - * account, which is often given to billing account - * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Gets the access control policy for a billing account. + * The caller must have the `billing.accounts.getIamPolicy` permission on the + * account, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {} request. + * @param {} request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< + request: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest | undefined, - {} | undefined - ] - > | void { + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -900,80 +735,69 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - resource: request.resource || '', + 'resource': request.resource || '', }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | undefined, - {} | undefined - ] - >; + request: protos.google.iam.v1.ISetIamPolicyRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ): void; - /** - * Sets the access control policy for a billing account. Replaces any existing - * policy. - * The caller must have the `billing.accounts.setIamPolicy` permission on the - * account, which is often given to billing account - * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; +/** + * Sets the access control policy for a billing account. Replaces any existing + * policy. + * The caller must have the `billing.accounts.setIamPolicy` permission on the + * account, which is often given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {} request. + * @param {} request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< + request: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: gax.CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - 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 { + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -982,78 +806,67 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - resource: request.resource || '', + 'resource': request.resource || '', }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined - ] - >; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): void; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): void; - /** - * Tests the access control policy for a billing account. This method takes - * the resource and a set of permissions as input and returns the subset of - * the input permissions that the caller is allowed for that resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; +/** + * Tests the access control policy for a billing account. This method takes + * the resource and a set of permissions as input and returns the subset of + * the input permissions that the caller is allowed for that resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {} request. + * @param {} request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< + request: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: gax.CallOptions|Callback< protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ): Promise< - [ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest | undefined, - {} | undefined - ] - > | void { + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -1062,113 +875,94 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - resource: request.resource || '', + 'resource': request.resource || '', }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); } listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount[], - protos.google.cloud.billing.v1.IListBillingAccountsRequest | null, - protos.google.cloud.billing.v1.IListBillingAccountsResponse - ] - >; + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.IBillingAccount[], + protos.google.cloud.billing.v1.IListBillingAccountsRequest|null, + protos.google.cloud.billing.v1.IListBillingAccountsResponse + ]>; listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListBillingAccountsRequest, - | protos.google.cloud.billing.v1.IListBillingAccountsResponse - | null - | undefined, - protos.google.cloud.billing.v1.IBillingAccount - > - ): void; + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + protos.google.cloud.billing.v1.IListBillingAccountsResponse|null|undefined, + protos.google.cloud.billing.v1.IBillingAccount>): void; listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListBillingAccountsRequest, - | protos.google.cloud.billing.v1.IListBillingAccountsResponse - | null - | undefined, - protos.google.cloud.billing.v1.IBillingAccount - > - ): void; - /** - * Lists the billing accounts that the current authenticated user has - * permission to - * [view](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListBillingAccounts` - * call. If unspecified, the first page of results is returned. - * @param {string} request.filter - * Options for how to filter the returned billing accounts. - * Currently this only supports filtering for - * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a - * single provided reseller billing account. - * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). - * Boolean algebra and other fields are not currently supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListBillingAccountsRequest]{@link google.cloud.billing.v1.ListBillingAccountsRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListBillingAccountsResponse]{@link google.cloud.billing.v1.ListBillingAccountsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + protos.google.cloud.billing.v1.IListBillingAccountsResponse|null|undefined, + protos.google.cloud.billing.v1.IBillingAccount>): void; +/** + * Lists the billing accounts that the current authenticated user has + * permission to + * [view](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListBillingAccountsRequest]{@link google.cloud.billing.v1.ListBillingAccountsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListBillingAccountsResponse]{@link google.cloud.billing.v1.ListBillingAccountsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - optionsOrCallback?: - | gax.CallOptions - | PaginationCallback< + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< protos.google.cloud.billing.v1.IListBillingAccountsRequest, - | protos.google.cloud.billing.v1.IListBillingAccountsResponse - | null - | undefined, - protos.google.cloud.billing.v1.IBillingAccount - >, - callback?: PaginationCallback< - protos.google.cloud.billing.v1.IListBillingAccountsRequest, - | protos.google.cloud.billing.v1.IListBillingAccountsResponse - | null - | undefined, - protos.google.cloud.billing.v1.IBillingAccount - > - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount[], - protos.google.cloud.billing.v1.IListBillingAccountsRequest | null, - protos.google.cloud.billing.v1.IListBillingAccountsResponse - ] - > | void { + protos.google.cloud.billing.v1.IListBillingAccountsResponse|null|undefined, + protos.google.cloud.billing.v1.IBillingAccount>, + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + protos.google.cloud.billing.v1.IListBillingAccountsResponse|null|undefined, + protos.google.cloud.billing.v1.IBillingAccount>): + Promise<[ + protos.google.cloud.billing.v1.IBillingAccount[], + protos.google.cloud.billing.v1.IListBillingAccountsRequest|null, + protos.google.cloud.billing.v1.IListBillingAccountsResponse + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -1176,44 +970,44 @@ export class CloudBillingClient { return this.innerApiCalls.listBillingAccounts(request, options, callback); } - /** - * Equivalent to {@link listBillingAccounts}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listBillingAccounts} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListBillingAccounts` - * call. If unspecified, the first page of results is returned. - * @param {string} request.filter - * Options for how to filter the returned billing accounts. - * Currently this only supports filtering for - * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a - * single provided reseller billing account. - * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). - * Boolean algebra and other fields are not currently supported. - * @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 [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} on 'data' event. - */ +/** + * Equivalent to {@link listBillingAccounts}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listBillingAccounts} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @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 [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} on 'data' event. + */ listBillingAccountsStream( - request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions - ): Transform { + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions): + Transform{ request = request || {}; options = options || {}; const callSettings = new gax.CallSettings(options); @@ -1225,36 +1019,36 @@ export class CloudBillingClient { ); } - /** - * Equivalent to {@link listBillingAccounts}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListBillingAccounts` - * call. If unspecified, the first page of results is returned. - * @param {string} request.filter - * Options for how to filter the returned billing accounts. - * Currently this only supports filtering for - * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a - * single provided reseller billing account. - * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). - * Boolean algebra and other fields are not currently supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ +/** + * Equivalent to {@link listBillingAccounts}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listBillingAccountsAsync( - request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions - ): AsyncIterable { + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions): + AsyncIterable{ request = request || {}; options = options || {}; options = options || {}; @@ -1262,108 +1056,89 @@ export class CloudBillingClient { this.initialize(); return this.descriptors.page.listBillingAccounts.asyncIterate( this.innerApiCalls['listBillingAccounts'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IProjectBillingInfo[], - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - ] - >; + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.IProjectBillingInfo[], + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest|null, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + ]>; listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - | null - | undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo - > - ): void; + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse|null|undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo>): void; listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - | null - | undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo - > - ): void; - /** - * Lists the projects associated with a billing account. The current - * authenticated user must have the `billing.resourceAssociations.list` IAM - * permission, which is often given to billing account - * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account associated with the projects that - * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous `ListProjectBillingInfo` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListProjectBillingInfoRequest]{@link google.cloud.billing.v1.ListProjectBillingInfoRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListProjectBillingInfoResponse]{@link google.cloud.billing.v1.ListProjectBillingInfoResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse|null|undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo>): void; +/** + * Lists the projects associated with a billing account. The current + * authenticated user must have the `billing.resourceAssociations.list` IAM + * permission, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProjectBillingInfoRequest]{@link google.cloud.billing.v1.ListProjectBillingInfoRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProjectBillingInfoResponse]{@link google.cloud.billing.v1.ListProjectBillingInfoResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - optionsOrCallback?: - | gax.CallOptions - | PaginationCallback< + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse|null|undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo>, + callback?: PaginationCallback< protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - | null - | undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo - >, - callback?: PaginationCallback< - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - | null - | undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo - > - ): Promise< - [ - protos.google.cloud.billing.v1.IProjectBillingInfo[], - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - ] - > | void { + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse|null|undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo>): + Promise<[ + protos.google.cloud.billing.v1.IProjectBillingInfo[], + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest|null, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -1372,50 +1147,46 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - name: request.name || '', + 'name': request.name || '', }); this.initialize(); - return this.innerApiCalls.listProjectBillingInfo( - request, - options, - callback - ); + return this.innerApiCalls.listProjectBillingInfo(request, options, callback); } - /** - * Equivalent to {@link listProjectBillingInfo}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProjectBillingInfo} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account associated with the projects that - * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous `ListProjectBillingInfo` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} on 'data' event. - */ +/** + * Equivalent to {@link listProjectBillingInfo}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProjectBillingInfo} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} on 'data' event. + */ listProjectBillingInfoStream( - request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions - ): Transform { + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions): + Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1423,7 +1194,7 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - name: request.name || '', + 'name': request.name || '', }); const callSettings = new gax.CallSettings(options); this.initialize(); @@ -1434,32 +1205,32 @@ export class CloudBillingClient { ); } - /** - * Equivalent to {@link listProjectBillingInfo}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account associated with the projects that - * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous `ListProjectBillingInfo` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ +/** + * Equivalent to {@link listProjectBillingInfo}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listProjectBillingInfoAsync( - request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions - ): AsyncIterable { + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions): + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1467,14 +1238,14 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - name: request.name || '', + 'name': request.name || '', }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listProjectBillingInfo.asyncIterate( this.innerApiCalls['listProjectBillingInfo'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1488,7 +1259,7 @@ export class CloudBillingClient { * @param {string} billing_account * @returns {string} Resource name string. */ - billingAccountPath(billingAccount: string) { + billingAccountPath(billingAccount:string) { return this.pathTemplates.billingAccountPathTemplate.render({ billing_account: billingAccount, }); @@ -1502,9 +1273,7 @@ export class CloudBillingClient { * @returns {string} A string representing the billing_account. */ matchBillingAccountFromBillingAccountName(billingAccountName: string) { - return this.pathTemplates.billingAccountPathTemplate.match( - billingAccountName - ).billing_account; + return this.pathTemplates.billingAccountPathTemplate.match(billingAccountName).billing_account; } /** @@ -1513,7 +1282,7 @@ export class CloudBillingClient { * @param {string} service * @returns {string} Resource name string. */ - servicePath(service: string) { + servicePath(service:string) { return this.pathTemplates.servicePathTemplate.render({ service: service, }); @@ -1537,7 +1306,7 @@ export class CloudBillingClient { * @param {string} sku * @returns {string} Resource name string. */ - skuPath(service: string, sku: string) { + skuPath(service:string,sku:string) { return this.pathTemplates.skuPathTemplate.render({ service: service, sku: sku, diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index b32427443de..134baee9e2b 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -17,18 +17,11 @@ // ** All changes to this file may be overwritten. ** import * as gax from 'google-gax'; -import { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, -} from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; import * as path from 'path'; -import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import * as gapicConfig from './cloud_catalog_client_config.json'; @@ -49,12 +42,7 @@ export class CloudCatalogClient { private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; + descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}, batching: {}}; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; cloudCatalogStub?: Promise<{[name: string]: Function}>; @@ -88,12 +76,10 @@ export class CloudCatalogClient { constructor(opts?: ClientOptions) { // Ensure that options include the service address and port. const staticMembers = this.constructor as typeof CloudCatalogClient; - const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; + const servicePath = opts && opts.servicePath ? + opts.servicePath : + ((opts && opts.apiEndpoint) ? opts.apiEndpoint : + staticMembers.servicePath); const port = opts && opts.port ? opts.port : staticMembers.port; if (!opts) { @@ -103,8 +89,8 @@ export class CloudCatalogClient { opts.port = opts.port || port; opts.clientConfig = opts.clientConfig || {}; - const isBrowser = typeof window !== 'undefined'; - if (isBrowser) { + const isBrowser = (typeof window !== 'undefined'); + if (isBrowser){ opts.fallback = true; } // If we are in browser, we are already using fallback because of the @@ -121,10 +107,13 @@ export class CloudCatalogClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -140,18 +129,12 @@ export class CloudCatalogClient { // For Node.js, pass the path to JSON proto file. // For browsers, pass the JSON content. - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); + const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json'); this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath + opts.fallback ? + // eslint-disable-next-line @typescript-eslint/no-var-requires + require("../../protos/protos.json") : + nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated @@ -170,25 +153,16 @@ export class CloudCatalogClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listServices: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'services' - ), - listSkus: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'skus' - ), + listServices: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), + listSkus: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'skus') }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.billing.v1.CloudCatalog', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - {'x-goog-api-client': clientHeader.join(' ')} - ); + 'google.cloud.billing.v1.CloudCatalog', 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 @@ -216,18 +190,16 @@ export class CloudCatalogClient { // Put together the "service stub" for // google.cloud.billing.v1.CloudCatalog. this.cloudCatalogStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.billing.v1.CloudCatalog' - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.billing.v1.CloudCatalog') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.billing.v1.CloudCatalog, - this._opts - ) as Promise<{[method: string]: Function}>; + this._opts) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const cloudCatalogStubMethods = ['listServices', 'listSkus']; + const cloudCatalogStubMethods = + ['listServices', 'listSkus']; for (const methodName of cloudCatalogStubMethods) { const callPromise = this.cloudCatalogStub.then( stub => (...args: Array<{}>) => { @@ -237,17 +209,16 @@ export class CloudCatalogClient { const func = stub[methodName]; return func.apply(stub, args); }, - (err: Error | null | undefined) => () => { + (err: Error|null|undefined) => () => { throw err; - } - ); + }); const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] ); this.innerApiCalls[methodName] = apiCall; @@ -283,7 +254,9 @@ export class CloudCatalogClient { * in this service. */ static get scopes() { - return ['https://www.googleapis.com/auth/cloud-platform']; + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; } getProjectId(): Promise; @@ -293,9 +266,8 @@ export class CloudCatalogClient { * @param {function(Error, string)} callback - the callback to * be called with the current project Id. */ - getProjectId( - callback?: Callback - ): Promise | void { + getProjectId(callback?: Callback): + Promise|void { if (callback) { this.auth.getProjectId(callback); return; @@ -308,90 +280,77 @@ export class CloudCatalogClient { // ------------------- listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IService[], - protos.google.cloud.billing.v1.IListServicesRequest | null, - protos.google.cloud.billing.v1.IListServicesResponse - ] - >; + request: protos.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.IService[], + protos.google.cloud.billing.v1.IListServicesRequest|null, + protos.google.cloud.billing.v1.IListServicesResponse + ]>; listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListServicesRequest, - protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, - protos.google.cloud.billing.v1.IService - > - ): void; + request: protos.google.cloud.billing.v1.IListServicesRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse|null|undefined, + protos.google.cloud.billing.v1.IService>): void; listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListServicesRequest, - protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, - protos.google.cloud.billing.v1.IService - > - ): void; - /** - * Lists all public cloud services. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListServices` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Service]{@link google.cloud.billing.v1.Service}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Service]{@link google.cloud.billing.v1.Service} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListServicesRequest]{@link google.cloud.billing.v1.ListServicesRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListServicesResponse]{@link google.cloud.billing.v1.ListServicesResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse|null|undefined, + protos.google.cloud.billing.v1.IService>): void; +/** + * Lists all public cloud services. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Service]{@link google.cloud.billing.v1.Service}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Service]{@link google.cloud.billing.v1.Service} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListServicesRequest]{@link google.cloud.billing.v1.ListServicesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListServicesResponse]{@link google.cloud.billing.v1.ListServicesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, - optionsOrCallback?: - | gax.CallOptions - | PaginationCallback< + request: protos.google.cloud.billing.v1.IListServicesRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse|null|undefined, + protos.google.cloud.billing.v1.IService>, + callback?: PaginationCallback< protos.google.cloud.billing.v1.IListServicesRequest, - | protos.google.cloud.billing.v1.IListServicesResponse - | null - | undefined, - protos.google.cloud.billing.v1.IService - >, - callback?: PaginationCallback< - protos.google.cloud.billing.v1.IListServicesRequest, - protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, - protos.google.cloud.billing.v1.IService - > - ): Promise< - [ - protos.google.cloud.billing.v1.IService[], - protos.google.cloud.billing.v1.IListServicesRequest | null, - protos.google.cloud.billing.v1.IListServicesResponse - ] - > | void { + protos.google.cloud.billing.v1.IListServicesResponse|null|undefined, + protos.google.cloud.billing.v1.IService>): + Promise<[ + protos.google.cloud.billing.v1.IService[], + protos.google.cloud.billing.v1.IListServicesRequest|null, + protos.google.cloud.billing.v1.IListServicesResponse + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -399,36 +358,36 @@ export class CloudCatalogClient { return this.innerApiCalls.listServices(request, options, callback); } - /** - * Equivalent to {@link listServices}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listServices} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListServices` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Service]{@link google.cloud.billing.v1.Service} on 'data' event. - */ +/** + * Equivalent to {@link listServices}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listServices} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Service]{@link google.cloud.billing.v1.Service} on 'data' event. + */ listServicesStream( - request?: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions - ): Transform { + request?: protos.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions): + Transform{ request = request || {}; options = options || {}; const callSettings = new gax.CallSettings(options); @@ -440,28 +399,28 @@ export class CloudCatalogClient { ); } - /** - * Equivalent to {@link listServices}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListServices` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ +/** + * Equivalent to {@link listServices}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listServicesAsync( - request?: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions - ): AsyncIterable { + request?: protos.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions): + AsyncIterable{ request = request || {}; options = options || {}; options = options || {}; @@ -469,114 +428,103 @@ export class CloudCatalogClient { this.initialize(); return this.descriptors.page.listServices.asyncIterate( this.innerApiCalls['listServices'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.ISku[], - protos.google.cloud.billing.v1.IListSkusRequest | null, - protos.google.cloud.billing.v1.IListSkusResponse - ] - >; + request: protos.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions): + Promise<[ + protos.google.cloud.billing.v1.ISku[], + protos.google.cloud.billing.v1.IListSkusRequest|null, + protos.google.cloud.billing.v1.IListSkusResponse + ]>; listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, - protos.google.cloud.billing.v1.ISku - > - ): void; + request: protos.google.cloud.billing.v1.IListSkusRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse|null|undefined, + protos.google.cloud.billing.v1.ISku>): void; listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, - protos.google.cloud.billing.v1.ISku - > - ): void; - /** - * Lists all publicly available SKUs for a given cloud service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the service. - * Example: "services/DA34-426B-A397" - * @param {google.protobuf.Timestamp} request.startTime - * Optional inclusive start time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {google.protobuf.Timestamp} request.endTime - * Optional exclusive end time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {string} request.currencyCode - * The ISO 4217 currency code for the pricing info in the response proto. - * Will use the conversion rate as of start_time. - * Optional. If not specified USD will be used. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListSkus` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Sku]{@link google.cloud.billing.v1.Sku}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Sku]{@link google.cloud.billing.v1.Sku} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListSkusRequest]{@link google.cloud.billing.v1.ListSkusRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListSkusResponse]{@link google.cloud.billing.v1.ListSkusResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IListSkusRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse|null|undefined, + protos.google.cloud.billing.v1.ISku>): void; +/** + * Lists all publicly available SKUs for a given cloud service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Sku]{@link google.cloud.billing.v1.Sku}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Sku]{@link google.cloud.billing.v1.Sku} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListSkusRequest]{@link google.cloud.billing.v1.ListSkusRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListSkusResponse]{@link google.cloud.billing.v1.ListSkusResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - optionsOrCallback?: - | gax.CallOptions - | PaginationCallback< + request: protos.google.cloud.billing.v1.IListSkusRequest, + optionsOrCallback?: gax.CallOptions|PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse|null|undefined, + protos.google.cloud.billing.v1.ISku>, + callback?: PaginationCallback< protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, - protos.google.cloud.billing.v1.ISku - >, - callback?: PaginationCallback< - protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, - protos.google.cloud.billing.v1.ISku - > - ): Promise< - [ - protos.google.cloud.billing.v1.ISku[], - protos.google.cloud.billing.v1.IListSkusRequest | null, - protos.google.cloud.billing.v1.IListSkusResponse - ] - > | void { + protos.google.cloud.billing.v1.IListSkusResponse|null|undefined, + protos.google.cloud.billing.v1.ISku>): + Promise<[ + protos.google.cloud.billing.v1.ISku[], + protos.google.cloud.billing.v1.IListSkusRequest|null, + protos.google.cloud.billing.v1.IListSkusResponse + ]>|void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } else { + } + else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -585,63 +533,63 @@ export class CloudCatalogClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - parent: request.parent || '', + 'parent': request.parent || '', }); this.initialize(); return this.innerApiCalls.listSkus(request, options, callback); } - /** - * Equivalent to {@link listSkus}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listSkus} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the service. - * Example: "services/DA34-426B-A397" - * @param {google.protobuf.Timestamp} request.startTime - * Optional inclusive start time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {google.protobuf.Timestamp} request.endTime - * Optional exclusive end time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {string} request.currencyCode - * The ISO 4217 currency code for the pricing info in the response proto. - * Will use the conversion rate as of start_time. - * Optional. If not specified USD will be used. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListSkus` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Sku]{@link google.cloud.billing.v1.Sku} on 'data' event. - */ +/** + * Equivalent to {@link listSkus}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listSkus} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Sku]{@link google.cloud.billing.v1.Sku} on 'data' event. + */ listSkusStream( - request?: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions - ): Transform { + request?: protos.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions): + Transform{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -649,7 +597,7 @@ export class CloudCatalogClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - parent: request.parent || '', + 'parent': request.parent || '', }); const callSettings = new gax.CallSettings(options); this.initialize(); @@ -660,49 +608,49 @@ export class CloudCatalogClient { ); } - /** - * Equivalent to {@link listSkus}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the service. - * Example: "services/DA34-426B-A397" - * @param {google.protobuf.Timestamp} request.startTime - * Optional inclusive start time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {google.protobuf.Timestamp} request.endTime - * Optional exclusive end time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {string} request.currencyCode - * The ISO 4217 currency code for the pricing info in the response proto. - * Will use the conversion rate as of start_time. - * Optional. If not specified USD will be used. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListSkus` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ +/** + * Equivalent to {@link listSkus}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listSkusAsync( - request?: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions - ): AsyncIterable { + request?: protos.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions): + AsyncIterable{ request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -710,14 +658,14 @@ export class CloudCatalogClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - parent: request.parent || '', + 'parent': request.parent || '', }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listSkus.asyncIterate( this.innerApiCalls['listSkus'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -731,7 +679,7 @@ export class CloudCatalogClient { * @param {string} service * @returns {string} Resource name string. */ - servicePath(service: string) { + servicePath(service:string) { return this.pathTemplates.servicePathTemplate.render({ service: service, }); @@ -755,7 +703,7 @@ export class CloudCatalogClient { * @param {string} sku * @returns {string} Resource name string. */ - skuPath(service: string, sku: string) { + skuPath(service:string,sku:string) { return this.pathTemplates.skuPathTemplate.render({ service: service, sku: sku, diff --git a/packages/google-cloud-billing/src/v1/index.ts b/packages/google-cloud-billing/src/v1/index.ts index 6e2f971b42f..993df647509 100644 --- a/packages/google-cloud-billing/src/v1/index.ts +++ b/packages/google-cloud-billing/src/v1/index.ts @@ -16,5 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {CloudBillingClient} from './cloud_billing_client'; -export {CloudCatalogClient} from './cloud_catalog_client'; +export {CloudBillingClient} from './cloud_billing_client';export {CloudCatalogClient} from './cloud_catalog_client'; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index eec75c1f8cf..c956dc4c149 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -1,12 +1,25 @@ { - "updateTime": "2020-04-10T23:58:45.212942Z", "sources": [ + { + "git": { + "name": ".", + "remote": "https://github.com/googleapis/nodejs-billing.git", + "sha": "43ace7738fb9d675bfad6628a11c372924d53d07" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "cdf13efacdea0649e940452f9c5d320b93735974", + "internalRef": "306783437" + } + }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "6f32150677c9784f3c3a7e1949472bd29c9d72c5", - "log": "6f32150677c9784f3c3a7e1949472bd29c9d72c5\nfix: installs test_utils from its common repo (#480)\n\n\n74ce986d3b5431eb66985e9a00c4eb45295a4020\nfix: stop recording update_time in synth.metadata (#478)\n\n\n7f8e62aa3edd225f76347a16f92e400661fdfb52\nchore(java): release-please only updates non maven versions in README (#476)\n\nPrevent release-please and synthtool from fighting over the released library version. Synthtool updates the install snippets from the samples pom.xml files so the bots fight if they are temporarily out of sync after a release.\nc7e0e517d7f46f77bebd27da2e5afcaa6eee7e25\nbuild(java): fix nightly integration test config to run integrations (#465)\n\nThis was only running the units.\nbd69a2aa7b70875f3c988e269706b22fefbef40e\nbuild(java): fix retry_with_backoff when -e option set (#475)\n\n\nd9b173c427bfa0c6cca818233562e7e8841a357c\nfix: record version of working repo in synth.metadata (#473)\n\nPartial revert of b37cf74d12e9a42b9de9e61a4f26133d7cd9c168.\nf73a541770d95a609e5be6bf6b3b220d17cefcbe\nfeat(discogapic): allow local discovery-artifact-manager (#474)\n\n\n8cf0f5d93a70c3dcb0b4999d3152c46d4d9264bf\ndoc: describe the Autosynth & Synthtool protocol (#472)\n\n* doc: describe the Autosynth & Synthtool protocol\n\n* Accommodate review comments.\n980baaa738a1ad8fa02b4fdbd56be075ee77ece5\nfix: pin sphinx to <3.0.0 as new version causes new error (#471)\n\nThe error `toctree contains reference to document changlelog that doesn't have a title: no link will be generated` occurs as of 3.0.0. Pinning to 2.x until we address the docs build issue.\n\nTowards #470\n\nI did this manually for python-datastore https://github.com/googleapis/python-datastore/pull/22\n928b2998ac5023e7c7e254ab935f9ef022455aad\nchore(deps): update dependency com.google.cloud.samples:shared-configuration to v1.0.15 (#466)\n\nCo-authored-by: Jeffrey Rennie \n188f1b1d53181f739b98f8aa5d40cfe99eb90c47\nfix: allow local and external deps to be specified (#469)\n\nModify noxfile.py to allow local and external dependencies for\nsystem tests to be specified.\n" + "sha": "52638600f387deb98efb5f9c85fec39e82aa9052" } } ], diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js index 44b4cebd3a2..e2595373d29 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js @@ -16,6 +16,7 @@ // ** 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 billing = require('@google-cloud/billing'); diff --git a/packages/google-cloud-billing/system-test/install.ts b/packages/google-cloud-billing/system-test/install.ts index c4d80e9c0c8..5e4ed636481 100644 --- a/packages/google-cloud-billing/system-test/install.ts +++ b/packages/google-cloud-billing/system-test/install.ts @@ -16,36 +16,34 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('typescript consumer tests', () => { + it('should have correct type signature for typescript users', async function() { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), // path to your module. sample: { description: 'typescript based user can use the type definitions', - ts: readFileSync( - './system-test/fixtures/sample/src/index.ts' - ).toString(), - }, + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } }; - await packNTest(options); // will throw upon error. + await packNTest(options); // will throw upon error. }); it('should have correct type signature for javascript users', async function() { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), // path to your module. sample: { description: 'typescript based user can use the type definitions', - ts: readFileSync( - './system-test/fixtures/sample/src/index.js' - ).toString(), - }, + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } }; - await packNTest(options); // will throw upon error. + await packNTest(options); // will throw upon error. }); + }); diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 87046296bd1..f5d2166679b 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -20,7 +20,7 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { describe, it } from 'mocha'; import * as cloudbillingModule from '../src'; import {PassThrough} from 'stream'; @@ -28,1778 +28,1281 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); } -function 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({}); - }); +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]); + } } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, }); - } - return sinon.stub().returns(mockStream); + // 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); +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.CloudBillingClient', () => { - it('has servicePath', () => { - const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudbillingModule.v1.CloudBillingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudbillingModule.v1.CloudBillingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - fallback: true, + it('has servicePath', () => { + const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; + assert(servicePath); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudBillingStub, undefined); - await client.initialize(); - assert(client.cloudBillingStub); - }); - - it('has close method', () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudbillingModule.v1.CloudBillingClient({ - 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 cloudbillingModule.v1.CloudBillingClient({ - 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('getBillingAccount', () => { - it('invokes getBillingAccount without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.GetBillingAccountRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ); - client.innerApiCalls.getBillingAccount = stubSimpleCall(expectedResponse); - const [response] = await client.getBillingAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has apiEndpoint', () => { + const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; + assert(apiEndpoint); }); - it('invokes getBillingAccount without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.GetBillingAccountRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ); - client.innerApiCalls.getBillingAccount = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.getBillingAccount( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.IBillingAccount | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('has port', () => { + const port = cloudbillingModule.v1.CloudBillingClient.port; + assert(port); + assert(typeof port === 'number'); }); - it('invokes getBillingAccount with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.GetBillingAccountRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBillingAccount = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.getBillingAccount(request); - }, expectedError); - assert( - (client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - - describe('updateBillingAccount', () => { - it('invokes updateBillingAccount without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ); - client.innerApiCalls.updateBillingAccount = stubSimpleCall( - expectedResponse - ); - const [response] = await client.updateBillingAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('should create a client with no option', () => { + const client = new cloudbillingModule.v1.CloudBillingClient(); + assert(client); }); - it('invokes updateBillingAccount without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ); - client.innerApiCalls.updateBillingAccount = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.updateBillingAccount( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.IBillingAccount | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('should create a client with gRPC fallback', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + fallback: true, + }); + assert(client); }); - it('invokes updateBillingAccount with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBillingAccount = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.updateBillingAccount(request); - }, expectedError); - assert( - (client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - - describe('createBillingAccount', () => { - it('invokes createBillingAccount without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.CreateBillingAccountRequest() - ); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ); - client.innerApiCalls.createBillingAccount = stubSimpleCall( - expectedResponse - ); - const [response] = await client.createBillingAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBillingStub, undefined); + await client.initialize(); + assert(client.cloudBillingStub); }); - it('invokes createBillingAccount without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.CreateBillingAccountRequest() - ); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ); - client.innerApiCalls.createBillingAccount = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.createBillingAccount( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.IBillingAccount | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('has close method', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); }); - it('invokes createBillingAccount with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.CreateBillingAccountRequest() - ); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.createBillingAccount = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.createBillingAccount(request); - }, expectedError); - assert( - (client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - - describe('getProjectBillingInfo', () => { - it('invokes getProjectBillingInfo without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ); - client.innerApiCalls.getProjectBillingInfo = stubSimpleCall( - expectedResponse - ); - const [response] = await client.getProjectBillingInfo(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbillingModule.v1.CloudBillingClient({ + 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('invokes getProjectBillingInfo without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ); - client.innerApiCalls.getProjectBillingInfo = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.getProjectBillingInfo( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.IProjectBillingInfo | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - it('invokes getProjectBillingInfo with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getProjectBillingInfo = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.getProjectBillingInfo(request); - }, expectedError); - assert( - (client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - - describe('updateProjectBillingInfo', () => { - it('invokes updateProjectBillingInfo without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ); - client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall( - expectedResponse - ); - const [response] = await client.updateProjectBillingInfo(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('getBillingAccount', () => { + it('invokes getBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetBillingAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); + client.innerApiCalls.getBillingAccount = stubSimpleCall(expectedResponse); + const [response] = await client.getBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes updateProjectBillingInfo without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ); - client.innerApiCalls.updateProjectBillingInfo = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.updateProjectBillingInfo( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.IProjectBillingInfo | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes getBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetBillingAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); + client.innerApiCalls.getBillingAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBillingAccount( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.IBillingAccount|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes updateProjectBillingInfo with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.updateProjectBillingInfo(request); - }, expectedError); - assert( - (client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes getBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetBillingAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBillingAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.getBillingAccount(request); }, expectedError); + assert((client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.IPolicy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + describe('updateBillingAccount', () => { + it('invokes updateBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateBillingAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); + client.innerApiCalls.updateBillingAccount = stubSimpleCall(expectedResponse); + const [response] = await client.updateBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes getIamPolicy with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.getIamPolicy(request); - }, expectedError); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes updateBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateBillingAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); + client.innerApiCalls.updateBillingAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBillingAccount( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.IBillingAccount|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.IPolicy | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('invokes updateBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateBillingAccountRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBillingAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.updateBillingAccount(request); }, expectedError); + assert((client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); }); - it('invokes setIamPolicy with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.setIamPolicy(request); - }, expectedError); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCall( - expectedResponse - ); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + describe('createBillingAccount', () => { + it('invokes createBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.CreateBillingAccountRequest()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); + client.innerApiCalls.createBillingAccount = stubSimpleCall(expectedResponse); + const [response] = await client.createBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - ( - err?: Error | null, - result?: protos.google.iam.v1.ITestIamPermissionsResponse | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + it('invokes createBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.CreateBillingAccountRequest()); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); + client.innerApiCalls.createBillingAccount = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBillingAccount( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.IBillingAccount|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes testIamPermissions with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.testIamPermissions(request); - }, expectedError); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); - }); - - describe('listBillingAccounts', () => { - it('invokes listBillingAccounts without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListBillingAccountsRequest() - ); - const expectedOptions = {}; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - ]; - client.innerApiCalls.listBillingAccounts = stubSimpleCall( - expectedResponse - ); - const [response] = await client.listBillingAccounts(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes createBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.CreateBillingAccountRequest()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.createBillingAccount = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.createBillingAccount(request); }, expectedError); + assert((client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); }); - it('invokes listBillingAccounts without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListBillingAccountsRequest() - ); - const expectedOptions = {}; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - ]; - client.innerApiCalls.listBillingAccounts = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.listBillingAccounts( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.IBillingAccount[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + describe('getProjectBillingInfo', () => { + it('invokes getProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCall(expectedResponse); + const [response] = await client.getProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProjectBillingInfo( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.IProjectBillingInfo|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); - it('invokes listBillingAccounts with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListBillingAccountsRequest() - ); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.listBillingAccounts = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.listBillingAccounts(request); - }, expectedError); - assert( - (client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('invokes getProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.getProjectBillingInfo(request); }, expectedError); + assert((client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); }); - it('invokes listBillingAccountsStream without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListBillingAccountsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - ]; - client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall( - expectedResponse - ); - const stream = client.listBillingAccountsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; - stream.on( - 'data', - (response: protos.google.cloud.billing.v1.BillingAccount) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + describe('updateProjectBillingInfo', () => { + it('invokes updateProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall(expectedResponse); + const [response] = await client.updateProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes updateProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProjectBillingInfo( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.IProjectBillingInfo|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.updateProjectBillingInfo(request); }, expectedError); + assert((client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listBillingAccounts.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listBillingAccounts, request) - ); }); - it('invokes listBillingAccountsStream with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListBillingAccountsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listBillingAccountsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; - stream.on( - 'data', - (response: protos.google.cloud.billing.v1.BillingAccount) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); }); - }); - await assert.rejects(async () => { - await promise; - }, expectedError); - assert( - (client.descriptors.page.listBillingAccounts.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listBillingAccounts, request) - ); - }); - it('uses async iteration with listBillingAccounts without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListBillingAccountsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.BillingAccount() - ), - ]; - client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; - const iterable = client.listBillingAccountsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBillingAccounts - .asyncIterate as SinonStub).getCall(0).args[1], - request - ); + it('invokes getIamPolicy with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.getIamPolicy(request); }, expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); }); - it('uses async iteration with listBillingAccounts with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListBillingAccountsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listBillingAccountsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBillingAccounts - .asyncIterate as SinonStub).getCall(0).args[1], - request - ); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.setIamPolicy(request); }, expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); }); - }); - - describe('listProjectBillingInfo', () => { - it('invokes listProjectBillingInfo without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - ]; - client.innerApiCalls.listProjectBillingInfo = stubSimpleCall( - expectedResponse - ); - const [response] = await client.listProjectBillingInfo(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.testIamPermissions(request); }, expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); }); - it('invokes listProjectBillingInfo without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - ]; - client.innerApiCalls.listProjectBillingInfo = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.listProjectBillingInfo( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.IProjectBillingInfo[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + describe('listBillingAccounts', () => { + it('invokes listBillingAccounts without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + ]; + client.innerApiCalls.listBillingAccounts = stubSimpleCall(expectedResponse); + const [response] = await client.listBillingAccounts(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBillingAccounts without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + ]; + client.innerApiCalls.listBillingAccounts = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBillingAccounts( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.IBillingAccount[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listBillingAccounts with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listBillingAccounts = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.listBillingAccounts(request); }, expectedError); + assert((client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listBillingAccountsStream without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + ]; + client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listBillingAccountsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.BillingAccount) => { + 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.listBillingAccounts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBillingAccounts, request)); + }); + + it('invokes listBillingAccountsStream with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); + const expectedError = new Error('expected'); + client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listBillingAccountsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.BillingAccount) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(async () => { await promise; }, expectedError); + assert((client.descriptors.page.listBillingAccounts.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listBillingAccounts, request)); + }); + + it('uses async iteration with listBillingAccounts without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest());const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), + ]; + client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; + const iterable = client.listBillingAccountsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBillingAccounts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); - it('invokes listProjectBillingInfo with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listProjectBillingInfo = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.listProjectBillingInfo(request); - }, expectedError); - assert( - (client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('uses async iteration with listBillingAccounts with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest());const expectedError = new Error('expected'); + client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listBillingAccountsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBillingAccounts.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); }); - it('invokes listProjectBillingInfoStream without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - ]; - client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall( - expectedResponse - ); - const stream = client.listProjectBillingInfoStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; - stream.on( - 'data', - (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + describe('listProjectBillingInfo', () => { + it('invokes listProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + ]; + client.innerApiCalls.listProjectBillingInfo = stubSimpleCall(expectedResponse); + const [response] = await client.listProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes listProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + ]; + client.innerApiCalls.listProjectBillingInfo = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProjectBillingInfo( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.IProjectBillingInfo[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listProjectBillingInfo - .createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProjectBillingInfo, request) - ); - assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], - expectedHeaderRequestParams - ); - }); - it('invokes listProjectBillingInfoStream with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listProjectBillingInfoStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; - stream.on( - 'data', - (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + it('invokes listProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProjectBillingInfo = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.listProjectBillingInfo(request); }, expectedError); + assert((client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes listProjectBillingInfoStream without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + ]; + client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listProjectBillingInfoStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { + 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.listProjectBillingInfo.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listProjectBillingInfo, request)); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); }); - }); - await assert.rejects(async () => { - await promise; - }, expectedError); - assert( - (client.descriptors.page.listProjectBillingInfo - .createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listProjectBillingInfo, request) - ); - assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], - expectedHeaderRequestParams - ); - }); - it('uses async iteration with listProjectBillingInfo without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - generateSampleMessage( - new protos.google.cloud.billing.v1.ProjectBillingInfo() - ), - ]; - client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; - const iterable = client.listProjectBillingInfoAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listProjectBillingInfo - .asyncIterate as SinonStub).getCall(0).args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], - expectedHeaderRequestParams - ); - }); + it('invokes listProjectBillingInfoStream with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedError = new Error('expected'); + client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listProjectBillingInfoStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(async () => { await promise; }, expectedError); + assert((client.descriptors.page.listProjectBillingInfo.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listProjectBillingInfo, request)); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - it('uses async iteration with listProjectBillingInfo with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listProjectBillingInfoAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listProjectBillingInfo - .asyncIterate as SinonStub).getCall(0).args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - describe('billingAccount', () => { - const fakePath = '/rendered/path/billingAccount'; - const expectedParameters = { - billing_account: 'billingAccountValue', - }; - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.billingAccountPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('billingAccountPath', () => { - const result = client.billingAccountPath('billingAccountValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.billingAccountPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchBillingAccountFromBillingAccountName', () => { - const result = client.matchBillingAccountFromBillingAccountName( - fakePath - ); - assert.strictEqual(result, 'billingAccountValue'); - assert( - (client.pathTemplates.billingAccountPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); + it('uses async iteration with listProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), + ]; + client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; + const iterable = client.listProjectBillingInfoAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listProjectBillingInfo.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - describe('service', () => { - const fakePath = '/rendered/path/service'; - const expectedParameters = { - service: 'serviceValue', - }; - const client = new cloudbillingModule.v1.CloudBillingClient({ - 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('serviceValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, 'serviceValue'); - assert( - (client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + it('uses async iteration with listProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name=";const expectedError = new Error('expected'); + client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProjectBillingInfoAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listProjectBillingInfo.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); }); - describe('sku', () => { - const fakePath = '/rendered/path/sku'; - const expectedParameters = { - service: 'serviceValue', - sku: 'skuValue', - }; - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.skuPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.skuPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('skuPath', () => { - const result = client.skuPath('serviceValue', 'skuValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.skuPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchServiceFromSkuName', () => { - const result = client.matchServiceFromSkuName(fakePath); - assert.strictEqual(result, 'serviceValue'); - assert( - (client.pathTemplates.skuPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchSkuFromSkuName', () => { - const result = client.matchSkuFromSkuName(fakePath); - assert.strictEqual(result, 'skuValue'); - assert( - (client.pathTemplates.skuPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('Path templates', () => { + + describe('billingAccount', () => { + const fakePath = "/rendered/path/billingAccount"; + const expectedParameters = { + billing_account: "billingAccountValue", + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.billingAccountPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('billingAccountPath', () => { + const result = client.billingAccountPath("billingAccountValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.billingAccountPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchBillingAccountFromBillingAccountName', () => { + const result = client.matchBillingAccountFromBillingAccountName(fakePath); + assert.strictEqual(result, "billingAccountValue"); + assert((client.pathTemplates.billingAccountPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + service: "serviceValue", + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + 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("serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('sku', () => { + const fakePath = "/rendered/path/sku"; + const expectedParameters = { + service: "serviceValue", + sku: "skuValue", + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.skuPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.skuPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('skuPath', () => { + const result = client.skuPath("serviceValue", "skuValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.skuPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchServiceFromSkuName', () => { + const result = client.matchServiceFromSkuName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSkuFromSkuName', () => { + const result = client.matchSkuFromSkuName(fakePath); + assert.strictEqual(result, "skuValue"); + assert((client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); - }); }); diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index bfed12050b8..a8ff002b9a9 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -20,7 +20,7 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { describe, it } from 'mocha'; import * as cloudcatalogModule from '../src'; import {PassThrough} from 'stream'; @@ -28,769 +28,603 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject - ) as T; + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); } -function 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({}); - }); +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]); + } } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); + // 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); +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.CloudCatalogClient', () => { - it('has servicePath', () => { - const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudcatalogModule.v1.CloudCatalogClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - fallback: true, + it('has servicePath', () => { + const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; + assert(servicePath); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudCatalogStub, undefined); - await client.initialize(); - assert(client.cloudCatalogStub); - }); - - it('has close method', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has apiEndpoint', () => { + const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; + assert(apiEndpoint); }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + + it('has port', () => { + const port = cloudcatalogModule.v1.CloudCatalogClient.port; + assert(port); + assert(typeof port === 'number'); }); - 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 cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + + it('should create a client with no option', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient(); + assert(client); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + fallback: true, + }); + assert(client); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListServicesRequest() - ); - const expectedOptions = {}; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServices as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudCatalogStub, undefined); + await client.initialize(); + assert(client.cloudCatalogStub); }); - it('invokes listServices without error using callback', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListServicesRequest() - ); - const expectedOptions = {}; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.IService[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServices as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + it('has close method', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.close(); }); - it('invokes listServices with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListServicesRequest() - ); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall( - undefined, - expectedError - ); - await assert.rejects(async () => { - await client.listServices(request); - }, expectedError); - assert( - (client.innerApiCalls.listServices as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + 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('invokes listServicesStream without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListServicesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall( - expectedResponse - ); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.Service[] = []; - stream.on( - 'data', - (response: protos.google.cloud.billing.v1.Service) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - stream.on('error', (err: Error) => { - reject(err); + 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 responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listServices, request) - ); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - it('invokes listServicesStream with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListServicesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.Service[] = []; - stream.on( - 'data', - (response: protos.google.cloud.billing.v1.Service) => { - responses.push(response); - } - ); - stream.on('end', () => { - resolve(responses); + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listServices as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes listServices without error using callback', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.IService[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listServices as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); }); - }); - await assert.rejects(async () => { - await promise; - }, expectedError); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listServices, request) - ); - }); - it('uses async iteration with listServices without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListServicesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.billing.v1.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices - .asyncIterate as SinonStub).getCall(0).args[1], - request - ); - }); + it('invokes listServices with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.listServices(request); }, expectedError); + assert((client.innerApiCalls.listServices as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); - it('uses async iteration with listServices with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListServicesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices - .asyncIterate as SinonStub).getCall(0).args[1], - request - ); - }); - }); - - describe('listSkus', () => { - it('invokes listSkus without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListSkusRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - ]; - client.innerApiCalls.listSkus = stubSimpleCall(expectedResponse); - const [response] = await client.listSkus(request); - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listSkus as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); - }); + it('invokes listServicesStream without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Service[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + }); + + it('invokes listServicesStream with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Service[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(async () => { await promise; }, expectedError); + assert((client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listServices, request)); + }); - it('invokes listSkus without error using callback', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListSkusRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - ]; - client.innerApiCalls.listSkus = stubSimpleCallWithCallback( - expectedResponse - ); - const promise = new Promise((resolve, reject) => { - client.listSkus( - request, - ( - err?: Error | null, - result?: protos.google.cloud.billing.v1.ISku[] | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); + it('uses async iteration with listServices without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest());const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.billing.v1.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); } - } - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listSkus as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); - }); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); - it('invokes listSkus with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListSkusRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSkus = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { - await client.listSkus(request); - }, expectedError); - assert( - (client.innerApiCalls.listSkus as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + it('uses async iteration with listServices with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest());const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); }); - it('invokes listSkusStream without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListSkusRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - ]; - client.descriptors.page.listSkus.createStream = stubPageStreamingCall( - expectedResponse - ); - const stream = client.listSkusStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.Sku[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { - responses.push(response); + describe('listSkus', () => { + it('invokes listSkus without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.innerApiCalls.listSkus = stubSimpleCall(expectedResponse); + const [response] = await client.listSkus(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSkus as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); }); - stream.on('end', () => { - resolve(responses); + + it('invokes listSkus without error using callback', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.innerApiCalls.listSkus = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSkus( + request, + (err?: Error|null, result?: protos.google.cloud.billing.v1.ISku[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSkus as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); }); - stream.on('error', (err: Error) => { - reject(err); + + it('invokes listSkus with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSkus = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { await client.listSkus(request); }, expectedError); + assert((client.innerApiCalls.listSkus as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listSkus.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listSkus, request) - ); - assert.strictEqual( - (client.descriptors.page.listSkus.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - it('invokes listSkusStream with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListSkusRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listSkus.createStream = stubPageStreamingCall( - undefined, - expectedError - ); - const stream = client.listSkusStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.Sku[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { - responses.push(response); + it('invokes listSkusStream without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.descriptors.page.listSkus.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSkusStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Sku[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { + 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.listSkus.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSkus, request)); + assert.strictEqual( + (client.descriptors.page.listSkus.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); }); - stream.on('end', () => { - resolve(responses); + + it('invokes listSkusStream with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSkus.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSkusStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Sku[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(async () => { await promise; }, expectedError); + assert((client.descriptors.page.listSkus.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSkus, request)); + assert.strictEqual( + (client.descriptors.page.listSkus.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); }); - stream.on('error', (err: Error) => { - reject(err); + + it('uses async iteration with listSkus without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.billing.v1.ISku[] = []; + const iterable = client.listSkusAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); }); - }); - await assert.rejects(async () => { - await promise; - }, expectedError); - assert( - (client.descriptors.page.listSkus.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listSkus, request) - ); - assert.strictEqual( - (client.descriptors.page.listSkus.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - it('uses async iteration with listSkus without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListSkusRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - ]; - client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.billing.v1.ISku[] = []; - const iterable = client.listSkusAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) - .args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + it('uses async iteration with listSkus with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSkusAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.ISku[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); }); - it('uses async iteration with listSkus with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.billing.v1.ListSkusRequest() - ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedError = new Error('expected'); - client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); - const iterable = client.listSkusAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.ISku[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) - .args[1], - request - ); - assert.strictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - describe('service', () => { - const fakePath = '/rendered/path/service'; - const expectedParameters = { - service: 'serviceValue', - }; - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - 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('serviceValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, 'serviceValue'); - assert( - (client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - }); + describe('Path templates', () => { + + describe('service', () => { + const fakePath = "/rendered/path/service"; + const expectedParameters = { + service: "serviceValue", + }; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + 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("serviceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); - describe('sku', () => { - const fakePath = '/rendered/path/sku'; - const expectedParameters = { - service: 'serviceValue', - sku: 'skuValue', - }; - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.skuPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.skuPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('skuPath', () => { - const result = client.skuPath('serviceValue', 'skuValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.skuPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters) - ); - }); - - it('matchServiceFromSkuName', () => { - const result = client.matchServiceFromSkuName(fakePath); - assert.strictEqual(result, 'serviceValue'); - assert( - (client.pathTemplates.skuPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); - - it('matchSkuFromSkuName', () => { - const result = client.matchSkuFromSkuName(fakePath); - assert.strictEqual(result, 'skuValue'); - assert( - (client.pathTemplates.skuPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath) - ); - }); + describe('sku', () => { + const fakePath = "/rendered/path/sku"; + const expectedParameters = { + service: "serviceValue", + sku: "skuValue", + }; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.skuPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.skuPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('skuPath', () => { + const result = client.skuPath("serviceValue", "skuValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.skuPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchServiceFromSkuName', () => { + const result = client.matchServiceFromSkuName(fakePath); + assert.strictEqual(result, "serviceValue"); + assert((client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSkuFromSkuName', () => { + const result = client.matchSkuFromSkuName(fakePath); + assert.strictEqual(result, "skuValue"); + assert((client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); }); - }); }); diff --git a/packages/google-cloud-billing/webpack.config.js b/packages/google-cloud-billing/webpack.config.js index 21d8795fa42..e4c1e9dff02 100644 --- a/packages/google-cloud-billing/webpack.config.js +++ b/packages/google-cloud-billing/webpack.config.js @@ -36,27 +36,27 @@ module.exports = { { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/, + exclude: /node_modules/ }, { test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]grpc/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]retry-request/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader', + use: 'null-loader' }, { test: /node_modules[\\/]gtoken/, - use: 'null-loader', + use: 'null-loader' }, ], }, From 17915c6b94fd982efbd6f0a266206dd2e1d114b8 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 21 Apr 2020 04:37:17 -0700 Subject: [PATCH 035/169] build: adopt changes to generator formatting --- .../google-cloud-billing/protos/protos.js | 424 +-- packages/google-cloud-billing/src/index.ts | 2 +- .../src/v1/cloud_billing_client.ts | 1733 +++++----- .../src/v1/cloud_catalog_client.ts | 722 ++-- packages/google-cloud-billing/src/v1/index.ts | 3 +- packages/google-cloud-billing/synth.metadata | 2 +- .../system-test/fixtures/sample/src/index.js | 1 - .../system-test/install.ts | 32 +- .../test/gapic_cloud_billing_v1.ts | 2905 ++++++++++------- .../test/gapic_cloud_catalog_v1.ts | 1264 +++---- .../google-cloud-billing/webpack.config.js | 12 +- 11 files changed, 4027 insertions(+), 3073 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index de021808788..3dd85c9a032 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -514,13 +514,13 @@ BillingAccount.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.open != null && message.hasOwnProperty("open")) + if (message.open != null && Object.hasOwnProperty.call(message, "open")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.open); - if (message.displayName != null && message.hasOwnProperty("displayName")) + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); - if (message.masterBillingAccount != null && message.hasOwnProperty("masterBillingAccount")) + if (message.masterBillingAccount != null && Object.hasOwnProperty.call(message, "masterBillingAccount")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.masterBillingAccount); return writer; }; @@ -768,13 +768,13 @@ ProjectBillingInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.projectId != null && message.hasOwnProperty("projectId")) + if (message.projectId != null && Object.hasOwnProperty.call(message, "projectId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.projectId); - if (message.billingAccountName != null && message.hasOwnProperty("billingAccountName")) + if (message.billingAccountName != null && Object.hasOwnProperty.call(message, "billingAccountName")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.billingAccountName); - if (message.billingEnabled != null && message.hasOwnProperty("billingEnabled")) + if (message.billingEnabled != null && Object.hasOwnProperty.call(message, "billingEnabled")) writer.uint32(/* id 4, wireType 0 =*/32).bool(message.billingEnabled); return writer; }; @@ -995,7 +995,7 @@ GetBillingAccountRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; @@ -1200,11 +1200,11 @@ ListBillingAccountsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageSize); - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); - if (message.filter != null && message.hasOwnProperty("filter")) + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.filter); return writer; }; @@ -1427,7 +1427,7 @@ if (message.billingAccounts != null && message.billingAccounts.length) for (var i = 0; i < message.billingAccounts.length; ++i) $root.google.cloud.billing.v1.BillingAccount.encode(message.billingAccounts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; @@ -1645,7 +1645,7 @@ CreateBillingAccountRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.billingAccount != null && message.hasOwnProperty("billingAccount")) + if (message.billingAccount != null && Object.hasOwnProperty.call(message, "billingAccount")) $root.google.cloud.billing.v1.BillingAccount.encode(message.billingAccount, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; @@ -1855,11 +1855,11 @@ UpdateBillingAccountRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.account != null && message.hasOwnProperty("account")) + if (message.account != null && Object.hasOwnProperty.call(message, "account")) $root.google.cloud.billing.v1.BillingAccount.encode(message.account, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) + 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; }; @@ -2097,11 +2097,11 @@ ListProjectBillingInfoRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); return writer; }; @@ -2324,7 +2324,7 @@ if (message.projectBillingInfo != null && message.projectBillingInfo.length) for (var i = 0; i < message.projectBillingInfo.length; ++i) $root.google.cloud.billing.v1.ProjectBillingInfo.encode(message.projectBillingInfo[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; @@ -2542,7 +2542,7 @@ GetProjectBillingInfoRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; @@ -2738,9 +2738,9 @@ UpdateProjectBillingInfoRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.projectBillingInfo != null && message.hasOwnProperty("projectBillingInfo")) + if (message.projectBillingInfo != null && Object.hasOwnProperty.call(message, "projectBillingInfo")) $root.google.cloud.billing.v1.ProjectBillingInfo.encode(message.projectBillingInfo, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -3072,13 +3072,13 @@ Service.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.serviceId != null && message.hasOwnProperty("serviceId")) + if (message.serviceId != null && Object.hasOwnProperty.call(message, "serviceId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.serviceId); - if (message.displayName != null && message.hasOwnProperty("displayName")) + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); - if (message.businessEntityName != null && message.hasOwnProperty("businessEntityName")) + if (message.businessEntityName != null && Object.hasOwnProperty.call(message, "businessEntityName")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.businessEntityName); return writer; }; @@ -3355,13 +3355,13 @@ Sku.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.skuId != null && message.hasOwnProperty("skuId")) + if (message.skuId != null && Object.hasOwnProperty.call(message, "skuId")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.skuId); - if (message.description != null && message.hasOwnProperty("description")) + if (message.description != null && Object.hasOwnProperty.call(message, "description")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.category != null && message.hasOwnProperty("category")) + if (message.category != null && Object.hasOwnProperty.call(message, "category")) $root.google.cloud.billing.v1.Category.encode(message.category, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.serviceRegions != null && message.serviceRegions.length) for (var i = 0; i < message.serviceRegions.length; ++i) @@ -3369,7 +3369,7 @@ if (message.pricingInfo != null && message.pricingInfo.length) for (var i = 0; i < message.pricingInfo.length; ++i) $root.google.cloud.billing.v1.PricingInfo.encode(message.pricingInfo[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.serviceProviderName != null && message.hasOwnProperty("serviceProviderName")) + if (message.serviceProviderName != null && Object.hasOwnProperty.call(message, "serviceProviderName")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.serviceProviderName); return writer; }; @@ -3690,13 +3690,13 @@ Category.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.serviceDisplayName != null && message.hasOwnProperty("serviceDisplayName")) + if (message.serviceDisplayName != null && Object.hasOwnProperty.call(message, "serviceDisplayName")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.serviceDisplayName); - if (message.resourceFamily != null && message.hasOwnProperty("resourceFamily")) + if (message.resourceFamily != null && Object.hasOwnProperty.call(message, "resourceFamily")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.resourceFamily); - if (message.resourceGroup != null && message.hasOwnProperty("resourceGroup")) + if (message.resourceGroup != null && Object.hasOwnProperty.call(message, "resourceGroup")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.resourceGroup); - if (message.usageType != null && message.hasOwnProperty("usageType")) + if (message.usageType != null && Object.hasOwnProperty.call(message, "usageType")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.usageType); return writer; }; @@ -3953,15 +3953,15 @@ PricingInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.effectiveTime != null && message.hasOwnProperty("effectiveTime")) + if (message.effectiveTime != null && Object.hasOwnProperty.call(message, "effectiveTime")) $root.google.protobuf.Timestamp.encode(message.effectiveTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.summary != null && message.hasOwnProperty("summary")) + if (message.summary != null && Object.hasOwnProperty.call(message, "summary")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.summary); - if (message.pricingExpression != null && message.hasOwnProperty("pricingExpression")) + if (message.pricingExpression != null && Object.hasOwnProperty.call(message, "pricingExpression")) $root.google.cloud.billing.v1.PricingExpression.encode(message.pricingExpression, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.aggregationInfo != null && message.hasOwnProperty("aggregationInfo")) + if (message.aggregationInfo != null && Object.hasOwnProperty.call(message, "aggregationInfo")) $root.google.cloud.billing.v1.AggregationInfo.encode(message.aggregationInfo, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.currencyConversionRate != null && message.hasOwnProperty("currencyConversionRate")) + if (message.currencyConversionRate != null && Object.hasOwnProperty.call(message, "currencyConversionRate")) writer.uint32(/* id 5, wireType 1 =*/41).double(message.currencyConversionRate); return writer; }; @@ -4263,20 +4263,20 @@ PricingExpression.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.usageUnit != null && message.hasOwnProperty("usageUnit")) + if (message.usageUnit != null && Object.hasOwnProperty.call(message, "usageUnit")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.usageUnit); - if (message.displayQuantity != null && message.hasOwnProperty("displayQuantity")) + if (message.displayQuantity != null && Object.hasOwnProperty.call(message, "displayQuantity")) writer.uint32(/* id 2, wireType 1 =*/17).double(message.displayQuantity); if (message.tieredRates != null && message.tieredRates.length) for (var i = 0; i < message.tieredRates.length; ++i) $root.google.cloud.billing.v1.PricingExpression.TierRate.encode(message.tieredRates[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.usageUnitDescription != null && message.hasOwnProperty("usageUnitDescription")) + if (message.usageUnitDescription != null && Object.hasOwnProperty.call(message, "usageUnitDescription")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.usageUnitDescription); - if (message.baseUnit != null && message.hasOwnProperty("baseUnit")) + if (message.baseUnit != null && Object.hasOwnProperty.call(message, "baseUnit")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.baseUnit); - if (message.baseUnitDescription != null && message.hasOwnProperty("baseUnitDescription")) + if (message.baseUnitDescription != null && Object.hasOwnProperty.call(message, "baseUnitDescription")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.baseUnitDescription); - if (message.baseUnitConversionFactor != null && message.hasOwnProperty("baseUnitConversionFactor")) + if (message.baseUnitConversionFactor != null && Object.hasOwnProperty.call(message, "baseUnitConversionFactor")) writer.uint32(/* id 7, wireType 1 =*/57).double(message.baseUnitConversionFactor); return writer; }; @@ -4556,9 +4556,9 @@ TierRate.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.startUsageAmount != null && message.hasOwnProperty("startUsageAmount")) + if (message.startUsageAmount != null && Object.hasOwnProperty.call(message, "startUsageAmount")) writer.uint32(/* id 1, wireType 1 =*/9).double(message.startUsageAmount); - if (message.unitPrice != null && message.hasOwnProperty("unitPrice")) + if (message.unitPrice != null && Object.hasOwnProperty.call(message, "unitPrice")) $root.google.type.Money.encode(message.unitPrice, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -4783,11 +4783,11 @@ AggregationInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.aggregationLevel != null && message.hasOwnProperty("aggregationLevel")) + if (message.aggregationLevel != null && Object.hasOwnProperty.call(message, "aggregationLevel")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.aggregationLevel); - if (message.aggregationInterval != null && message.hasOwnProperty("aggregationInterval")) + if (message.aggregationInterval != null && Object.hasOwnProperty.call(message, "aggregationInterval")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.aggregationInterval); - if (message.aggregationCount != null && message.hasOwnProperty("aggregationCount")) + if (message.aggregationCount != null && Object.hasOwnProperty.call(message, "aggregationCount")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.aggregationCount); return writer; }; @@ -4977,7 +4977,7 @@ /** * AggregationLevel enum. * @name google.cloud.billing.v1.AggregationInfo.AggregationLevel - * @enum {string} + * @enum {number} * @property {number} AGGREGATION_LEVEL_UNSPECIFIED=0 AGGREGATION_LEVEL_UNSPECIFIED value * @property {number} ACCOUNT=1 ACCOUNT value * @property {number} PROJECT=2 PROJECT value @@ -4993,7 +4993,7 @@ /** * AggregationInterval enum. * @name google.cloud.billing.v1.AggregationInfo.AggregationInterval - * @enum {string} + * @enum {number} * @property {number} AGGREGATION_INTERVAL_UNSPECIFIED=0 AGGREGATION_INTERVAL_UNSPECIFIED value * @property {number} DAILY=1 DAILY value * @property {number} MONTHLY=2 MONTHLY value @@ -5074,9 +5074,9 @@ ListServicesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageSize); - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); return writer; }; @@ -5288,7 +5288,7 @@ if (message.services != null && message.services.length) for (var i = 0; i < message.services.length; ++i) $root.google.cloud.billing.v1.Service.encode(message.services[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; @@ -5551,17 +5551,17 @@ ListSkusRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.parent != null && message.hasOwnProperty("parent")) + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.startTime != null && message.hasOwnProperty("startTime")) + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.endTime != null && message.hasOwnProperty("endTime")) + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.currencyCode); - if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.pageSize); - if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.pageToken); return writer; }; @@ -5827,7 +5827,7 @@ if (message.skus != null && message.skus.length) for (var i = 0; i < message.skus.length; ++i) $root.google.cloud.billing.v1.Sku.encode(message.skus[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); return writer; }; @@ -6076,7 +6076,7 @@ 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 && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); return writer; }; @@ -6390,26 +6390,26 @@ HttpRule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.selector != null && message.hasOwnProperty("selector")) + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && message.hasOwnProperty("get")) + if (message.get != null && Object.hasOwnProperty.call(message, "get")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && message.hasOwnProperty("put")) + if (message.put != null && Object.hasOwnProperty.call(message, "put")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && message.hasOwnProperty("post")) + if (message.post != null && Object.hasOwnProperty.call(message, "post")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && message.hasOwnProperty("delete")) + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && message.hasOwnProperty("patch")) + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && message.hasOwnProperty("body")) + if (message.body != null && Object.hasOwnProperty.call(message, "body")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && message.hasOwnProperty("custom")) + 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 && message.hasOwnProperty("responseBody")) + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); return writer; }; @@ -6766,9 +6766,9 @@ CustomHttpPattern.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.kind != null && message.hasOwnProperty("kind")) + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && message.hasOwnProperty("path")) + if (message.path != null && Object.hasOwnProperty.call(message, "path")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); return writer; }; @@ -6914,7 +6914,7 @@ /** * FieldBehavior enum. * @name google.api.FieldBehavior - * @enum {string} + * @enum {number} * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value * @property {number} OPTIONAL=1 OPTIONAL value * @property {number} REQUIRED=2 REQUIRED value @@ -7035,18 +7035,18 @@ ResourceDescriptor.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) + 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 && message.hasOwnProperty("nameField")) + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); - if (message.history != null && message.hasOwnProperty("history")) + if (message.history != null && Object.hasOwnProperty.call(message, "history")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); - if (message.plural != null && message.hasOwnProperty("plural")) + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); - if (message.singular != null && message.hasOwnProperty("singular")) + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); return writer; }; @@ -7266,7 +7266,7 @@ /** * History enum. * @name google.api.ResourceDescriptor.History - * @enum {string} + * @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 @@ -7347,9 +7347,9 @@ ResourceReference.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.childType != null && message.hasOwnProperty("childType")) + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); return writer; }; @@ -7874,9 +7874,9 @@ FileDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message["package"] != null && message.hasOwnProperty("package")) + 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) @@ -7893,9 +7893,9 @@ 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 && message.hasOwnProperty("options")) + 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 && message.hasOwnProperty("sourceCodeInfo")) + 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) @@ -7903,7 +7903,7 @@ 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 && message.hasOwnProperty("syntax")) + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); return writer; }; @@ -8441,7 +8441,7 @@ DescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + 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) @@ -8458,7 +8458,7 @@ 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 && message.hasOwnProperty("options")) + 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) @@ -8923,11 +8923,11 @@ ExtensionRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - if (message.options != null && message.hasOwnProperty("options")) + 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; }; @@ -9151,9 +9151,9 @@ ReservedRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); return writer; }; @@ -9644,25 +9644,25 @@ FieldDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.extendee != null && message.hasOwnProperty("extendee")) + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); - if (message.label != null && message.hasOwnProperty("label")) + if (message.label != null && Object.hasOwnProperty.call(message, "label")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); - if (message.type != null && message.hasOwnProperty("type")) + if (message.type != null && Object.hasOwnProperty.call(message, "type")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); - if (message.typeName != null && message.hasOwnProperty("typeName")) + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); - if (message.options != null && message.hasOwnProperty("options")) + 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 && message.hasOwnProperty("oneofIndex")) + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); - if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); return writer; }; @@ -10009,7 +10009,7 @@ /** * Type enum. * @name google.protobuf.FieldDescriptorProto.Type - * @enum {string} + * @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 @@ -10055,7 +10055,7 @@ /** * Label enum. * @name google.protobuf.FieldDescriptorProto.Label - * @enum {string} + * @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 @@ -10136,9 +10136,9 @@ OneofDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.options != null && message.hasOwnProperty("options")) + 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; }; @@ -10381,12 +10381,12 @@ EnumDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + 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 && message.hasOwnProperty("options")) + 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) @@ -10689,9 +10689,9 @@ EnumReservedRange.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.start != null && message.hasOwnProperty("start")) + if (message.start != null && Object.hasOwnProperty.call(message, "start")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); return writer; }; @@ -10911,11 +10911,11 @@ EnumValueDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.number != null && message.hasOwnProperty("number")) + if (message.number != null && Object.hasOwnProperty.call(message, "number")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); - if (message.options != null && message.hasOwnProperty("options")) + 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; }; @@ -11149,12 +11149,12 @@ ServiceDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + 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 && message.hasOwnProperty("options")) + 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; }; @@ -11434,17 +11434,17 @@ MethodDescriptorProto.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.inputType != null && message.hasOwnProperty("inputType")) + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); - if (message.outputType != null && message.hasOwnProperty("outputType")) + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); - if (message.options != null && message.hasOwnProperty("options")) + 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 && message.hasOwnProperty("clientStreaming")) + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); return writer; }; @@ -11883,45 +11883,45 @@ FileOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); - if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); - if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + 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) @@ -12348,7 +12348,7 @@ /** * OptimizeMode enum. * @name google.protobuf.FileOptions.OptimizeMode - * @enum {string} + * @enum {number} * @property {number} SPEED=1 SPEED value * @property {number} CODE_SIZE=2 CODE_SIZE value * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value @@ -12466,18 +12466,18 @@ MessageOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + 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 && message.hasOwnProperty(".google.api.resource")) + 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; }; @@ -12819,17 +12819,17 @@ FieldOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ctype != null && message.hasOwnProperty("ctype")) + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); - if (message.packed != null && message.hasOwnProperty("packed")) + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.lazy != null && message.hasOwnProperty("lazy")) + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); - if (message.jstype != null && message.hasOwnProperty("jstype")) + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); - if (message.weak != null && message.hasOwnProperty("weak")) + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) @@ -12840,7 +12840,7 @@ writer.int32(message[".google.api.fieldBehavior"][i]); writer.ldelim(); } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + 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; }; @@ -13176,7 +13176,7 @@ /** * CType enum. * @name google.protobuf.FieldOptions.CType - * @enum {string} + * @enum {number} * @property {number} STRING=0 STRING value * @property {number} CORD=1 CORD value * @property {number} STRING_PIECE=2 STRING_PIECE value @@ -13192,7 +13192,7 @@ /** * JSType enum. * @name google.protobuf.FieldOptions.JSType - * @enum {string} + * @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 @@ -13491,9 +13491,9 @@ EnumOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + 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) @@ -13736,7 +13736,7 @@ EnumValueOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + 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) @@ -13985,14 +13985,14 @@ ServiceOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + 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 && message.hasOwnProperty(".google.api.defaultHost")) + 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 && message.hasOwnProperty(".google.api.oauthScopes")) + 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; }; @@ -14271,9 +14271,9 @@ MethodOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + 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) @@ -14281,7 +14281,7 @@ 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 && message.hasOwnProperty(".google.api.http")) + 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; }; @@ -14515,7 +14515,7 @@ /** * IdempotencyLevel enum. * @name google.protobuf.MethodOptions.IdempotencyLevel - * @enum {string} + * @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 @@ -14645,17 +14645,17 @@ 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 && message.hasOwnProperty("identifierValue")) + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); - if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); return writer; }; @@ -15432,9 +15432,9 @@ writer.int32(message.span[i]); writer.ldelim(); } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + 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) @@ -15965,11 +15965,11 @@ writer.int32(message.path[i]); writer.ldelim(); } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); - if (message.begin != null && message.hasOwnProperty("begin")) + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); - if (message.end != null && message.hasOwnProperty("end")) + if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); return writer; }; @@ -16425,9 +16425,9 @@ Timestamp.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && message.hasOwnProperty("seconds")) + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && message.hasOwnProperty("nanos")) + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); return writer; }; @@ -16804,9 +16804,9 @@ SetIamPolicyRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.resource != null && message.hasOwnProperty("resource")) + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); - if (message.policy != null && message.hasOwnProperty("policy")) + if (message.policy != null && Object.hasOwnProperty.call(message, "policy")) $root.google.iam.v1.Policy.encode(message.policy, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -17019,9 +17019,9 @@ GetIamPolicyRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.resource != null && message.hasOwnProperty("resource")) + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); - if (message.options != null && message.hasOwnProperty("options")) + 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; }; @@ -17235,7 +17235,7 @@ TestIamPermissionsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.resource != null && message.hasOwnProperty("resource")) + 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) @@ -17654,7 +17654,7 @@ GetPolicyOptions.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requestedPolicyVersion != null && message.hasOwnProperty("requestedPolicyVersion")) + if (message.requestedPolicyVersion != null && Object.hasOwnProperty.call(message, "requestedPolicyVersion")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.requestedPolicyVersion); return writer; }; @@ -17860,9 +17860,9 @@ Policy.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.version != null && message.hasOwnProperty("version")) + if (message.version != null && Object.hasOwnProperty.call(message, "version")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.version); - if (message.etag != null && message.hasOwnProperty("etag")) + 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) @@ -18123,12 +18123,12 @@ Binding.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.role != null && message.hasOwnProperty("role")) + 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 && message.hasOwnProperty("condition")) + 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; }; @@ -18637,13 +18637,13 @@ BindingDelta.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.action != null && message.hasOwnProperty("action")) + if (message.action != null && Object.hasOwnProperty.call(message, "action")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.action); - if (message.role != null && message.hasOwnProperty("role")) + if (message.role != null && Object.hasOwnProperty.call(message, "role")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.role); - if (message.member != null && message.hasOwnProperty("member")) + if (message.member != null && Object.hasOwnProperty.call(message, "member")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.member); - if (message.condition != null && message.hasOwnProperty("condition")) + 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; }; @@ -18831,7 +18831,7 @@ /** * Action enum. * @name google.iam.v1.BindingDelta.Action - * @enum {string} + * @enum {number} * @property {number} ACTION_UNSPECIFIED=0 ACTION_UNSPECIFIED value * @property {number} ADD=1 ADD value * @property {number} REMOVE=2 REMOVE value @@ -18930,13 +18930,13 @@ AuditConfigDelta.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.action != null && message.hasOwnProperty("action")) + if (message.action != null && Object.hasOwnProperty.call(message, "action")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.action); - if (message.service != null && message.hasOwnProperty("service")) + if (message.service != null && Object.hasOwnProperty.call(message, "service")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.service); - if (message.exemptedMember != null && message.hasOwnProperty("exemptedMember")) + if (message.exemptedMember != null && Object.hasOwnProperty.call(message, "exemptedMember")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.exemptedMember); - if (message.logType != null && message.hasOwnProperty("logType")) + if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.logType); return writer; }; @@ -19119,7 +19119,7 @@ /** * Action enum. * @name google.iam.v1.AuditConfigDelta.Action - * @enum {string} + * @enum {number} * @property {number} ACTION_UNSPECIFIED=0 ACTION_UNSPECIFIED value * @property {number} ADD=1 ADD value * @property {number} REMOVE=2 REMOVE value @@ -19233,13 +19233,13 @@ Expr.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.expression != null && message.hasOwnProperty("expression")) + if (message.expression != null && Object.hasOwnProperty.call(message, "expression")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.expression); - if (message.title != null && message.hasOwnProperty("title")) + if (message.title != null && Object.hasOwnProperty.call(message, "title")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); - if (message.description != null && message.hasOwnProperty("description")) + if (message.description != null && Object.hasOwnProperty.call(message, "description")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.location != null && message.hasOwnProperty("location")) + if (message.location != null && Object.hasOwnProperty.call(message, "location")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.location); return writer; }; @@ -19478,11 +19478,11 @@ Money.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.currencyCode != null && message.hasOwnProperty("currencyCode")) + if (message.currencyCode != null && Object.hasOwnProperty.call(message, "currencyCode")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.currencyCode); - if (message.units != null && message.hasOwnProperty("units")) + if (message.units != null && Object.hasOwnProperty.call(message, "units")) writer.uint32(/* id 2, wireType 0 =*/16).int64(message.units); - if (message.nanos != null && message.hasOwnProperty("nanos")) + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.nanos); return writer; }; diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index 524fece4c86..41db5b4968b 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -22,4 +22,4 @@ const CloudCatalogClient = v1.CloudCatalogClient; export {v1, CloudBillingClient, CloudCatalogClient}; export default {v1, CloudBillingClient, CloudCatalogClient}; import * as protos from '../protos/protos'; -export {protos} +export {protos}; diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index c4fcb547bfd..ebd5e02efdc 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -17,11 +17,18 @@ // ** All changes to this file may be overwritten. ** import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; import * as path from 'path'; -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import * as gapicConfig from './cloud_billing_client_config.json'; @@ -40,7 +47,12 @@ export class CloudBillingClient { private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}, batching: {}}; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; cloudBillingStub?: Promise<{[name: string]: Function}>; @@ -74,10 +86,12 @@ export class CloudBillingClient { constructor(opts?: ClientOptions) { // Ensure that options include the service address and port. const staticMembers = this.constructor as typeof CloudBillingClient; - const servicePath = opts && opts.servicePath ? - opts.servicePath : - ((opts && opts.apiEndpoint) ? opts.apiEndpoint : - staticMembers.servicePath); + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; const port = opts && opts.port ? opts.port : staticMembers.port; if (!opts) { @@ -87,8 +101,8 @@ export class CloudBillingClient { opts.port = opts.port || port; opts.clientConfig = opts.clientConfig || {}; - const isBrowser = (typeof window !== 'undefined'); - if (isBrowser){ + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { opts.fallback = true; } // If we are in browser, we are already using fallback because of the @@ -105,13 +119,10 @@ export class CloudBillingClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -127,12 +138,18 @@ export class CloudBillingClient { // For Node.js, pass the path to JSON proto file. // For browsers, pass the JSON content. - const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json'); + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); this._protos = this._gaxGrpc.loadProto( - opts.fallback ? - // eslint-disable-next-line @typescript-eslint/no-var-requires - require("../../protos/protos.json") : - nodejsProtoPath + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated @@ -154,16 +171,25 @@ export class CloudBillingClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listBillingAccounts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'billingAccounts'), - listProjectBillingInfo: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'projectBillingInfo') + listBillingAccounts: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'billingAccounts' + ), + listProjectBillingInfo: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'projectBillingInfo' + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.billing.v1.CloudBilling', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.billing.v1.CloudBilling', + 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 @@ -191,16 +217,29 @@ export class CloudBillingClient { // Put together the "service stub" for // google.cloud.billing.v1.CloudBilling. this.cloudBillingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.billing.v1.CloudBilling') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.billing.v1.CloudBilling' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.billing.v1.CloudBilling, - this._opts) as Promise<{[method: string]: Function}>; + this._opts + ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const cloudBillingStubMethods = - ['getBillingAccount', 'listBillingAccounts', 'updateBillingAccount', 'createBillingAccount', 'listProjectBillingInfo', 'getProjectBillingInfo', 'updateProjectBillingInfo', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions']; + const cloudBillingStubMethods = [ + 'getBillingAccount', + 'listBillingAccounts', + 'updateBillingAccount', + 'createBillingAccount', + 'listProjectBillingInfo', + 'getProjectBillingInfo', + 'updateProjectBillingInfo', + 'getIamPolicy', + 'setIamPolicy', + 'testIamPermissions', + ]; for (const methodName of cloudBillingStubMethods) { const callPromise = this.cloudBillingStub.then( stub => (...args: Array<{}>) => { @@ -210,16 +249,17 @@ export class CloudBillingClient { const func = stub[methodName]; return func.apply(stub, args); }, - (err: Error|null|undefined) => () => { + (err: Error | null | undefined) => () => { throw err; - }); + } + ); const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] ); this.innerApiCalls[methodName] = apiCall; @@ -255,9 +295,7 @@ export class CloudBillingClient { * in this service. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -267,8 +305,9 @@ export class CloudBillingClient { * @param {function(Error, string)} callback - the callback to * be called with the current project Id. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -280,62 +319,83 @@ export class CloudBillingClient { // -- Service calls -- // ------------------- getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IGetBillingAccountRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, + {} | undefined + ] + >; getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IGetBillingAccountRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IGetBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): void; getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IGetBillingAccountRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets information about a billing account. The current authenticated user - * must be a [viewer of the billing - * account](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account to retrieve. For example, - * `billingAccounts/012345-567890-ABCDEF`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IGetBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets information about a billing account. The current authenticated user + * must be a [viewer of the billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account to retrieve. For example, + * `billingAccounts/012345-567890-ABCDEF`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - optionsOrCallback?: gax.CallOptions|Callback< + request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IGetBillingAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IGetBillingAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IGetBillingAccountRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.billing.v1.IGetBillingAccountRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IGetBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IGetBillingAccountRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -344,75 +404,96 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); return this.innerApiCalls.getBillingAccount(request, options, callback); } updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest | undefined, + {} | undefined + ] + >; updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): void; updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|null|undefined, - {}|null|undefined>): void; -/** - * Updates a billing account's fields. - * Currently the only field that can be edited is `display_name`. - * The current authenticated user must have the `billing.accounts.update` - * IAM permission, which is typically given to the - * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) - * of the billing account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the billing account resource to be updated. - * @param {google.cloud.billing.v1.BillingAccount} request.account - * Required. The billing account resource to replace the resource on the server. - * @param {google.protobuf.FieldMask} request.updateMask - * The update mask applied to the resource. - * Only "display_name" is currently supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates a billing account's fields. + * Currently the only field that can be edited is `display_name`. + * The current authenticated user must have the `billing.accounts.update` + * IAM permission, which is typically given to the + * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) + * of the billing account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the billing account resource to be updated. + * @param {google.cloud.billing.v1.BillingAccount} request.account + * Required. The billing account resource to replace the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The update mask applied to the resource. + * Only "display_name" is currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.IUpdateBillingAccountRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.IUpdateBillingAccountRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -421,77 +502,98 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); return this.innerApiCalls.updateBillingAccount(request, options, callback); } createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.ICreateBillingAccountRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest | undefined, + {} | undefined + ] + >; createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.ICreateBillingAccountRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.ICreateBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): void; createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - callback: Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.ICreateBillingAccountRequest|null|undefined, - {}|null|undefined>): void; -/** - * Creates a billing account. - * This method can only be used to create - * [billing subaccounts](https://cloud.google.com/billing/docs/concepts) - * by GCP resellers. - * When creating a subaccount, the current authenticated user must have the - * `billing.accounts.update` IAM permission on the master account, which is - * typically given to billing account - * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). - * This method will return an error if the master account has not been - * provisioned as a reseller account. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.billing.v1.BillingAccount} request.billingAccount - * Required. The billing account resource to create. - * Currently CreateBillingAccount only supports subaccount creation, so - * any created billing accounts must be under a provided master billing - * account. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + callback: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.ICreateBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a billing account. + * This method can only be used to create + * [billing subaccounts](https://cloud.google.com/billing/docs/concepts) + * by GCP resellers. + * When creating a subaccount, the current authenticated user must have the + * `billing.accounts.update` IAM permission on the master account, which is + * typically given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * This method will return an error if the master account has not been + * provisioned as a reseller account. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.billing.v1.BillingAccount} request.billingAccount + * Required. The billing account resource to create. + * Currently CreateBillingAccount only supports subaccount creation, so + * any created billing accounts must be under a provided master billing + * account. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.ICreateBillingAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.ICreateBillingAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.billing.v1.IBillingAccount, - protos.google.cloud.billing.v1.ICreateBillingAccountRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.billing.v1.ICreateBillingAccountRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.billing.v1.IBillingAccount, + | protos.google.cloud.billing.v1.ICreateBillingAccountRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount, + protos.google.cloud.billing.v1.ICreateBillingAccountRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -499,63 +601,84 @@ export class CloudBillingClient { return this.innerApiCalls.createBillingAccount(request, options, callback); } getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest | undefined, + {} | undefined + ] + >; getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + > + ): void; getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets the billing information for a project. The current authenticated user - * must have [permission to view the - * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo - * ). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the project for which billing information is - * retrieved. For example, `projects/tokyo-rain-123`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets the billing information for a project. The current authenticated user + * must have [permission to view the + * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + * ). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the project for which billing information is + * retrieved. For example, `projects/tokyo-rain-123`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.billing.v1.IProjectBillingInfo, + protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -564,99 +687,126 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); return this.innerApiCalls.getProjectBillingInfo(request, options, callback); } updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|undefined, {}|undefined - ]>; + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IProjectBillingInfo, + ( + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | undefined + ), + {} | undefined + ] + >; updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + > + ): void; updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|null|undefined, - {}|null|undefined>): void; -/** - * Sets or updates the billing account associated with a project. You specify - * the new billing account by setting the `billing_account_name` in the - * `ProjectBillingInfo` resource to the resource name of a billing account. - * Associating a project with an open billing account enables billing on the - * project and allows charges for resource usage. If the project already had a - * billing account, this method changes the billing account used for resource - * usage charges. - * - * *Note:* Incurred charges that have not yet been reported in the transaction - * history of the GCP Console might be billed to the new billing - * account, even if the charge occurred before the new billing account was - * assigned to the project. - * - * The current authenticated user must have ownership privileges for both the - * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo - * ) and the [billing - * account](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * You can disable billing on the project by setting the - * `billing_account_name` field to empty. This action disassociates the - * current billing account from the project. Any billable activity of your - * in-use services will stop, and your application could stop functioning as - * expected. Any unbilled charges to date will be billed to the previously - * associated account. The current authenticated user must be either an owner - * of the project or an owner of the billing account for the project. - * - * Note that associating a project with a *closed* billing account will have - * much the same effect as disabling billing on the project: any paid - * resources used by the project will be shut down. Thus, unless you wish to - * disable billing, you should always call this method with the name of an - * *open* billing account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the project associated with the billing information - * that you want to update. For example, `projects/tokyo-rain-123`. - * @param {google.cloud.billing.v1.ProjectBillingInfo} request.projectBillingInfo - * The new billing information for the project. Read-only fields are ignored; - * thus, you can leave empty all fields except `billing_account_name`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Sets or updates the billing account associated with a project. You specify + * the new billing account by setting the `billing_account_name` in the + * `ProjectBillingInfo` resource to the resource name of a billing account. + * Associating a project with an open billing account enables billing on the + * project and allows charges for resource usage. If the project already had a + * billing account, this method changes the billing account used for resource + * usage charges. + * + * *Note:* Incurred charges that have not yet been reported in the transaction + * history of the GCP Console might be billed to the new billing + * account, even if the charge occurred before the new billing account was + * assigned to the project. + * + * The current authenticated user must have ownership privileges for both the + * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + * ) and the [billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * You can disable billing on the project by setting the + * `billing_account_name` field to empty. This action disassociates the + * current billing account from the project. Any billable activity of your + * in-use services will stop, and your application could stop functioning as + * expected. Any unbilled charges to date will be billed to the previously + * associated account. The current authenticated user must be either an owner + * of the project or an owner of the billing account for the project. + * + * Note that associating a project with a *closed* billing account will have + * much the same effect as disabling billing on the project: any paid + * resources used by the project will be shut down. Thus, unless you wish to + * disable billing, you should always call this method with the name of an + * *open* billing account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the project associated with the billing information + * that you want to update. For example, `projects/tokyo-rain-123`. + * @param {google.cloud.billing.v1.ProjectBillingInfo} request.projectBillingInfo + * The new billing information for the project. Read-only fields are ignored; + * thus, you can leave empty all fields except `billing_account_name`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - optionsOrCallback?: gax.CallOptions|Callback< + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.billing.v1.IProjectBillingInfo, - protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.billing.v1.IProjectBillingInfo, + ( + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | undefined + ), + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -665,68 +815,85 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); - return this.innerApiCalls.updateProjectBillingInfo(request, options, callback); + return this.innerApiCalls.updateProjectBillingInfo( + request, + options, + callback + ); } getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; + request: protos.google.iam.v1.IGetIamPolicyRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + ] + >; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; -/** - * Gets the access control policy for a billing account. - * The caller must have the `billing.accounts.getIamPolicy` permission on the - * account, which is often given to billing account - * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {} request. - * @param {} request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Gets the access control policy for a billing account. + * The caller must have the `billing.accounts.getIamPolicy` permission on the + * account, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {} request. + * @param {} request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -735,69 +902,82 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', + resource: request.resource || '', }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; + request: protos.google.iam.v1.ISetIamPolicyRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + ] + >; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; -/** - * Sets the access control policy for a billing account. Replaces any existing - * policy. - * The caller must have the `billing.accounts.setIamPolicy` permission on the - * account, which is often given to billing account - * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {} request. - * @param {} request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Sets the access control policy for a billing account. Replaces any existing + * policy. + * The caller must have the `billing.accounts.setIamPolicy` permission on the + * account, which is often given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {} request. + * @param {} request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: gax.CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -806,67 +986,80 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', + resource: request.resource || '', }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + ] + >; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: gax.CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: gax.CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): void; testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; -/** - * Tests the access control policy for a billing account. This method takes - * the resource and a set of permissions as input and returns the subset of - * the input permissions that the caller is allowed for that resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {} request. - * @param {} request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Tests the access control policy for a billing account. This method takes + * the resource and a set of permissions as input and returns the subset of + * the input permissions that the caller is allowed for that resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {} request. + * @param {} request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: gax.CallOptions|Callback< + request: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest | undefined, + {} | undefined + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -875,94 +1068,113 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', + resource: request.resource || '', }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); } listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.IBillingAccount[], - protos.google.cloud.billing.v1.IListBillingAccountsRequest|null, - protos.google.cloud.billing.v1.IListBillingAccountsResponse - ]>; + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount[], + protos.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protos.google.cloud.billing.v1.IListBillingAccountsResponse + ] + >; listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListBillingAccountsRequest, - protos.google.cloud.billing.v1.IListBillingAccountsResponse|null|undefined, - protos.google.cloud.billing.v1.IBillingAccount>): void; + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount + > + ): void; listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListBillingAccountsRequest, - protos.google.cloud.billing.v1.IListBillingAccountsResponse|null|undefined, - protos.google.cloud.billing.v1.IBillingAccount>): void; -/** - * Lists the billing accounts that the current authenticated user has - * permission to - * [view](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListBillingAccounts` - * call. If unspecified, the first page of results is returned. - * @param {string} request.filter - * Options for how to filter the returned billing accounts. - * Currently this only supports filtering for - * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a - * single provided reseller billing account. - * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). - * Boolean algebra and other fields are not currently supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListBillingAccountsRequest]{@link google.cloud.billing.v1.ListBillingAccountsRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListBillingAccountsResponse]{@link google.cloud.billing.v1.ListBillingAccountsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount + > + ): void; + /** + * Lists the billing accounts that the current authenticated user has + * permission to + * [view](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListBillingAccountsRequest]{@link google.cloud.billing.v1.ListBillingAccountsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListBillingAccountsResponse]{@link google.cloud.billing.v1.ListBillingAccountsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - optionsOrCallback?: gax.CallOptions|PaginationCallback< + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + optionsOrCallback?: + | gax.CallOptions + | PaginationCallback< protos.google.cloud.billing.v1.IListBillingAccountsRequest, - protos.google.cloud.billing.v1.IListBillingAccountsResponse|null|undefined, - protos.google.cloud.billing.v1.IBillingAccount>, - callback?: PaginationCallback< - protos.google.cloud.billing.v1.IListBillingAccountsRequest, - protos.google.cloud.billing.v1.IListBillingAccountsResponse|null|undefined, - protos.google.cloud.billing.v1.IBillingAccount>): - Promise<[ - protos.google.cloud.billing.v1.IBillingAccount[], - protos.google.cloud.billing.v1.IListBillingAccountsRequest|null, - protos.google.cloud.billing.v1.IListBillingAccountsResponse - ]>|void { + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount + >, + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount + > + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount[], + protos.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protos.google.cloud.billing.v1.IListBillingAccountsResponse + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -970,44 +1182,44 @@ export class CloudBillingClient { return this.innerApiCalls.listBillingAccounts(request, options, callback); } -/** - * Equivalent to {@link listBillingAccounts}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listBillingAccounts} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListBillingAccounts` - * call. If unspecified, the first page of results is returned. - * @param {string} request.filter - * Options for how to filter the returned billing accounts. - * Currently this only supports filtering for - * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a - * single provided reseller billing account. - * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). - * Boolean algebra and other fields are not currently supported. - * @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 [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} on 'data' event. - */ + /** + * Equivalent to {@link listBillingAccounts}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listBillingAccounts} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @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 [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} on 'data' event. + */ listBillingAccountsStream( - request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions): - Transform{ + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions + ): Transform { request = request || {}; options = options || {}; const callSettings = new gax.CallSettings(options); @@ -1019,36 +1231,36 @@ export class CloudBillingClient { ); } -/** - * Equivalent to {@link listBillingAccounts}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListBillingAccounts` - * call. If unspecified, the first page of results is returned. - * @param {string} request.filter - * Options for how to filter the returned billing accounts. - * Currently this only supports filtering for - * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a - * single provided reseller billing account. - * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). - * Boolean algebra and other fields are not currently supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ + /** + * Equivalent to {@link listBillingAccounts}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + * @param {string} request.filter + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listBillingAccountsAsync( - request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions): - AsyncIterable{ + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: gax.CallOptions + ): AsyncIterable { request = request || {}; options = options || {}; options = options || {}; @@ -1056,89 +1268,108 @@ export class CloudBillingClient { this.initialize(); return this.descriptors.page.listBillingAccounts.asyncIterate( this.innerApiCalls['listBillingAccounts'] as GaxCall, - request as unknown as RequestType, + (request as unknown) as RequestType, callSettings ) as AsyncIterable; } listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.IProjectBillingInfo[], - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest|null, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - ]>; + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IProjectBillingInfo[], + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + ] + >; listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse|null|undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo>): void; + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo + > + ): void; listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse|null|undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo>): void; -/** - * Lists the projects associated with a billing account. The current - * authenticated user must have the `billing.resourceAssociations.list` IAM - * permission, which is often given to billing account - * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account associated with the projects that - * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous `ListProjectBillingInfo` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListProjectBillingInfoRequest]{@link google.cloud.billing.v1.ListProjectBillingInfoRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListProjectBillingInfoResponse]{@link google.cloud.billing.v1.ListProjectBillingInfoResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo + > + ): void; + /** + * Lists the projects associated with a billing account. The current + * authenticated user must have the `billing.resourceAssociations.list` IAM + * permission, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProjectBillingInfoRequest]{@link google.cloud.billing.v1.ListProjectBillingInfoRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProjectBillingInfoResponse]{@link google.cloud.billing.v1.ListProjectBillingInfoResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - optionsOrCallback?: gax.CallOptions|PaginationCallback< - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse|null|undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo>, - callback?: PaginationCallback< + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + optionsOrCallback?: + | gax.CallOptions + | PaginationCallback< protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse|null|undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo>): - Promise<[ - protos.google.cloud.billing.v1.IProjectBillingInfo[], - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest|null, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - ]>|void { + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo + >, + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo + > + ): Promise< + [ + protos.google.cloud.billing.v1.IProjectBillingInfo[], + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -1147,46 +1378,50 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); this.initialize(); - return this.innerApiCalls.listProjectBillingInfo(request, options, callback); + return this.innerApiCalls.listProjectBillingInfo( + request, + options, + callback + ); } -/** - * Equivalent to {@link listProjectBillingInfo}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProjectBillingInfo} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account associated with the projects that - * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous `ListProjectBillingInfo` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} on 'data' event. - */ + /** + * Equivalent to {@link listProjectBillingInfo}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProjectBillingInfo} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} on 'data' event. + */ listProjectBillingInfoStream( - request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions): - Transform{ + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1194,7 +1429,7 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); const callSettings = new gax.CallSettings(options); this.initialize(); @@ -1205,32 +1440,32 @@ export class CloudBillingClient { ); } -/** - * Equivalent to {@link listProjectBillingInfo}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account associated with the projects that - * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. - * @param {number} request.pageSize - * Requested page size. The maximum page size is 100; this is also the - * default. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous `ListProjectBillingInfo` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ + /** + * Equivalent to {@link listProjectBillingInfo}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @param {number} request.pageSize + * Requested page size. The maximum page size is 100; this is also the + * default. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listProjectBillingInfoAsync( - request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions): - AsyncIterable{ + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: gax.CallOptions + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1238,14 +1473,14 @@ export class CloudBillingClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'name': request.name || '', + name: request.name || '', }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listProjectBillingInfo.asyncIterate( this.innerApiCalls['listProjectBillingInfo'] as GaxCall, - request as unknown as RequestType, + (request as unknown) as RequestType, callSettings ) as AsyncIterable; } @@ -1259,7 +1494,7 @@ export class CloudBillingClient { * @param {string} billing_account * @returns {string} Resource name string. */ - billingAccountPath(billingAccount:string) { + billingAccountPath(billingAccount: string) { return this.pathTemplates.billingAccountPathTemplate.render({ billing_account: billingAccount, }); @@ -1273,7 +1508,9 @@ export class CloudBillingClient { * @returns {string} A string representing the billing_account. */ matchBillingAccountFromBillingAccountName(billingAccountName: string) { - return this.pathTemplates.billingAccountPathTemplate.match(billingAccountName).billing_account; + return this.pathTemplates.billingAccountPathTemplate.match( + billingAccountName + ).billing_account; } /** @@ -1282,7 +1519,7 @@ export class CloudBillingClient { * @param {string} service * @returns {string} Resource name string. */ - servicePath(service:string) { + servicePath(service: string) { return this.pathTemplates.servicePathTemplate.render({ service: service, }); @@ -1306,7 +1543,7 @@ export class CloudBillingClient { * @param {string} sku * @returns {string} Resource name string. */ - skuPath(service:string,sku:string) { + skuPath(service: string, sku: string) { return this.pathTemplates.skuPathTemplate.render({ service: service, sku: sku, diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 134baee9e2b..b32427443de 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -17,11 +17,18 @@ // ** All changes to this file may be overwritten. ** import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; import * as path from 'path'; -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import * as gapicConfig from './cloud_catalog_client_config.json'; @@ -42,7 +49,12 @@ export class CloudCatalogClient { private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; auth: gax.GoogleAuth; - descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}, batching: {}}; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; cloudCatalogStub?: Promise<{[name: string]: Function}>; @@ -76,10 +88,12 @@ export class CloudCatalogClient { constructor(opts?: ClientOptions) { // Ensure that options include the service address and port. const staticMembers = this.constructor as typeof CloudCatalogClient; - const servicePath = opts && opts.servicePath ? - opts.servicePath : - ((opts && opts.apiEndpoint) ? opts.apiEndpoint : - staticMembers.servicePath); + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; const port = opts && opts.port ? opts.port : staticMembers.port; if (!opts) { @@ -89,8 +103,8 @@ export class CloudCatalogClient { opts.port = opts.port || port; opts.clientConfig = opts.clientConfig || {}; - const isBrowser = (typeof window !== 'undefined'); - if (isBrowser){ + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { opts.fallback = true; } // If we are in browser, we are already using fallback because of the @@ -107,13 +121,10 @@ export class CloudCatalogClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -129,12 +140,18 @@ export class CloudCatalogClient { // For Node.js, pass the path to JSON proto file. // For browsers, pass the JSON content. - const nodejsProtoPath = path.join(__dirname, '..', '..', 'protos', 'protos.json'); + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); this._protos = this._gaxGrpc.loadProto( - opts.fallback ? - // eslint-disable-next-line @typescript-eslint/no-var-requires - require("../../protos/protos.json") : - nodejsProtoPath + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath ); // This API contains "path templates"; forward-slash-separated @@ -153,16 +170,25 @@ export class CloudCatalogClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listSkus: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'skus') + listServices: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'services' + ), + listSkus: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'skus' + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.billing.v1.CloudCatalog', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.billing.v1.CloudCatalog', + 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 @@ -190,16 +216,18 @@ export class CloudCatalogClient { // Put together the "service stub" for // google.cloud.billing.v1.CloudCatalog. this.cloudCatalogStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.billing.v1.CloudCatalog') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.billing.v1.CloudCatalog' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.billing.v1.CloudCatalog, - this._opts) as Promise<{[method: string]: Function}>; + this._opts + ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const cloudCatalogStubMethods = - ['listServices', 'listSkus']; + const cloudCatalogStubMethods = ['listServices', 'listSkus']; for (const methodName of cloudCatalogStubMethods) { const callPromise = this.cloudCatalogStub.then( stub => (...args: Array<{}>) => { @@ -209,16 +237,17 @@ export class CloudCatalogClient { const func = stub[methodName]; return func.apply(stub, args); }, - (err: Error|null|undefined) => () => { + (err: Error | null | undefined) => () => { throw err; - }); + } + ); const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + this.descriptors.stream[methodName] || + this.descriptors.longrunning[methodName] ); this.innerApiCalls[methodName] = apiCall; @@ -254,9 +283,7 @@ export class CloudCatalogClient { * in this service. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -266,8 +293,9 @@ export class CloudCatalogClient { * @param {function(Error, string)} callback - the callback to * be called with the current project Id. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -280,77 +308,90 @@ export class CloudCatalogClient { // ------------------- listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.IService[], - protos.google.cloud.billing.v1.IListServicesRequest|null, - protos.google.cloud.billing.v1.IListServicesResponse - ]>; + request: protos.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IService[], + protos.google.cloud.billing.v1.IListServicesRequest | null, + protos.google.cloud.billing.v1.IListServicesResponse + ] + >; listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListServicesRequest, - protos.google.cloud.billing.v1.IListServicesResponse|null|undefined, - protos.google.cloud.billing.v1.IService>): void; + request: protos.google.cloud.billing.v1.IListServicesRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, + protos.google.cloud.billing.v1.IService + > + ): void; listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListServicesRequest, - protos.google.cloud.billing.v1.IListServicesResponse|null|undefined, - protos.google.cloud.billing.v1.IService>): void; -/** - * Lists all public cloud services. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListServices` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Service]{@link google.cloud.billing.v1.Service}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Service]{@link google.cloud.billing.v1.Service} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListServicesRequest]{@link google.cloud.billing.v1.ListServicesRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListServicesResponse]{@link google.cloud.billing.v1.ListServicesResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IListServicesRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, + protos.google.cloud.billing.v1.IService + > + ): void; + /** + * Lists all public cloud services. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Service]{@link google.cloud.billing.v1.Service}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Service]{@link google.cloud.billing.v1.Service} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListServicesRequest]{@link google.cloud.billing.v1.ListServicesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListServicesResponse]{@link google.cloud.billing.v1.ListServicesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, - optionsOrCallback?: gax.CallOptions|PaginationCallback< - protos.google.cloud.billing.v1.IListServicesRequest, - protos.google.cloud.billing.v1.IListServicesResponse|null|undefined, - protos.google.cloud.billing.v1.IService>, - callback?: PaginationCallback< + request: protos.google.cloud.billing.v1.IListServicesRequest, + optionsOrCallback?: + | gax.CallOptions + | PaginationCallback< protos.google.cloud.billing.v1.IListServicesRequest, - protos.google.cloud.billing.v1.IListServicesResponse|null|undefined, - protos.google.cloud.billing.v1.IService>): - Promise<[ - protos.google.cloud.billing.v1.IService[], - protos.google.cloud.billing.v1.IListServicesRequest|null, - protos.google.cloud.billing.v1.IListServicesResponse - ]>|void { + | protos.google.cloud.billing.v1.IListServicesResponse + | null + | undefined, + protos.google.cloud.billing.v1.IService + >, + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListServicesRequest, + protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, + protos.google.cloud.billing.v1.IService + > + ): Promise< + [ + protos.google.cloud.billing.v1.IService[], + protos.google.cloud.billing.v1.IListServicesRequest | null, + protos.google.cloud.billing.v1.IListServicesResponse + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -358,36 +399,36 @@ export class CloudCatalogClient { return this.innerApiCalls.listServices(request, options, callback); } -/** - * Equivalent to {@link listServices}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listServices} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListServices` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Service]{@link google.cloud.billing.v1.Service} on 'data' event. - */ + /** + * Equivalent to {@link listServices}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listServices} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Service]{@link google.cloud.billing.v1.Service} on 'data' event. + */ listServicesStream( - request?: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions): - Transform{ + request?: protos.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions + ): Transform { request = request || {}; options = options || {}; const callSettings = new gax.CallSettings(options); @@ -399,28 +440,28 @@ export class CloudCatalogClient { ); } -/** - * Equivalent to {@link listServices}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListServices` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ + /** + * Equivalent to {@link listServices}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listServicesAsync( - request?: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions): - AsyncIterable{ + request?: protos.google.cloud.billing.v1.IListServicesRequest, + options?: gax.CallOptions + ): AsyncIterable { request = request || {}; options = options || {}; options = options || {}; @@ -428,103 +469,114 @@ export class CloudCatalogClient { this.initialize(); return this.descriptors.page.listServices.asyncIterate( this.innerApiCalls['listServices'] as GaxCall, - request as unknown as RequestType, + (request as unknown) as RequestType, callSettings ) as AsyncIterable; } listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions): - Promise<[ - protos.google.cloud.billing.v1.ISku[], - protos.google.cloud.billing.v1.IListSkusRequest|null, - protos.google.cloud.billing.v1.IListSkusResponse - ]>; + request: protos.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.ISku[], + protos.google.cloud.billing.v1.IListSkusRequest | null, + protos.google.cloud.billing.v1.IListSkusResponse + ] + >; listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - options: gax.CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse|null|undefined, - protos.google.cloud.billing.v1.ISku>): void; + request: protos.google.cloud.billing.v1.IListSkusRequest, + options: gax.CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku + > + ): void; listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse|null|undefined, - protos.google.cloud.billing.v1.ISku>): void; -/** - * Lists all publicly available SKUs for a given cloud service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the service. - * Example: "services/DA34-426B-A397" - * @param {google.protobuf.Timestamp} request.startTime - * Optional inclusive start time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {google.protobuf.Timestamp} request.endTime - * Optional exclusive end time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {string} request.currencyCode - * The ISO 4217 currency code for the pricing info in the response proto. - * Will use the conversion rate as of start_time. - * Optional. If not specified USD will be used. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListSkus` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Sku]{@link google.cloud.billing.v1.Sku}. - * The client library support auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Sku]{@link google.cloud.billing.v1.Sku} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListSkusRequest]{@link google.cloud.billing.v1.ListSkusRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListSkusResponse]{@link google.cloud.billing.v1.ListSkusResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + request: protos.google.cloud.billing.v1.IListSkusRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku + > + ): void; + /** + * Lists all publicly available SKUs for a given cloud service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Sku]{@link google.cloud.billing.v1.Sku}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Sku]{@link google.cloud.billing.v1.Sku} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListSkusRequest]{@link google.cloud.billing.v1.ListSkusRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListSkusResponse]{@link google.cloud.billing.v1.ListSkusResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - optionsOrCallback?: gax.CallOptions|PaginationCallback< - protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse|null|undefined, - protos.google.cloud.billing.v1.ISku>, - callback?: PaginationCallback< + request: protos.google.cloud.billing.v1.IListSkusRequest, + optionsOrCallback?: + | gax.CallOptions + | PaginationCallback< protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse|null|undefined, - protos.google.cloud.billing.v1.ISku>): - Promise<[ - protos.google.cloud.billing.v1.ISku[], - protos.google.cloud.billing.v1.IListSkusRequest|null, - protos.google.cloud.billing.v1.IListSkusResponse - ]>|void { + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku + >, + callback?: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku + > + ): Promise< + [ + protos.google.cloud.billing.v1.ISku[], + protos.google.cloud.billing.v1.IListSkusRequest | null, + protos.google.cloud.billing.v1.IListSkusResponse + ] + > | void { request = request || {}; let options: gax.CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as gax.CallOptions; } options = options || {}; @@ -533,63 +585,63 @@ export class CloudCatalogClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', + parent: request.parent || '', }); this.initialize(); return this.innerApiCalls.listSkus(request, options, callback); } -/** - * Equivalent to {@link listSkus}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listSkus} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the service. - * Example: "services/DA34-426B-A397" - * @param {google.protobuf.Timestamp} request.startTime - * Optional inclusive start time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {google.protobuf.Timestamp} request.endTime - * Optional exclusive end time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {string} request.currencyCode - * The ISO 4217 currency code for the pricing info in the response proto. - * Will use the conversion rate as of start_time. - * Optional. If not specified USD will be used. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListSkus` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Sku]{@link google.cloud.billing.v1.Sku} on 'data' event. - */ + /** + * Equivalent to {@link listSkus}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listSkus} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Sku]{@link google.cloud.billing.v1.Sku} on 'data' event. + */ listSkusStream( - request?: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions): - Transform{ + request?: protos.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -597,7 +649,7 @@ export class CloudCatalogClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', + parent: request.parent || '', }); const callSettings = new gax.CallSettings(options); this.initialize(); @@ -608,49 +660,49 @@ export class CloudCatalogClient { ); } -/** - * Equivalent to {@link listSkus}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the service. - * Example: "services/DA34-426B-A397" - * @param {google.protobuf.Timestamp} request.startTime - * Optional inclusive start time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {google.protobuf.Timestamp} request.endTime - * Optional exclusive end time of the time range for which the pricing - * versions will be returned. Timestamps in the future are not allowed. - * The time range has to be within a single calendar month in - * America/Los_Angeles timezone. Time range as a whole is optional. If not - * specified, the latest pricing will be returned (up to 12 hours old at - * most). - * @param {string} request.currencyCode - * The ISO 4217 currency code for the pricing info in the response proto. - * Will use the conversion rate as of start_time. - * Optional. If not specified USD will be used. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListSkus` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - */ + /** + * Equivalent to {@link listSkus}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + * @param {google.protobuf.Timestamp} request.startTime + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {google.protobuf.Timestamp} request.endTime + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + * @param {string} request.currencyCode + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ listSkusAsync( - request?: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions): - AsyncIterable{ + request?: protos.google.cloud.billing.v1.IListSkusRequest, + options?: gax.CallOptions + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -658,14 +710,14 @@ export class CloudCatalogClient { options.otherArgs.headers[ 'x-goog-request-params' ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', + parent: request.parent || '', }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listSkus.asyncIterate( this.innerApiCalls['listSkus'] as GaxCall, - request as unknown as RequestType, + (request as unknown) as RequestType, callSettings ) as AsyncIterable; } @@ -679,7 +731,7 @@ export class CloudCatalogClient { * @param {string} service * @returns {string} Resource name string. */ - servicePath(service:string) { + servicePath(service: string) { return this.pathTemplates.servicePathTemplate.render({ service: service, }); @@ -703,7 +755,7 @@ export class CloudCatalogClient { * @param {string} sku * @returns {string} Resource name string. */ - skuPath(service:string,sku:string) { + skuPath(service: string, sku: string) { return this.pathTemplates.skuPathTemplate.render({ service: service, sku: sku, diff --git a/packages/google-cloud-billing/src/v1/index.ts b/packages/google-cloud-billing/src/v1/index.ts index 993df647509..6e2f971b42f 100644 --- a/packages/google-cloud-billing/src/v1/index.ts +++ b/packages/google-cloud-billing/src/v1/index.ts @@ -16,4 +16,5 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {CloudBillingClient} from './cloud_billing_client';export {CloudCatalogClient} from './cloud_catalog_client'; +export {CloudBillingClient} from './cloud_billing_client'; +export {CloudCatalogClient} from './cloud_catalog_client'; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index c956dc4c149..82a1ee4f712 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "43ace7738fb9d675bfad6628a11c372924d53d07" + "sha": "06e78d4b9d3a7dceb92789ffd442e7385f71f61b" } }, { diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js index e2595373d29..44b4cebd3a2 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js @@ -16,7 +16,6 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** - /* eslint-disable node/no-missing-require, no-unused-vars */ const billing = require('@google-cloud/billing'); diff --git a/packages/google-cloud-billing/system-test/install.ts b/packages/google-cloud-billing/system-test/install.ts index 5e4ed636481..4c1ba3eb79a 100644 --- a/packages/google-cloud-billing/system-test/install.ts +++ b/packages/google-cloud-billing/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; describe('typescript consumer tests', () => { - - it('should have correct type signature for typescript users', async function() { + it('should have correct type signature for typescript users', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), // path to your module. sample: { description: 'typescript based user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); // will throw upon error. }); - it('should have correct type signature for javascript users', async function() { + it('should have correct type signature for javascript users', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), // path to your module. sample: { description: 'typescript based user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); // will throw upon error. }); - }); diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index f5d2166679b..87046296bd1 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -20,7 +20,7 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; +import {describe, it} from 'mocha'; import * as cloudbillingModule from '../src'; import {PassThrough} from 'stream'; @@ -28,1281 +28,1778 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.CloudBillingClient', () => { - it('has servicePath', () => { - const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; - assert(servicePath); + it('has servicePath', () => { + const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudbillingModule.v1.CloudBillingClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudbillingModule.v1.CloudBillingClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + fallback: true, }); + assert(client); + }); - it('has apiEndpoint', () => { - const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; - assert(apiEndpoint); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', }); - - it('has port', () => { - const port = cloudbillingModule.v1.CloudBillingClient.port; - assert(port); - assert(typeof port === 'number'); + assert.strictEqual(client.cloudBillingStub, undefined); + await client.initialize(); + assert(client.cloudBillingStub); + }); + + it('has close method', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', }); - - it('should create a client with no option', () => { - const client = new cloudbillingModule.v1.CloudBillingClient(); - assert(client); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - fallback: true, - }); - assert(client); + 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 cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudBillingStub, undefined); - await client.initialize(); - assert(client.cloudBillingStub); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); - - it('has close method', () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.close(); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getBillingAccount', () => { + it('invokes getBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.getBillingAccount = stubSimpleCall(expectedResponse); + const [response] = await client.getBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudbillingModule.v1.CloudBillingClient({ - 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('invokes getBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.getBillingAccount = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getBillingAccount( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IBillingAccount | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('invokes getBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getBillingAccount = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getBillingAccount(request); + }, expectedError); + assert( + (client.innerApiCalls.getBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - - describe('getBillingAccount', () => { - it('invokes getBillingAccount without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetBillingAccountRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); - client.innerApiCalls.getBillingAccount = stubSimpleCall(expectedResponse); - const [response] = await client.getBillingAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getBillingAccount without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetBillingAccountRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); - client.innerApiCalls.getBillingAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBillingAccount( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.IBillingAccount|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getBillingAccount with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetBillingAccountRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getBillingAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.getBillingAccount(request); }, expectedError); - assert((client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + + describe('updateBillingAccount', () => { + it('invokes updateBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.updateBillingAccount = stubSimpleCall( + expectedResponse + ); + const [response] = await client.updateBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - describe('updateBillingAccount', () => { - it('invokes updateBillingAccount without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateBillingAccountRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); - client.innerApiCalls.updateBillingAccount = stubSimpleCall(expectedResponse); - const [response] = await client.updateBillingAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateBillingAccount without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateBillingAccountRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); - client.innerApiCalls.updateBillingAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBillingAccount( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.IBillingAccount|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateBillingAccount with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateBillingAccountRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBillingAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.updateBillingAccount(request); }, expectedError); - assert((client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes updateBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.updateBillingAccount = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateBillingAccount( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IBillingAccount | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('createBillingAccount', () => { - it('invokes createBillingAccount without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.CreateBillingAccountRequest()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); - client.innerApiCalls.createBillingAccount = stubSimpleCall(expectedResponse); - const [response] = await client.createBillingAccount(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createBillingAccount without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.CreateBillingAccountRequest()); - const expectedOptions = {}; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()); - client.innerApiCalls.createBillingAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBillingAccount( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.IBillingAccount|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes updateBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBillingAccount = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.updateBillingAccount(request); + }, expectedError); + assert( + (client.innerApiCalls.updateBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createBillingAccount', () => { + it('invokes createBillingAccount without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.CreateBillingAccountRequest() + ); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.createBillingAccount = stubSimpleCall( + expectedResponse + ); + const [response] = await client.createBillingAccount(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes createBillingAccount with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.CreateBillingAccountRequest()); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.createBillingAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.createBillingAccount(request); }, expectedError); - assert((client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes createBillingAccount without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.CreateBillingAccountRequest() + ); + const expectedOptions = {}; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ); + client.innerApiCalls.createBillingAccount = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.createBillingAccount( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IBillingAccount | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('getProjectBillingInfo', () => { - it('invokes getProjectBillingInfo without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()); - client.innerApiCalls.getProjectBillingInfo = stubSimpleCall(expectedResponse); - const [response] = await client.getProjectBillingInfo(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes createBillingAccount with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.CreateBillingAccountRequest() + ); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.createBillingAccount = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.createBillingAccount(request); + }, expectedError); + assert( + (client.innerApiCalls.createBillingAccount as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getProjectBillingInfo', () => { + it('invokes getProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCall( + expectedResponse + ); + const [response] = await client.getProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes getProjectBillingInfo without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()); - client.innerApiCalls.getProjectBillingInfo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProjectBillingInfo( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.IProjectBillingInfo|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes getProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getProjectBillingInfo( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IProjectBillingInfo | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes getProjectBillingInfo with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getProjectBillingInfo = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.getProjectBillingInfo(request); }, expectedError); - assert((client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getProjectBillingInfo = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getProjectBillingInfo(request); + }, expectedError); + assert( + (client.innerApiCalls.getProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateProjectBillingInfo', () => { + it('invokes updateProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall( + expectedResponse + ); + const [response] = await client.updateProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - describe('updateProjectBillingInfo', () => { - it('invokes updateProjectBillingInfo without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()); - client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall(expectedResponse); - const [response] = await client.updateProjectBillingInfo(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes updateProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.updateProjectBillingInfo( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IProjectBillingInfo | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes updateProjectBillingInfo without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()); - client.innerApiCalls.updateProjectBillingInfo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProjectBillingInfo( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.IProjectBillingInfo|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes updateProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.updateProjectBillingInfo(request); + }, expectedError); + assert( + (client.innerApiCalls.updateProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes updateProjectBillingInfo with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.updateProjectBillingInfo(request); }, expectedError); - assert((client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.IPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getIamPolicy(request); + }, expectedError); + assert( + (client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.Policy() + ); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.IPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes getIamPolicy with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.getIamPolicy(request); }, expectedError); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.setIamPolicy(request); + }, expectedError); + assert( + (client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCall( + expectedResponse + ); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsResponse() + ); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + ( + err?: Error | null, + result?: protos.google.iam.v1.ITestIamPermissionsResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes testIamPermissions with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.testIamPermissions(request); + }, expectedError); + assert( + (client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listBillingAccounts', () => { + it('invokes listBillingAccounts without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + ]; + client.innerApiCalls.listBillingAccounts = stubSimpleCall( + expectedResponse + ); + const [response] = await client.listBillingAccounts(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes setIamPolicy with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.setIamPolicy(request); }, expectedError); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes listBillingAccounts without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + ]; + client.innerApiCalls.listBillingAccounts = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listBillingAccounts( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IBillingAccount[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes listBillingAccounts with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listBillingAccounts = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.listBillingAccounts(request); + }, expectedError); + assert( + (client.innerApiCalls.listBillingAccounts as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + it('invokes listBillingAccountsStream without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + ]; + client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listBillingAccountsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.BillingAccount) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes testIamPermissions with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.testIamPermissions(request); }, expectedError); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listBillingAccounts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBillingAccounts, request) + ); }); - describe('listBillingAccounts', () => { - it('invokes listBillingAccounts without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); - const expectedOptions = {}; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - ]; - client.innerApiCalls.listBillingAccounts = stubSimpleCall(expectedResponse); - const [response] = await client.listBillingAccounts(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listBillingAccounts without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); - const expectedOptions = {}; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - ]; - client.innerApiCalls.listBillingAccounts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBillingAccounts( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.IBillingAccount[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + it('invokes listBillingAccountsStream with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listBillingAccountsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.BillingAccount) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listBillingAccounts with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.listBillingAccounts = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.listBillingAccounts(request); }, expectedError); - assert((client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(async () => { + await promise; + }, expectedError); + assert( + (client.descriptors.page.listBillingAccounts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBillingAccounts, request) + ); + }); - it('invokes listBillingAccountsStream without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - ]; - client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBillingAccountsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.BillingAccount) => { - 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.listBillingAccounts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBillingAccounts, request)); - }); + it('uses async iteration with listBillingAccounts without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.BillingAccount() + ), + ]; + client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; + const iterable = client.listBillingAccountsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBillingAccounts + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + }); - it('invokes listBillingAccountsStream with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest()); - const expectedError = new Error('expected'); - client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBillingAccountsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.BillingAccount) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(async () => { await promise; }, expectedError); - assert((client.descriptors.page.listBillingAccounts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBillingAccounts, request)); - }); + it('uses async iteration with listBillingAccounts with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListBillingAccountsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listBillingAccountsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBillingAccounts + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + }); + }); + + describe('listProjectBillingInfo', () => { + it('invokes listProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + ]; + client.innerApiCalls.listProjectBillingInfo = stubSimpleCall( + expectedResponse + ); + const [response] = await client.listProjectBillingInfo(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('uses async iteration with listBillingAccounts without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest());const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - generateSampleMessage(new protos.google.cloud.billing.v1.BillingAccount()), - ]; - client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; - const iterable = client.listBillingAccountsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listProjectBillingInfo without error using callback', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + ]; + client.innerApiCalls.listProjectBillingInfo = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listProjectBillingInfo( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IProjectBillingInfo[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBillingAccounts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listBillingAccounts with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListBillingAccountsRequest());const expectedError = new Error('expected'); - client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBillingAccountsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBillingAccounts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - describe('listProjectBillingInfo', () => { - it('invokes listProjectBillingInfo without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - ]; - client.innerApiCalls.listProjectBillingInfo = stubSimpleCall(expectedResponse); - const [response] = await client.listProjectBillingInfo(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listProjectBillingInfo without error using callback', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - ]; - client.innerApiCalls.listProjectBillingInfo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProjectBillingInfo( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.IProjectBillingInfo[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); + it('invokes listProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProjectBillingInfo = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.listProjectBillingInfo(request); + }, expectedError); + assert( + (client.innerApiCalls.listProjectBillingInfo as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('invokes listProjectBillingInfo with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listProjectBillingInfo = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.listProjectBillingInfo(request); }, expectedError); - assert((client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + it('invokes listProjectBillingInfoStream without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + ]; + client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listProjectBillingInfoStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listProjectBillingInfoStream without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - ]; - client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listProjectBillingInfoStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { - 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.listProjectBillingInfo.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProjectBillingInfo, request)); - assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProjectBillingInfo, request) + ); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); - it('invokes listProjectBillingInfoStream with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedError = new Error('expected'); - client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listProjectBillingInfoStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(async () => { await promise; }, expectedError); - assert((client.descriptors.page.listProjectBillingInfo.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProjectBillingInfo, request)); - assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + it('invokes listProjectBillingInfoStream with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listProjectBillingInfoStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listProjectBillingInfo without error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name=";const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - generateSampleMessage(new protos.google.cloud.billing.v1.ProjectBillingInfo()), - ]; - client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; - const iterable = client.listProjectBillingInfoAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listProjectBillingInfo.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(async () => { + await promise; + }, expectedError); + assert( + (client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProjectBillingInfo, request) + ); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); - it('uses async iteration with listProjectBillingInfo with error', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name=";const expectedError = new Error('expected'); - client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProjectBillingInfoAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listProjectBillingInfo.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + it('uses async iteration with listProjectBillingInfo without error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + generateSampleMessage( + new protos.google.cloud.billing.v1.ProjectBillingInfo() + ), + ]; + client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; + const iterable = client.listProjectBillingInfoAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); }); - describe('Path templates', () => { - - describe('billingAccount', () => { - const fakePath = "/rendered/path/billingAccount"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.billingAccountPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountPath', () => { - const result = client.billingAccountPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountName', () => { - const result = client.matchBillingAccountFromBillingAccountName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listProjectBillingInfo with error', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listProjectBillingInfoAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ + 'x-goog-request-params' + ], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('billingAccount', () => { + const fakePath = '/rendered/path/billingAccount'; + const expectedParameters = { + billing_account: 'billingAccountValue', + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.billingAccountPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.billingAccountPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('billingAccountPath', () => { + const result = client.billingAccountPath('billingAccountValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.billingAccountPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchBillingAccountFromBillingAccountName', () => { + const result = client.matchBillingAccountFromBillingAccountName( + fakePath + ); + assert.strictEqual(result, 'billingAccountValue'); + assert( + (client.pathTemplates.billingAccountPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - service: "serviceValue", - }; - const client = new cloudbillingModule.v1.CloudBillingClient({ - 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("serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('service', () => { + const fakePath = '/rendered/path/service'; + const expectedParameters = { + service: 'serviceValue', + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + 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('serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); - describe('sku', () => { - const fakePath = "/rendered/path/sku"; - const expectedParameters = { - service: "serviceValue", - sku: "skuValue", - }; - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.skuPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.skuPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('skuPath', () => { - const result = client.skuPath("serviceValue", "skuValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.skuPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchServiceFromSkuName', () => { - const result = client.matchServiceFromSkuName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.skuPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSkuFromSkuName', () => { - const result = client.matchSkuFromSkuName(fakePath); - assert.strictEqual(result, "skuValue"); - assert((client.pathTemplates.skuPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sku', () => { + const fakePath = '/rendered/path/sku'; + const expectedParameters = { + service: 'serviceValue', + sku: 'skuValue', + }; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.skuPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.skuPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('skuPath', () => { + const result = client.skuPath('serviceValue', 'skuValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.skuPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchServiceFromSkuName', () => { + const result = client.matchServiceFromSkuName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSkuFromSkuName', () => { + const result = client.matchSkuFromSkuName(fakePath); + assert.strictEqual(result, 'skuValue'); + assert( + (client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); }); + }); }); diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index a8ff002b9a9..bfed12050b8 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -20,7 +20,7 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; +import {describe, it} from 'mocha'; import * as cloudcatalogModule from '../src'; import {PassThrough} from 'stream'; @@ -28,603 +28,769 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = (instance.constructor as typeof protobuf.Message).toObject( + instance as protobuf.Message, + {defaults: true} + ); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.CloudCatalogClient', () => { - it('has servicePath', () => { - const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; - assert(servicePath); + it('has servicePath', () => { + const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = cloudcatalogModule.v1.CloudCatalogClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + fallback: true, }); + assert(client); + }); - it('has apiEndpoint', () => { - const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; - assert(apiEndpoint); + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', }); - - it('has port', () => { - const port = cloudcatalogModule.v1.CloudCatalogClient.port; - assert(port); - assert(typeof port === 'number'); + assert.strictEqual(client.cloudCatalogStub, undefined); + await client.initialize(); + assert(client.cloudCatalogStub); + }); + + it('has close method', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', }); - - it('should create a client with no option', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient(); - assert(client); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - fallback: true, - }); - assert(client); + 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 cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudCatalogStub, undefined); - await client.initialize(); - assert(client.cloudCatalogStub); + 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('listServices', () => { + it('invokes listServices without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServices as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - it('has close method', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.close(); + it('invokes listServices without error using callback', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.IService[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServices as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - 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('invokes listServices with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listServices = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.listServices(request); + }, expectedError); + assert( + (client.innerApiCalls.listServices as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', + it('invokes listServicesStream without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.descriptors.page.listServices.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Service[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.Service) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - 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); - } - }); + stream.on('error', (err: Error) => { + reject(err); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServices, request) + ); }); - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); - const expectedOptions = {}; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listServices as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + it('invokes listServicesStream with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Service[] = []; + stream.on( + 'data', + (response: protos.google.cloud.billing.v1.Service) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listServices without error using callback', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); - const expectedOptions = {}; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listServices as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listServices with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); - const expectedOptions = {}; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.listServices(request); }, expectedError); - assert((client.innerApiCalls.listServices as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(async () => { + await promise; + }, expectedError); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServices, request) + ); + }); - it('invokes listServicesStream without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.Service[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - }); + it('uses async iteration with listServices without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + generateSampleMessage(new protos.google.cloud.billing.v1.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.billing.v1.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listServices + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + }); - it('invokes listServicesStream with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest()); - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.Service[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(async () => { await promise; }, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - }); + it('uses async iteration with listServices with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListServicesRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listServices + .asyncIterate as SinonStub).getCall(0).args[1], + request + ); + }); + }); + + describe('listSkus', () => { + it('invokes listSkus without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.innerApiCalls.listSkus = stubSimpleCall(expectedResponse); + const [response] = await client.listSkus(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listSkus as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); - it('uses async iteration with listServices without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest());const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - generateSampleMessage(new protos.google.cloud.billing.v1.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.billing.v1.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listSkus without error using callback', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.innerApiCalls.listSkus = stubSimpleCallWithCallback( + expectedResponse + ); + const promise = new Promise((resolve, reject) => { + client.listSkus( + request, + ( + err?: Error | null, + result?: protos.google.cloud.billing.v1.ISku[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listSkus as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); - it('uses async iteration with listServices with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListServicesRequest());const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + it('invokes listSkus with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSkus = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => { + await client.listSkus(request); + }, expectedError); + assert( + (client.innerApiCalls.listSkus as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); }); - describe('listSkus', () => { - it('invokes listSkus without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - ]; - client.innerApiCalls.listSkus = stubSimpleCall(expectedResponse); - const [response] = await client.listSkus(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSkus as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + it('invokes listSkusStream without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.descriptors.page.listSkus.createStream = stubPageStreamingCall( + expectedResponse + ); + const stream = client.listSkusStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Sku[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { + responses.push(response); }); - - it('invokes listSkus without error using callback', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - ]; - client.innerApiCalls.listSkus = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSkus( - request, - (err?: Error|null, result?: protos.google.cloud.billing.v1.ISku[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSkus as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listSkus with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSkus = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { await client.listSkus(request); }, expectedError); - assert((client.innerApiCalls.listSkus as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSkus.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSkus, request) + ); + assert.strictEqual( + (client.descriptors.page.listSkus.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - it('invokes listSkusStream without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - ]; - client.descriptors.page.listSkus.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSkusStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.Sku[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { - 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.listSkus.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSkus, request)); - assert.strictEqual( - (client.descriptors.page.listSkus.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + it('invokes listSkusStream with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listSkus.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listSkusStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.billing.v1.Sku[] = []; + stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { + responses.push(response); }); - - it('invokes listSkusStream with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSkus.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSkusStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.Sku[] = []; - stream.on('data', (response: protos.google.cloud.billing.v1.Sku) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(async () => { await promise; }, expectedError); - assert((client.descriptors.page.listSkus.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSkus, request)); - assert.strictEqual( - (client.descriptors.page.listSkus.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + stream.on('end', () => { + resolve(responses); }); - - it('uses async iteration with listSkus without error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), - ]; - client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.billing.v1.ISku[] = []; - const iterable = client.listSkusAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(async () => { + await promise; + }, expectedError); + assert( + (client.descriptors.page.listSkus.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSkus, request) + ); + assert.strictEqual( + (client.descriptors.page.listSkus.createStream as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); - it('uses async iteration with listSkus with error', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.billing.v1.ListSkusRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSkusAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.ISku[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); + it('uses async iteration with listSkus without error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), + ]; + client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall( + expectedResponse + ); + const responses: protos.google.cloud.billing.v1.ISku[] = []; + const iterable = client.listSkusAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); }); - describe('Path templates', () => { - - describe('service', () => { - const fakePath = "/rendered/path/service"; - const expectedParameters = { - service: "serviceValue", - }; - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - 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("serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchServiceFromServiceName', () => { - const result = client.matchServiceFromServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.servicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listSkus with error', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.ListSkusRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listSkusAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.billing.v1.ISku[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) + .args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('service', () => { + const fakePath = '/rendered/path/service'; + const expectedParameters = { + service: 'serviceValue', + }; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + 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('serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.servicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchServiceFromServiceName', () => { + const result = client.matchServiceFromServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.servicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); - describe('sku', () => { - const fakePath = "/rendered/path/sku"; - const expectedParameters = { - service: "serviceValue", - sku: "skuValue", - }; - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.skuPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.skuPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('skuPath', () => { - const result = client.skuPath("serviceValue", "skuValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.skuPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchServiceFromSkuName', () => { - const result = client.matchServiceFromSkuName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.skuPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSkuFromSkuName', () => { - const result = client.matchSkuFromSkuName(fakePath); - assert.strictEqual(result, "skuValue"); - assert((client.pathTemplates.skuPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('sku', () => { + const fakePath = '/rendered/path/sku'; + const expectedParameters = { + service: 'serviceValue', + sku: 'skuValue', + }; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.skuPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.skuPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('skuPath', () => { + const result = client.skuPath('serviceValue', 'skuValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.skuPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchServiceFromSkuName', () => { + const result = client.matchServiceFromSkuName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSkuFromSkuName', () => { + const result = client.matchSkuFromSkuName(fakePath); + assert.strictEqual(result, 'skuValue'); + assert( + (client.pathTemplates.skuPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); }); + }); }); diff --git a/packages/google-cloud-billing/webpack.config.js b/packages/google-cloud-billing/webpack.config.js index e4c1e9dff02..21d8795fa42 100644 --- a/packages/google-cloud-billing/webpack.config.js +++ b/packages/google-cloud-billing/webpack.config.js @@ -36,27 +36,27 @@ module.exports = { { test: /\.tsx?$/, use: 'ts-loader', - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]grpc/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]retry-request/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' + use: 'null-loader', }, { test: /node_modules[\\/]gtoken/, - use: 'null-loader' + use: 'null-loader', }, ], }, From c52b71c6325c9120d2e09d9307794af438e85e00 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 21 Apr 2020 04:39:47 -0700 Subject: [PATCH 036/169] build: use codecov's action, now that it's authless (#499) Source-Author: Benjamin E. Coe Source-Date: Fri Apr 17 15:00:44 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 19465d3ec5e5acdb01521d8f3bddd311bcbee28d Source-Link: https://github.com/googleapis/synthtool/commit/19465d3ec5e5acdb01521d8f3bddd311bcbee28d --- packages/google-cloud-billing/synth.metadata | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 82a1ee4f712..b5de900a150 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -11,15 +11,15 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "cdf13efacdea0649e940452f9c5d320b93735974", - "internalRef": "306783437" + "sha": "42ee97c1b93a0e3759bbba3013da309f670a90ab", + "internalRef": "307114445" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "52638600f387deb98efb5f9c85fec39e82aa9052" + "sha": "19465d3ec5e5acdb01521d8f3bddd311bcbee28d" } } ], From d6dead3d3a0f7e4b52d58c392dddf1d522a79d96 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 22 Apr 2020 08:01:51 -0700 Subject: [PATCH 037/169] docs: update types in jsdoc (#48) --- .../src/v1/cloud_billing_client.ts | 28 +++++++++++++++---- packages/google-cloud-billing/synth.metadata | 2 +- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index ebd5e02efdc..23597dd91ce 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -859,8 +859,12 @@ export class CloudBillingClient { * * @param {Object} request * The request object that will be sent. - * @param {} request. - * @param {} request. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -943,8 +947,14 @@ export class CloudBillingClient { * * @param {Object} request * The request object that will be sent. - * @param {} request. - * @param {} request. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1025,8 +1035,14 @@ export class CloudBillingClient { * * @param {Object} request * The request object that will be sent. - * @param {} request. - * @param {} request. + * @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. diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index b5de900a150..9c8864a3e37 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "06e78d4b9d3a7dceb92789ffd442e7385f71f61b" + "sha": "96f648d1dbcf8be1b6bd8da287ad1f23406913b2" } }, { From 8bd1a511b62b334b596cd7eaa95c4f470dd159f9 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 23 Apr 2020 19:29:07 -0700 Subject: [PATCH 038/169] chore: update npm scripts and synth.py (#49) Update npm scripts: add clean, prelint, prefix; make sure that lint and fix are set properly. Use post-process feature of synthtool. --- packages/google-cloud-billing/package.json | 5 +++-- packages/google-cloud-billing/synth.py | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index fc4b6074126..0a606f37e2a 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -17,13 +17,14 @@ "docs": "jsdoc -c .jsdoc.js", "docs-test": "linkinator docs", "fix": "gts fix", - "lint": "gts fix", + "lint": "gts check", "prelint": "cd samples; npm link ../; npm install", "predocs-test": "npm run docs", "prepare": "npm run compile-protos && npm run compile", "system-test": "c8 mocha build/system-test", "test": "c8 mocha build/test", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../" + "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", + "precompile": "gts clean" }, "dependencies": { "google-gax": "^2.1.0" diff --git a/packages/google-cloud-billing/synth.py b/packages/google-cloud-billing/synth.py index 6198d7dd0ba..11abbe46895 100644 --- a/packages/google-cloud-billing/synth.py +++ b/packages/google-cloud-billing/synth.py @@ -15,7 +15,7 @@ import synthtool as s import synthtool.gcp as gcp -import subprocess +import synthtool.languages.node as node import logging logging.basicConfig(level=logging.DEBUG) @@ -44,7 +44,4 @@ templates = common_templates.node_library(source_location='build/src') s.copy(templates, excludes=[]) -# Node.js specific cleanup -subprocess.run(['npm', 'install']) -subprocess.run(['npm', 'run', 'fix']) -subprocess.run(['npx', 'compileProtos', 'src']) +node.postprocess_gapic_library() From 1b3caf8f02bb209a2dee8d258e5753c3dd3293ed Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Tue, 5 May 2020 19:34:25 -0700 Subject: [PATCH 039/169] fix: regen protos and tests (#50) --- packages/google-cloud-billing/synth.metadata | 14 +---- .../test/gapic_cloud_billing_v1.ts | 57 +++++++------------ .../test/gapic_cloud_catalog_v1.ts | 16 ++---- 3 files changed, 28 insertions(+), 59 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 9c8864a3e37..7d00c52c0a8 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,23 +3,15 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "96f648d1dbcf8be1b6bd8da287ad1f23406913b2" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "42ee97c1b93a0e3759bbba3013da309f670a90ab", - "internalRef": "307114445" + "remote": "git@github.com:googleapis/nodejs-billing.git", + "sha": "9cf853cab5cf3de265a94f70b59e0ef7bb0e3da7" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "19465d3ec5e5acdb01521d8f3bddd311bcbee28d" + "sha": "ab883569eb0257bbf16a6d825fd018b3adde3912" } } ], diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 87046296bd1..2df2bb4e9e5 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -297,9 +297,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.getBillingAccount(request); - }, expectedError); + await assert.rejects(client.getBillingAccount(request), expectedError); assert( (client.innerApiCalls.getBillingAccount as SinonStub) .getCall(0) @@ -413,9 +411,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.updateBillingAccount(request); - }, expectedError); + await assert.rejects(client.updateBillingAccount(request), expectedError); assert( (client.innerApiCalls.updateBillingAccount as SinonStub) .getCall(0) @@ -505,9 +501,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.createBillingAccount(request); - }, expectedError); + await assert.rejects(client.createBillingAccount(request), expectedError); assert( (client.innerApiCalls.createBillingAccount as SinonStub) .getCall(0) @@ -621,9 +615,10 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.getProjectBillingInfo(request); - }, expectedError); + await assert.rejects( + client.getProjectBillingInfo(request), + expectedError + ); assert( (client.innerApiCalls.getProjectBillingInfo as SinonStub) .getCall(0) @@ -737,9 +732,10 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.updateProjectBillingInfo(request); - }, expectedError); + await assert.rejects( + client.updateProjectBillingInfo(request), + expectedError + ); assert( (client.innerApiCalls.updateProjectBillingInfo as SinonStub) .getCall(0) @@ -851,9 +847,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.getIamPolicy(request); - }, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); assert( (client.innerApiCalls.getIamPolicy as SinonStub) .getCall(0) @@ -965,9 +959,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.setIamPolicy(request); - }, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); assert( (client.innerApiCalls.setIamPolicy as SinonStub) .getCall(0) @@ -1081,9 +1073,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.testIamPermissions(request); - }, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); assert( (client.innerApiCalls.testIamPermissions as SinonStub) .getCall(0) @@ -1189,9 +1179,7 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.listBillingAccounts(request); - }, expectedError); + await assert.rejects(client.listBillingAccounts(request), expectedError); assert( (client.innerApiCalls.listBillingAccounts as SinonStub) .getCall(0) @@ -1277,9 +1265,7 @@ describe('v1.CloudBillingClient', () => { reject(err); }); }); - await assert.rejects(async () => { - await promise; - }, expectedError); + await assert.rejects(promise, expectedError); assert( (client.descriptors.page.listBillingAccounts.createStream as SinonStub) .getCall(0) @@ -1473,9 +1459,10 @@ describe('v1.CloudBillingClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.listProjectBillingInfo(request); - }, expectedError); + await assert.rejects( + client.listProjectBillingInfo(request), + expectedError + ); assert( (client.innerApiCalls.listProjectBillingInfo as SinonStub) .getCall(0) @@ -1573,9 +1560,7 @@ describe('v1.CloudBillingClient', () => { reject(err); }); }); - await assert.rejects(async () => { - await promise; - }, expectedError); + await assert.rejects(promise, expectedError); assert( (client.descriptors.page.listProjectBillingInfo .createStream as SinonStub) diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index bfed12050b8..ebbfe17647b 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -277,9 +277,7 @@ describe('v1.CloudCatalogClient', () => { undefined, expectedError ); - await assert.rejects(async () => { - await client.listServices(request); - }, expectedError); + await assert.rejects(client.listServices(request), expectedError); assert( (client.innerApiCalls.listServices as SinonStub) .getCall(0) @@ -359,9 +357,7 @@ describe('v1.CloudCatalogClient', () => { reject(err); }); }); - await assert.rejects(async () => { - await promise; - }, expectedError); + await assert.rejects(promise, expectedError); assert( (client.descriptors.page.listServices.createStream as SinonStub) .getCall(0) @@ -532,9 +528,7 @@ describe('v1.CloudCatalogClient', () => { }; const expectedError = new Error('expected'); client.innerApiCalls.listSkus = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => { - await client.listSkus(request); - }, expectedError); + await assert.rejects(client.listSkus(request), expectedError); assert( (client.innerApiCalls.listSkus as SinonStub) .getCall(0) @@ -617,9 +611,7 @@ describe('v1.CloudCatalogClient', () => { reject(err); }); }); - await assert.rejects(async () => { - await promise; - }, expectedError); + await assert.rejects(promise, expectedError); assert( (client.descriptors.page.listSkus.createStream as SinonStub) .getCall(0) From 3230e668076b50aa7d474c011fa6405149fa8ba3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 8 May 2020 11:24:11 -0700 Subject: [PATCH 040/169] build: do not fail builds on codecov errors (#528) (#51) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/13e8b547-7af0-436b-b85e-2c1942f8f36a/targets Source-Link: https://github.com/googleapis/synthtool/commit/be74d3e532faa47eb59f1a0eaebde0860d1d8ab4 --- packages/google-cloud-billing/synth.metadata | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 7d00c52c0a8..b16da955862 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,15 +3,23 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-billing.git", - "sha": "9cf853cab5cf3de265a94f70b59e0ef7bb0e3da7" + "remote": "https://github.com/googleapis/nodejs-billing.git", + "sha": "7cfa275d3f0bba5436dcfbfde806283b7168e024" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "2fc2caaacb15949c7f80426bfc7dafdd41dbc333", + "internalRef": "310239576" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "ab883569eb0257bbf16a6d825fd018b3adde3912" + "sha": "be74d3e532faa47eb59f1a0eaebde0860d1d8ab4" } } ], From d895987af01a95399b1b732b9d9a5fba5b14968f Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Thu, 14 May 2020 13:12:14 -0700 Subject: [PATCH 041/169] feat: promote release level to GA (#52) Fixes #3 --- packages/google-cloud-billing/.repo-metadata.json | 2 +- packages/google-cloud-billing/README.md | 11 ++++++----- packages/google-cloud-billing/synth.metadata | 15 ++++----------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/packages/google-cloud-billing/.repo-metadata.json b/packages/google-cloud-billing/.repo-metadata.json index 155984b5294..fd3f2d863b2 100644 --- a/packages/google-cloud-billing/.repo-metadata.json +++ b/packages/google-cloud-billing/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/billing/docs", "client_documentation": "https://googleapis.dev/nodejs/billing/latest/index.html", "issue_tracker": "https://issuetracker.google.com/savedsearches/559770", - "release_level": "beta", + "release_level": "ga", "language": "nodejs", "repo": "googleapis/nodejs-billing", "distribution_name": "@google-cloud/billing", diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 06e2f4d2b16..af26733d7d2 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -4,7 +4,7 @@ # [Cloud Billing: Node.js Client](https://github.com/googleapis/nodejs-billing) -[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/billing.svg)](https://www.npmjs.org/package/@google-cloud/billing) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-billing/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-billing) @@ -120,11 +120,12 @@ _Legacy Node.js versions are supported as a best effort:_ This library follows [Semantic Versioning](http://semver.org/). +This library is considered to be **General Availability (GA)**. This means it +is stable; the code surface will not change in backwards-incompatible ways +unless absolutely necessary (e.g. because of critical security issues) or with +an extensive deprecation period. Issues and requests against **GA** libraries +are addressed with the highest priority. -This library is considered to be in **beta**. This means it is expected to be -mostly stable while we work toward a general availability release; however, -complete stability is not guaranteed. We will address issues and requests -against beta libraries with a high priority. diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index b16da955862..ad520cc0d47 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,23 +3,16 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "7cfa275d3f0bba5436dcfbfde806283b7168e024" + "remote": "git@github.com:googleapis/nodejs-billing.git", + "sha": "b5e92916efa69e68e76f0b028974565c5228bc31" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2fc2caaacb15949c7f80426bfc7dafdd41dbc333", - "internalRef": "310239576" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "be74d3e532faa47eb59f1a0eaebde0860d1d8ab4" + "sha": "57253ab4c0a78d2351cff0aa638ff81b89b19afc", + "internalRef": "311352758" } } ], From 06c914a01d77271a015394a8374749a43ab4a9f4 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Wed, 3 Jun 2020 19:14:30 -0700 Subject: [PATCH 042/169] fix: update common protos and fix synth (#56) --- .../google-cloud-billing/protos/protos.d.ts | 6 +++++ .../google-cloud-billing/protos/protos.js | 26 +++++++++++++++++-- .../google-cloud-billing/protos/protos.json | 6 ++++- packages/google-cloud-billing/synth.metadata | 15 ++++++++--- packages/google-cloud-billing/synth.py | 1 + 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index faa96400004..6cd3f792ca1 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -3912,6 +3912,9 @@ export namespace google { /** FieldDescriptorProto options */ options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); } /** Represents a FieldDescriptorProto. */ @@ -3953,6 +3956,9 @@ export namespace google { /** 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 diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index 3dd85c9a032..6f13436a7c9 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -9523,6 +9523,7 @@ * @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 */ /** @@ -9620,6 +9621,14 @@ */ 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 @@ -9664,6 +9673,8 @@ 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; }; @@ -9728,6 +9739,9 @@ 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; @@ -9822,6 +9836,9 @@ if (error) return "options." + error; } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; return null; }; @@ -9944,6 +9961,8 @@ 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; }; @@ -9971,6 +9990,7 @@ object.options = null; object.oneofIndex = 0; object.jsonName = ""; + object.proto3Optional = false; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -9992,6 +10012,8 @@ 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; }; @@ -11785,7 +11807,7 @@ * @memberof google.protobuf.FileOptions * @instance */ - FileOptions.prototype.ccEnableArenas = false; + FileOptions.prototype.ccEnableArenas = true; /** * FileOptions objcClassPrefix. @@ -12271,7 +12293,7 @@ object.javaGenerateEqualsAndHash = false; object.deprecated = false; object.javaStringCheckUtf8 = false; - object.ccEnableArenas = false; + object.ccEnableArenas = true; object.objcClassPrefix = ""; object.csharpNamespace = ""; object.swiftPrefix = ""; diff --git a/packages/google-cloud-billing/protos/protos.json b/packages/google-cloud-billing/protos/protos.json index 6b233b9e72a..33e609c1e96 100644 --- a/packages/google-cloud-billing/protos/protos.json +++ b/packages/google-cloud-billing/protos/protos.json @@ -994,6 +994,10 @@ "options": { "type": "FieldOptions", "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 } }, "nested": { @@ -1229,7 +1233,7 @@ "type": "bool", "id": 31, "options": { - "default": false + "default": true } }, "objcClassPrefix": { diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index ad520cc0d47..955de1b0aaf 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,16 +3,23 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-billing.git", - "sha": "b5e92916efa69e68e76f0b028974565c5228bc31" + "remote": "git@github.com:googleapis/nodejs-billing", + "sha": "079a4a03fcf161c2f8b84706b7b5d9481deba829" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "57253ab4c0a78d2351cff0aa638ff81b89b19afc", - "internalRef": "311352758" + "sha": "c1fae183ddeef0c59538863eac611fd679d1b7fb", + "internalRef": "314634470" + } + }, + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "8b65daa222d193b689279162781baf0aa1f0ffd2" } } ], diff --git a/packages/google-cloud-billing/synth.py b/packages/google-cloud-billing/synth.py index 11abbe46895..e751df025c5 100644 --- a/packages/google-cloud-billing/synth.py +++ b/packages/google-cloud-billing/synth.py @@ -34,6 +34,7 @@ generator_args={ "grpc-service-config": f"google/cloud/{name}/{version}/cloud_{name}_grpc_service_config.json", "package-name": f"@google-cloud/{name}", + "validation": "false", }, extra_proto_files=['google/cloud/common_resources.proto'], version=version) From ef274af6fafc58c3b2f79a36bc36683da4129cf0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 4 Jun 2020 11:06:07 -0700 Subject: [PATCH 043/169] chore: release 2.0.0 (#28) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 20 +++++++++++++++++++ packages/google-cloud-billing/package.json | 2 +- .../google-cloud-billing/samples/package.json | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 9dd0c045be4..daa39ea6e25 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [2.0.0](https://www.github.com/googleapis/nodejs-billing/compare/v1.2.0...v2.0.0) (2020-06-04) + + +### ⚠ BREAKING CHANGES + +* The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. + +### Features + +* drop node8 support, support for async iterators ([#27](https://www.github.com/googleapis/nodejs-billing/issues/27)) ([fb95727](https://www.github.com/googleapis/nodejs-billing/commit/fb9572795d02572feb8c465df01445c1d425c0e6)) +* promote release level to GA ([#52](https://www.github.com/googleapis/nodejs-billing/issues/52)) ([079a4a0](https://www.github.com/googleapis/nodejs-billing/commit/079a4a03fcf161c2f8b84706b7b5d9481deba829)), closes [#3](https://www.github.com/googleapis/nodejs-billing/issues/3) + + +### Bug Fixes + +* export explicit version from protos.js ([#33](https://www.github.com/googleapis/nodejs-billing/issues/33)) ([6c2863e](https://www.github.com/googleapis/nodejs-billing/commit/6c2863e520fdeb541ebe65a5edb3c70c18830936)) +* regen protos and tests ([#50](https://www.github.com/googleapis/nodejs-billing/issues/50)) ([7cfa275](https://www.github.com/googleapis/nodejs-billing/commit/7cfa275d3f0bba5436dcfbfde806283b7168e024)) +* remove eslint, update gax, fix generated protos, run the generator ([#37](https://www.github.com/googleapis/nodejs-billing/issues/37)) ([5107cef](https://www.github.com/googleapis/nodejs-billing/commit/5107cef41905344ab25f73a474b27098e15b9f98)) +* update common protos and fix synth ([#56](https://www.github.com/googleapis/nodejs-billing/issues/56)) ([ac7d6b1](https://www.github.com/googleapis/nodejs-billing/commit/ac7d6b1f447d978b0c2c04841a512b8f7218bbae)) + ## [1.2.0](https://www.github.com/googleapis/nodejs-billing/compare/v1.1.0...v1.2.0) (2020-03-06) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 0a606f37e2a..5205f76a932 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "1.2.0", + "version": "2.0.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index ee995658429..bdd7241cc41 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^1.2.0" + "@google-cloud/billing": "^2.0.0" }, "devDependencies": { "c8": "^7.1.0", From 3699c2490a3f6277f7d3eacdc9c6c337c66f30fc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 9 Jun 2020 17:39:07 -0700 Subject: [PATCH 044/169] feat: move ts target to es2018 from es2016 (#59) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9b55eba7-85ee-48d5-a737-8b677439db4d/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/1c92077459db3dc50741e878f98b08c6261181e0 --- packages/google-cloud-billing/protos/protos.js | 2 +- .../google-cloud-billing/src/v1/cloud_billing_client.ts | 7 +++++++ .../google-cloud-billing/src/v1/cloud_catalog_client.ts | 7 +++++++ packages/google-cloud-billing/synth.metadata | 6 +++--- packages/google-cloud-billing/tsconfig.json | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index 6f13436a7c9..f6c82b06652 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -28,7 +28,7 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace - var $root = $protobuf.roots._google_cloud_billing_1_2_0_protos || ($protobuf.roots._google_cloud_billing_1_2_0_protos = {}); + var $root = $protobuf.roots._google_cloud_billing_protos || ($protobuf.roots._google_cloud_billing_protos = {}); $root.google = (function() { diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 23597dd91ce..6617b7afd16 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -99,6 +99,13 @@ export class CloudBillingClient { } opts.servicePath = opts.servicePath || servicePath; opts.port = opts.port || port; + + // users can override the config from client side, like retry codes name. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 + // The way to override client config for Showcase API: + // + // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} + // const showcaseClient = new showcaseClient({ projectId, customConfig }); opts.clientConfig = opts.clientConfig || {}; const isBrowser = typeof window !== 'undefined'; diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index b32427443de..dd78bb7f95e 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -101,6 +101,13 @@ export class CloudCatalogClient { } opts.servicePath = opts.servicePath || servicePath; opts.port = opts.port || port; + + // users can override the config from client side, like retry codes name. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 + // The way to override client config for Showcase API: + // + // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} + // const showcaseClient = new showcaseClient({ projectId, customConfig }); opts.clientConfig = opts.clientConfig || {}; const isBrowser = typeof window !== 'undefined'; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 955de1b0aaf..cfaebc80b84 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,8 +3,8 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-billing", - "sha": "079a4a03fcf161c2f8b84706b7b5d9481deba829" + "remote": "https://github.com/googleapis/nodejs-billing.git", + "sha": "4daa93fc7e635267f3bd0377f4fb9bce80fbc821" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "8b65daa222d193b689279162781baf0aa1f0ffd2" + "sha": "1c92077459db3dc50741e878f98b08c6261181e0" } } ], diff --git a/packages/google-cloud-billing/tsconfig.json b/packages/google-cloud-billing/tsconfig.json index 613d35597b5..c78f1c884ef 100644 --- a/packages/google-cloud-billing/tsconfig.json +++ b/packages/google-cloud-billing/tsconfig.json @@ -5,7 +5,7 @@ "outDir": "build", "resolveJsonModule": true, "lib": [ - "es2016", + "es2018", "dom" ] }, From a8a9a34eba66791916c42402f2d709f1ad85091a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 11 Jun 2020 17:49:38 +0200 Subject: [PATCH 045/169] chore(deps): update dependency mocha to v8 (#61) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^7.1.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/mocha/7.2.0/8.0.1) | --- ### Release Notes
mochajs/mocha ### [`v8.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​801--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v8.0.0...v8.0.1) The obligatory patch after a major. #### :bug: Fixes - [#​4328](https://togithub.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@​boneskull**](https://togithub.com/boneskull)) ### [`v8.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​800--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.2.0...v8.0.0) In this major release, Mocha adds the ability to _run tests in parallel_. Better late than never! Please note the **breaking changes** detailed below. Let's welcome [**@​giltayar**](https://togithub.com/giltayar) and [**@​nicojs**](https://togithub.com/nicojs) to the maintenance team! #### :boom: Breaking Changes - [#​4164](https://togithub.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.0.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@​UlisesGascon**](https://togithub.com/UlisesGascon)) - [#​4175](https://togithub.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND:** Replace `mocha.opts` with a [configuration file](https://mochajs.org/#configuring-mocha-nodejs). - [#​4260](https://togithub.com/mochajs/mocha/issues/4260): Remove `enableTimeout()` (`this.enableTimeout()`) from the context object ([**@​craigtaub**](https://togithub.com/craigtaub)) :sparkles: **WORKAROUND:** Replace usage of `this.enableTimeout(false)` in your tests with `this.timeout(0)`. - [#​4315](https://togithub.com/mochajs/mocha/issues/4315): The `spec` option no longer supports a comma-delimited list of files ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND**: Use an array instead (e.g., `"spec": "foo.js,bar.js"` becomes `"spec": ["foo.js", "bar.js"]`). - [#​4309](https://togithub.com/mochajs/mocha/issues/4309): Drop support for Node.js v13.x line, which is now End-of-Life ([**@​juergba**](https://togithub.com/juergba)) - [#​4282](https://togithub.com/mochajs/mocha/issues/4282): `--forbid-only` will throw an error even if exclusive tests are avoided via `--grep` or other means ([**@​arvidOtt**](https://togithub.com/arvidOtt)) - [#​4223](https://togithub.com/mochajs/mocha/issues/4223): The context object's `skip()` (`this.skip()`) in a "before all" (`before()`) hook will no longer execute subsequent sibling hooks, in addition to hooks in child suites ([**@​juergba**](https://togithub.com/juergba)) - [#​4178](https://togithub.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@​wnghdcjfe**](https://togithub.com/wnghdcjfe)): - `Mocha.prototype.ignoreLeaks()` - `Mocha.prototype.useColors()` - `Mocha.prototype.useInlineDiffs()` - `Mocha.prototype.hideDiff()` #### :tada: Enhancements - [#​4245](https://togithub.com/mochajs/mocha/issues/4245): Add ability to run tests in parallel for Node.js (see [docs](https://mochajs.org/#parallel-tests)) ([**@​boneskull**](https://togithub.com/boneskull)) :exclamation: See also [#​4244](https://togithub.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- _root hooks must be defined via Root Hook Plugins to work in parallel mode_ - [#​4304](https://togithub.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@​JacobLey**](https://togithub.com/JacobLey)) - [#​4299](https://togithub.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- _use at your own risk!_ ([**@​giltayar**](https://togithub.com/giltayar)) #### :book: Documentation - [#​4246](https://togithub.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@​boneskull**](https://togithub.com/boneskull)) #### :bug: Fixes (All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 5205f76a932..cb7864d1b52 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -39,7 +39,7 @@ "jsdoc-fresh": "^1.0.1", "jsdoc-region-tag": "^1.0.2", "linkinator": "^2.0.0", - "mocha": "^7.0.0", + "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^9.0.1", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index bdd7241cc41..4b882533344 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -18,6 +18,6 @@ "devDependencies": { "c8": "^7.1.0", "chai": "^4.2.0", - "mocha": "^7.1.0" + "mocha": "^8.0.0" } } From c10856fb6c1a7fecc1d76b45c6e1e6ef967225f1 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 11 Jun 2020 09:56:59 -0700 Subject: [PATCH 046/169] chore(nodejs_templates): add script logging to node_library populate-secrets.sh (#62) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/e306327b-605f-4c07-9420-c106e40c47d5/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/e7034945fbdc0e79d3c57f6e299e5c90b0f11469 --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index cfaebc80b84..1a8c77feef0 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "4daa93fc7e635267f3bd0377f4fb9bce80fbc821" + "sha": "68749b419b70eec762479b938f96727ccdc2b49d" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1c92077459db3dc50741e878f98b08c6261181e0" + "sha": "e7034945fbdc0e79d3c57f6e299e5c90b0f11469" } } ], From 7bda850febbb3ffe9eca2729baf7613c6b5ba5c6 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 15 Jun 2020 11:11:08 -0700 Subject: [PATCH 047/169] fix: proper fallback option handling autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- .../src/v1/cloud_billing_client.ts | 13 +++++-------- .../src/v1/cloud_catalog_client.ts | 13 +++++-------- packages/google-cloud-billing/synth.metadata | 2 +- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 6617b7afd16..e757e5ade80 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -108,14 +108,11 @@ export class CloudBillingClient { // const showcaseClient = new showcaseClient({ projectId, customConfig }); opts.clientConfig = opts.clientConfig || {}; - const isBrowser = typeof window !== 'undefined'; - if (isBrowser) { - opts.fallback = true; - } - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the CloudBillingClient constructor. + this._gaxModule = opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index dd78bb7f95e..4c73aa4547c 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -110,14 +110,11 @@ export class CloudCatalogClient { // const showcaseClient = new showcaseClient({ projectId, customConfig }); opts.clientConfig = opts.clientConfig || {}; - const isBrowser = typeof window !== 'undefined'; - if (isBrowser) { - opts.fallback = true; - } - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - this._gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + // If we're running in browser, it's OK to omit `fallback` since + // google-gax has `browser` field in its `package.json`. + // For Electron (which does not respect `browser` field), + // pass `{fallback: true}` to the CloudCatalogClient constructor. + this._gaxModule = opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 1a8c77feef0..ecc657e808a 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "68749b419b70eec762479b938f96727ccdc2b49d" + "sha": "170ae8a595ebd6555d95c82bc87ffe6d48aecd2c" } }, { From a44eadebaaf4ac9698d9f41ec172323be65ae9d6 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2020 09:12:07 -0700 Subject: [PATCH 048/169] chore: release 2.1.0 (#60) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 12 ++++++++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index daa39ea6e25..0116a511f7d 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [2.1.0](https://www.github.com/googleapis/nodejs-billing/compare/v2.0.0...v2.1.0) (2020-06-15) + + +### Features + +* move ts target to es2018 from es2016 ([#59](https://www.github.com/googleapis/nodejs-billing/issues/59)) ([68749b4](https://www.github.com/googleapis/nodejs-billing/commit/68749b419b70eec762479b938f96727ccdc2b49d)) + + +### Bug Fixes + +* proper fallback option handling ([25a0c07](https://www.github.com/googleapis/nodejs-billing/commit/25a0c0723a87c13b55565bdfd3ad98703f6d5e44)) + ## [2.0.0](https://www.github.com/googleapis/nodejs-billing/compare/v1.2.0...v2.0.0) (2020-06-04) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index cb7864d1b52..660c5edf6c6 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.0.0", + "version": "2.1.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 4b882533344..b6d3703cf34 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.0.0" + "@google-cloud/billing": "^2.1.0" }, "devDependencies": { "c8": "^7.1.0", From ac80db0d4570f6efc3369cc849db4acc9bb45673 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 18 Jun 2020 07:46:17 -0700 Subject: [PATCH 049/169] chore: update node issue template (#64) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/37f383f8-7560-459e-b66c-def10ff830cb/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/b10590a4a1568548dd13cfcea9aa11d40898144b --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index ecc657e808a..49987631f89 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "170ae8a595ebd6555d95c82bc87ffe6d48aecd2c" + "sha": "7d1ba04eb4515d937c0857db3b0204b0af358cd0" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "e7034945fbdc0e79d3c57f6e299e5c90b0f11469" + "sha": "b10590a4a1568548dd13cfcea9aa11d40898144b" } } ], From 4e2d6e8349d51e1ef079e49d90c3dc9109e77887 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 27 Jun 2020 17:48:29 -0700 Subject: [PATCH 050/169] build: add config .gitattributes (#66) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/2a81bca4-7abd-4108-ac1f-21340f858709/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/dc9caca650c77b7039e2bbc3339ffb34ae78e5b7 --- packages/google-cloud-billing/.gitattributes | 3 +++ packages/google-cloud-billing/synth.metadata | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-billing/.gitattributes diff --git a/packages/google-cloud-billing/.gitattributes b/packages/google-cloud-billing/.gitattributes new file mode 100644 index 00000000000..2e63216ae9c --- /dev/null +++ b/packages/google-cloud-billing/.gitattributes @@ -0,0 +1,3 @@ +*.ts text eol=lf +*.js test eol=lf +protos/* linguist-generated diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 49987631f89..5486281d1f6 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "7d1ba04eb4515d937c0857db3b0204b0af358cd0" + "sha": "436a28cc649510c5f3f6a6b63b926de8552421bd" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "b10590a4a1568548dd13cfcea9aa11d40898144b" + "sha": "dc9caca650c77b7039e2bbc3339ffb34ae78e5b7" } } ], From 94d28558d81df25aa6a3087702349284fc219737 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 30 Jun 2020 21:21:35 -0700 Subject: [PATCH 051/169] fix: update default timeouts for list calls (#65) This combines the cloud_catalog_grpc_service_config.json methodConfig(s) with the cloud_billing_grpc_service_config.json, and removes the cloud_catalog_grpc_service_config.json file. PiperOrigin-RevId: 318328852 Source-Author: Google APIs Source-Date: Thu Jun 25 12:49:04 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: 5920d376e8771e7dd245a0d1d0341952ca15e41d Source-Link: https://github.com/googleapis/googleapis/commit/5920d376e8771e7dd245a0d1d0341952ca15e41d Co-authored-by: Justin Beckwith --- .../src/v1/cloud_catalog_client_config.json | 2 ++ packages/google-cloud-billing/synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client_config.json b/packages/google-cloud-billing/src/v1/cloud_catalog_client_config.json index e985baae91b..65eb2dffc09 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client_config.json +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client_config.json @@ -21,10 +21,12 @@ }, "methods": { "ListServices": { + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListSkus": { + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 5486281d1f6..0d104eca7ed 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c1fae183ddeef0c59538863eac611fd679d1b7fb", - "internalRef": "314634470" + "sha": "5920d376e8771e7dd245a0d1d0341952ca15e41d", + "internalRef": "318328852" } }, { From c766e08f77adc7f4e855d315354aa881810da526 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Mon, 6 Jul 2020 10:16:12 -0700 Subject: [PATCH 052/169] build: use bazel build (#68) --- packages/google-cloud-billing/synth.metadata | 18 +++++------------- packages/google-cloud-billing/synth.py | 13 ++----------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 0d104eca7ed..6e2ee322ae7 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,23 +3,15 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "436a28cc649510c5f3f6a6b63b926de8552421bd" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5920d376e8771e7dd245a0d1d0341952ca15e41d", - "internalRef": "318328852" + "remote": "git@github.com:googleapis/nodejs-billing.git", + "sha": "749e14cd9fac5b08b105d93bcaba1d45b6ead6cc" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "dc9caca650c77b7039e2bbc3339ffb34ae78e5b7" + "sha": "303271797a360f8a439203413f13a160f2f5b3b4" } } ], @@ -29,8 +21,8 @@ "source": "googleapis", "apiName": "billing", "apiVersion": "v1", - "language": "typescript", - "generator": "gapic-generator-typescript" + "language": "nodejs", + "generator": "bazel" } } ] diff --git a/packages/google-cloud-billing/synth.py b/packages/google-cloud-billing/synth.py index e751df025c5..b0e9d0f4585 100644 --- a/packages/google-cloud-billing/synth.py +++ b/packages/google-cloud-billing/synth.py @@ -25,19 +25,10 @@ # run the gapic generator name = 'billing' -gapic = gcp.GAPICMicrogenerator() +gapic = gcp.GAPICBazel() versions = ['v1'] for version in versions: - library = gapic.typescript_library( - name, - proto_path=f'google/cloud/{name}/{version}', - generator_args={ - "grpc-service-config": f"google/cloud/{name}/{version}/cloud_{name}_grpc_service_config.json", - "package-name": f"@google-cloud/{name}", - "validation": "false", - }, - extra_proto_files=['google/cloud/common_resources.proto'], - version=version) + library = gapic.node_library(name, version) s.copy(library, excludes=['package.json', 'README.md']) # Copy common templates From 2506519bbdebfa50b6c38804717d57817f86f0ea Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2020 04:42:03 +0000 Subject: [PATCH 053/169] chore: release 2.1.1 (#67) :robot: I have created a release \*beep\* \*boop\* --- ### [2.1.1](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.0...v2.1.1) (2020-07-06) ### Bug Fixes * update default timeouts for list calls ([#65](https://www.github.com/googleapis/nodejs-billing/issues/65)) ([749e14c](https://www.github.com/googleapis/nodejs-billing/commit/749e14cd9fac5b08b105d93bcaba1d45b6ead6cc)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 0116a511f7d..7deb54d9970 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.1.1](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.0...v2.1.1) (2020-07-06) + + +### Bug Fixes + +* update default timeouts for list calls ([#65](https://www.github.com/googleapis/nodejs-billing/issues/65)) ([749e14c](https://www.github.com/googleapis/nodejs-billing/commit/749e14cd9fac5b08b105d93bcaba1d45b6ead6cc)) + ## [2.1.0](https://www.github.com/googleapis/nodejs-billing/compare/v2.0.0...v2.1.0) (2020-06-15) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 660c5edf6c6..a23d7e6e87b 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.1.0", + "version": "2.1.1", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index b6d3703cf34..57c268868f4 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.1.0" + "@google-cloud/billing": "^2.1.1" }, "devDependencies": { "c8": "^7.1.0", From 1388b5c42f2502ca581de17fe5aebb6209f90792 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2020 13:48:30 -0700 Subject: [PATCH 054/169] chore: release 2.1.1 (#70) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 7deb54d9970..65641369ac1 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.1.1](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.0...v2.1.1) (2020-07-07) + + +### Bug Fixes + +* update default timeouts for list calls ([#65](https://www.github.com/googleapis/nodejs-billing/issues/65)) ([749e14c](https://www.github.com/googleapis/nodejs-billing/commit/749e14cd9fac5b08b105d93bcaba1d45b6ead6cc)) + ### [2.1.1](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.0...v2.1.1) (2020-07-06) From 3bbe775da8db80c04915e3302fd4f060799cbacc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 9 Jul 2020 05:38:06 -0700 Subject: [PATCH 055/169] fix: typeo in nodejs .gitattribute (#73) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/cc99acfa-05b8-434b-9500-2f6faf2eaa02/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/799d8e6522c1ef7cb55a70d9ea0b15e045c3d00b --- packages/google-cloud-billing/.gitattributes | 2 +- packages/google-cloud-billing/synth.metadata | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-billing/.gitattributes b/packages/google-cloud-billing/.gitattributes index 2e63216ae9c..d4f4169b28b 100644 --- a/packages/google-cloud-billing/.gitattributes +++ b/packages/google-cloud-billing/.gitattributes @@ -1,3 +1,3 @@ *.ts text eol=lf -*.js test eol=lf +*.js text eol=lf protos/* linguist-generated diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 6e2ee322ae7..84e1a0d86a3 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,15 +3,23 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-billing.git", - "sha": "749e14cd9fac5b08b105d93bcaba1d45b6ead6cc" + "remote": "https://github.com/googleapis/nodejs-billing.git", + "sha": "70c76982c4778850dda89b8e02525dd7a7e0d755" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "4f4aa3a03e470f1390758b9d89eb1aa88837a5be", + "internalRef": "320300472" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "303271797a360f8a439203413f13a160f2f5b3b4" + "sha": "799d8e6522c1ef7cb55a70d9ea0b15e045c3d00b" } } ], From ab136440d807eff4077c436ff23a6788c8d99939 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2020 01:13:50 +0000 Subject: [PATCH 056/169] chore: release 2.1.2 (#74) :robot: I have created a release \*beep\* \*boop\* --- ### [2.1.2](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.1...v2.1.2) (2020-07-09) ### Bug Fixes * typeo in nodejs .gitattribute ([#73](https://www.github.com/googleapis/nodejs-billing/issues/73)) ([286ac25](https://www.github.com/googleapis/nodejs-billing/commit/286ac2555eddc0a36fc3c7eff1c7b5f8ebf4b475)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 65641369ac1..1c5e0c55db1 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.1.2](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.1...v2.1.2) (2020-07-09) + + +### Bug Fixes + +* typeo in nodejs .gitattribute ([#73](https://www.github.com/googleapis/nodejs-billing/issues/73)) ([286ac25](https://www.github.com/googleapis/nodejs-billing/commit/286ac2555eddc0a36fc3c7eff1c7b5f8ebf4b475)) + ### [2.1.1](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.0...v2.1.1) (2020-07-07) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index a23d7e6e87b..3ce8291e238 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.1.1", + "version": "2.1.2", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 57c268868f4..b6db411e666 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.1.1" + "@google-cloud/billing": "^2.1.2" }, "devDependencies": { "c8": "^7.1.0", From e0ab40bea6ddcf1eb045bd8fa02d79ba542351ba Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 10 Jul 2020 18:47:43 +0200 Subject: [PATCH 057/169] chore(deps): update dependency ts-loader to v8 (#72) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-loader](https://togithub.com/TypeStrong/ts-loader) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/ts-loader/7.0.5/8.0.0) | --- ### Release Notes
TypeStrong/ts-loader ### [`v8.0.0`](https://togithub.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md#v800) [Compare Source](https://togithub.com/TypeStrong/ts-loader/compare/v7.0.5...v8.0.0) - [Support for symlinks in project references](https://togithub.com/TypeStrong/ts-loader/pull/1136) - thanks [@​sheetalkamat](https://togithub.com/sheetalkamat)! - `ts-loader` now supports TypeScript 3.6 and greater **BREAKING CHANGE**
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 3ce8291e238..e620d937119 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -43,7 +43,7 @@ "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^9.0.1", - "ts-loader": "^7.0.0", + "ts-loader": "^8.0.0", "typescript": "^3.8.3", "webpack": "^4.41.2", "webpack-cli": "^3.3.10" From ed85eb3630232c54c62d79297585bba75eb721f7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 12 Jul 2020 18:49:17 +0200 Subject: [PATCH 058/169] chore(deps): update dependency @types/mocha to v8 (#75) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/7.0.2/8.0.0) | --- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index e620d937119..b4f81eac4ca 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -30,7 +30,7 @@ "google-gax": "^2.1.0" }, "devDependencies": { - "@types/mocha": "^7.0.0", + "@types/mocha": "^8.0.0", "@types/node": "^12.0.0", "@types/sinon": "^9.0.0", "c8": "^7.0.0", From 4e098f31bfb559dff3e804d79416105431fbbdb7 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 14 Jul 2020 09:07:15 -0700 Subject: [PATCH 059/169] build: missing closing paren in publish script (#77) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9c6207e5-a7a6-4e44-ab6b-91751e0230b1/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/d82deccf657a66e31bd5da9efdb96c6fa322fc7e --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 84e1a0d86a3..a9c5a86c5e3 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "70c76982c4778850dda89b8e02525dd7a7e0d755" + "sha": "1ef0cfd3b355d02109337f6b5d8b4927556b92fc" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "799d8e6522c1ef7cb55a70d9ea0b15e045c3d00b" + "sha": "d82deccf657a66e31bd5da9efdb96c6fa322fc7e" } } ], From a924903d5fab6f86b28894266d6f208009c877cb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 17 Jul 2020 15:10:42 -0700 Subject: [PATCH 060/169] chore: add config files for cloud-rad for node.js, delete Node 8 templates (#81) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/5e903fff-57bb-4395-bb94-8b4d1909dbf6/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/21f1470ecd01424dc91c70f1a7c798e4e87d1eec Source-Link: https://github.com/googleapis/synthtool/commit/388e10f5ae302d3e8de1fac99f3a95d1ab8f824a --- .../google-cloud-billing/api-extractor.json | 369 ++++++++++++++++++ packages/google-cloud-billing/synth.metadata | 4 +- 2 files changed, 371 insertions(+), 2 deletions(-) create mode 100644 packages/google-cloud-billing/api-extractor.json diff --git a/packages/google-cloud-billing/api-extractor.json b/packages/google-cloud-billing/api-extractor.json new file mode 100644 index 00000000000..de228294b23 --- /dev/null +++ b/packages/google-cloud-billing/api-extractor.json @@ -0,0 +1,369 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for + * standard settings to be shared across multiple projects. + * + * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains + * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be + * resolved using NodeJS require(). + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "extends": "./shared/api-extractor-base.json" + // "extends": "my-package/include/api-extractor-base.json" + + /** + * Determines the "" token that can be used with other config file settings. The project folder + * typically contains the tsconfig.json and package.json config files, but the path is user-defined. + * + * The path is resolved relative to the folder of the config file that contains the setting. + * + * The default value for "projectFolder" is the token "", which means the folder is determined by traversing + * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder + * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error + * will be reported. + * + * SUPPORTED TOKENS: + * DEFAULT VALUE: "" + */ + // "projectFolder": "..", + + /** + * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor + * analyzes the symbols exported by this module. + * + * The file extension must be ".d.ts" and not ".ts". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + */ + "mainEntryPointFilePath": "/protos/protos.d.ts", + + /** + * A list of NPM package names whose exports should be treated as part of this package. + * + * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", + * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part + * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly + * imports library2. To avoid this, we can specify: + * + * "bundledPackages": [ "library2" ], + * + * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been + * local files for library1. + */ + "bundledPackages": [ ], + + /** + * Determines how the TypeScript compiler engine will be invoked by API Extractor. + */ + "compiler": { + /** + * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * Note: This setting will be ignored if "overrideTsconfig" is used. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/tsconfig.json" + */ + // "tsconfigFilePath": "/tsconfig.json", + + /** + * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. + * The object must conform to the TypeScript tsconfig schema: + * + * http://json.schemastore.org/tsconfig + * + * If omitted, then the tsconfig.json file will be read from the "projectFolder". + * + * DEFAULT VALUE: no overrideTsconfig section + */ + // "overrideTsconfig": { + // . . . + // } + + /** + * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended + * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when + * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses + * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. + * + * DEFAULT VALUE: false + */ + // "skipLibCheck": true, + }, + + /** + * Configures how the API report file (*.api.md) will be generated. + */ + "apiReport": { + /** + * (REQUIRED) Whether to generate an API report. + */ + "enabled": true, + + /** + * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce + * a full file path. + * + * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". + * + * SUPPORTED TOKENS: , + * DEFAULT VALUE: ".api.md" + */ + // "reportFileName": ".api.md", + + /** + * Specifies the folder where the API report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, + * e.g. for an API review. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/etc/" + */ + // "reportFolder": "/etc/", + + /** + * Specifies the folder where the temporary report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * After the temporary file is written to disk, it is compared with the file in the "reportFolder". + * If they are different, a production build will fail. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportTempFolder": "/temp/" + }, + + /** + * Configures how the doc model file (*.api.json) will be generated. + */ + "docModel": { + /** + * (REQUIRED) Whether to generate a doc model file. + */ + "enabled": true, + + /** + * The output path for the doc model file. The file extension should be ".api.json". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/.api.json" + */ + // "apiJsonFilePath": "/temp/.api.json" + }, + + /** + * Configures how the .d.ts rollup file will be generated. + */ + "dtsRollup": { + /** + * (REQUIRED) Whether to generate the .d.ts rollup file. + */ + "enabled": true, + + /** + * Specifies the output path for a .d.ts rollup file to be generated without any trimming. + * This file will include all declarations that are exported by the main entry point. + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/dist/.d.ts" + */ + // "untrimmedFilePath": "/dist/.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. + * This file will include only declarations that are marked as "@public" or "@beta". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "betaTrimmedFilePath": "/dist/-beta.d.ts", + + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. + * This file will include only declarations that are marked as "@public". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "publicTrimmedFilePath": "/dist/-public.d.ts", + + /** + * When a declaration is trimmed, by default it will be replaced by a code comment such as + * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the + * declaration completely. + * + * DEFAULT VALUE: false + */ + // "omitTrimmingComments": true + }, + + /** + * Configures how the tsdoc-metadata.json file will be generated. + */ + "tsdocMetadata": { + /** + * Whether to generate the tsdoc-metadata.json file. + * + * DEFAULT VALUE: true + */ + // "enabled": true, + + /** + * Specifies where the TSDoc metadata file should be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", + * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup + * falls back to "tsdoc-metadata.json" in the package folder. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" + }, + + /** + * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files + * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. + * To use the OS's default newline kind, specify "os". + * + * DEFAULT VALUE: "crlf" + */ + // "newlineKind": "crlf", + + /** + * Configures how API Extractor reports error and warning messages produced during analysis. + * + * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. + */ + "messages": { + /** + * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing + * the input .d.ts files. + * + * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "compilerMessageReporting": { + /** + * Configures the default routing for messages that don't match an explicit rule in this table. + */ + "default": { + /** + * Specifies whether the message should be written to the the tool's output log. Note that + * the "addToApiReportFile" property may supersede this option. + * + * Possible values: "error", "warning", "none" + * + * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail + * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes + * the "--local" option), the warning is displayed but the build will not fail. + * + * DEFAULT VALUE: "warning" + */ + "logLevel": "warning", + + /** + * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), + * then the message will be written inside that file; otherwise, the message is instead logged according to + * the "logLevel" option. + * + * DEFAULT VALUE: false + */ + // "addToApiReportFile": false + }, + + // "TS2551": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by API Extractor during its analysis. + * + * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" + * + * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings + */ + "extractorMessageReporting": { + "default": { + "logLevel": "warning", + // "addToApiReportFile": false + }, + + // "ae-extra-release-tag": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by the TSDoc parser when analyzing code comments. + * + * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "tsdocMessageReporting": { + "default": { + "logLevel": "warning", + // "addToApiReportFile": false + } + + // "tsdoc-link-tag-unescaped-text": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + } + } + +} diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index a9c5a86c5e3..4c421e1ea63 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "1ef0cfd3b355d02109337f6b5d8b4927556b92fc" + "sha": "19e6eaed0fbad9ffa6dbeb61f378452dfefb7112" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "d82deccf657a66e31bd5da9efdb96c6fa322fc7e" + "sha": "21f1470ecd01424dc91c70f1a7c798e4e87d1eec" } } ], From a142340a520f96a8d8d376a80317c3de29d5a303 Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Tue, 21 Jul 2020 14:45:29 -0400 Subject: [PATCH 061/169] chore: add dev dependencies for cloud-rad ref docs (#82) --- packages/google-cloud-billing/package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index b4f81eac4ca..1383aadd71f 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -24,7 +24,9 @@ "system-test": "c8 mocha build/system-test", "test": "c8 mocha build/test", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "precompile": "gts clean" + "precompile": "gts clean", + "api-extractor": "api-extractor run --local", + "api-documenter": "api-documenter yaml --input-folder=temp" }, "dependencies": { "google-gax": "^2.1.0" @@ -46,7 +48,9 @@ "ts-loader": "^8.0.0", "typescript": "^3.8.3", "webpack": "^4.41.2", - "webpack-cli": "^3.3.10" + "webpack-cli": "^3.3.10", + "@microsoft/api-documenter": "^7.8.10", + "@microsoft/api-extractor": "^7.8.10" }, "engines": { "node": ">=10" From 5196f50ca95828bbe78028e6e47ce4ce1bb51b03 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 21 Jul 2020 22:20:20 -0700 Subject: [PATCH 062/169] build: rename _toc to toc (#83) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/940354f9-15cd-4361-bbf4-dc9af1426979/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/99c93fe09f8c1dca09dfc0301c8668e3a70dd796 --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 4c421e1ea63..01eb7e38b6a 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "19e6eaed0fbad9ffa6dbeb61f378452dfefb7112" + "sha": "508112c1667a81d532839fcc6ab226d376c56024" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "21f1470ecd01424dc91c70f1a7c798e4e87d1eec" + "sha": "99c93fe09f8c1dca09dfc0301c8668e3a70dd796" } } ], From 021c06bc4d2cac3bbd6d51e61d399655255ad87b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 23 Jul 2020 20:06:35 -0700 Subject: [PATCH 063/169] chore: move gitattributes files to node templates (#84) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/d43b90cc-a087-4c57-864c-1e4f93292dc6/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/3a00b7fea8c4c83eaff8eb207f530a2e3e8e1de3 --- packages/google-cloud-billing/.gitattributes | 1 + packages/google-cloud-billing/synth.metadata | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/.gitattributes b/packages/google-cloud-billing/.gitattributes index d4f4169b28b..33739cb74e4 100644 --- a/packages/google-cloud-billing/.gitattributes +++ b/packages/google-cloud-billing/.gitattributes @@ -1,3 +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-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 01eb7e38b6a..27734d95b6f 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "508112c1667a81d532839fcc6ab226d376c56024" + "sha": "12705c839ee26fae73d8cf054e16aef188b73d00" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "99c93fe09f8c1dca09dfc0301c8668e3a70dd796" + "sha": "3a00b7fea8c4c83eaff8eb207f530a2e3e8e1de3" } } ], From 52934427b56d3455ee105febe858b54059d8039e Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 29 Jul 2020 11:58:09 -0700 Subject: [PATCH 064/169] chore(node): fix kokoro build path for cloud-rad (#85) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/4bdc1826-2f69-49f1-a63b-94f99cceb5ee/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 27734d95b6f..8ddd7e1119c 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "12705c839ee26fae73d8cf054e16aef188b73d00" + "sha": "c5bd97dda224f7d7b60682b5b144aafeae60bf99" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "3a00b7fea8c4c83eaff8eb207f530a2e3e8e1de3" + "sha": "89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa" } } ], From 4d50d26239d529edd428ba2759c9f7d2f433b128 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 30 Jul 2020 19:10:35 -0700 Subject: [PATCH 065/169] build: update protos (#86) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/b205fd33-200c-4298-88b8-18b0d1c79a3e/targets - [ ] To automatically regenerate this PR, check this box. --- packages/google-cloud-billing/protos/protos.d.ts | 2 +- packages/google-cloud-billing/protos/protos.js | 2 +- packages/google-cloud-billing/synth.metadata | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index 6cd3f792ca1..14ed436dc47 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import * as Long from "long"; -import * as $protobuf from "protobufjs"; +import {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index f6c82b06652..c781d429a5a 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -19,7 +19,7 @@ define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("protobufjs/minimal")); + module.exports = factory(require("google-gax").protobufMinimal); })(this, function($protobuf) { "use strict"; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 8ddd7e1119c..759cfe78426 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "c5bd97dda224f7d7b60682b5b144aafeae60bf99" + "sha": "c93a8dff98ced78f2b317cbce08eaa24c491de46" } }, { From 4aacacff1b4164398e45e15e6fd554be70358bbb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 31 Jul 2020 09:24:37 -0700 Subject: [PATCH 066/169] docs: add links to the CHANGELOG from the README.md for Java and Node (#87) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/7b446397-88f3-4463-9e7d-d2ce7069989d/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/5936421202fb53ed4641bcb824017dd393a3dbcc --- packages/google-cloud-billing/README.md | 3 +++ packages/google-cloud-billing/synth.metadata | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index af26733d7d2..d15b0342b3a 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -14,6 +14,9 @@ Billing client for Node.js +A comprehensive list of changes in each version may be found in +[the CHANGELOG](https://github.com/googleapis/nodejs-billing/blob/master/CHANGELOG.md). + * [Cloud Billing Node.js Client API Reference][client-docs] * [Cloud Billing Documentation][product-docs] * [github.com/googleapis/nodejs-billing](https://github.com/googleapis/nodejs-billing) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 759cfe78426..e6ac99c163b 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "c93a8dff98ced78f2b317cbce08eaa24c491de46" + "sha": "79b31d63a31ad805204bc061fca32baeec0d35b8" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "89d431fb2975fc4e0ed24995a6e6dfc8ff4c24fa" + "sha": "5936421202fb53ed4641bcb824017dd393a3dbcc" } } ], From 56869fe76dd1b155d5f190b1b3e43d8318795342 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 8 Aug 2020 11:36:33 -0700 Subject: [PATCH 067/169] build: --credential-file-override is no longer required (#89) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/4de22315-84b1-493d-8da2-dfa7688128f5/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/94421c47802f56a44c320257b2b4c190dc7d6b68 --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index e6ac99c163b..d6d69421eeb 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "79b31d63a31ad805204bc061fca32baeec0d35b8" + "sha": "60419ded0b1b54a0db1113bbff1914c29bb36c79" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5936421202fb53ed4641bcb824017dd393a3dbcc" + "sha": "94421c47802f56a44c320257b2b4c190dc7d6b68" } } ], From 37ba6848d8147743740fe6e17b2da5c99e67e848 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 11 Aug 2020 11:24:08 -0700 Subject: [PATCH 068/169] build: use gapic-generator-typescript v1.0.7. (#90) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/5f7f9c6d-c75a-4c60-8bb8-0026a14cead7/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 325949033 Source-Link: https://github.com/googleapis/googleapis/commit/94006b3cb8d2fb44703cf535da15608eed6bf7db --- .../google-cloud-billing/src/v1/cloud_billing_client.ts | 5 ++--- .../google-cloud-billing/src/v1/cloud_catalog_client.ts | 5 ++--- packages/google-cloud-billing/synth.metadata | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index e757e5ade80..f93ceab7431 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -258,12 +258,11 @@ export class CloudBillingClient { } ); + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + descriptor ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 4c73aa4547c..98bd83e25be 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -246,12 +246,11 @@ export class CloudCatalogClient { } ); + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] + descriptor ); this.innerApiCalls[methodName] = apiCall; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index d6d69421eeb..401dd8d90d1 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "60419ded0b1b54a0db1113bbff1914c29bb36c79" + "sha": "b2f3c08203bc17120bc792ee59ebcf193b55a149" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "4f4aa3a03e470f1390758b9d89eb1aa88837a5be", - "internalRef": "320300472" + "sha": "94006b3cb8d2fb44703cf535da15608eed6bf7db", + "internalRef": "325949033" } }, { From e708ae05d0961e605ac5d91a97e750dd2449a6fc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 12 Aug 2020 09:36:23 -0700 Subject: [PATCH 069/169] chore: update cloud rad kokoro build job (#91) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/b742586e-df31-4aac-8092-78288e9ea8e7/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/bd0deaa1113b588d70449535ab9cbf0f2bd0e72f --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 401dd8d90d1..f99b89f5b26 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "b2f3c08203bc17120bc792ee59ebcf193b55a149" + "sha": "4f45a5afa2aa51c6fc9505b4258ac3e092da99ab" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "94421c47802f56a44c320257b2b4c190dc7d6b68" + "sha": "bd0deaa1113b588d70449535ab9cbf0f2bd0e72f" } } ], From 63c75a7ecf08e9983f2cd379b780ef0bc55ae436 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 13 Aug 2020 09:14:27 -0700 Subject: [PATCH 070/169] build: perform publish using Node 12 (#92) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/c36c6dbc-ab79-4f17-b70b-523b420b2a70/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/5747555f7620113d9a2078a48f4c047a99d31b3e --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index f99b89f5b26..c8cdf3457ad 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "4f45a5afa2aa51c6fc9505b4258ac3e092da99ab" + "sha": "becf8e885f91413ea0b1a0f65e4ae12dc9d1ea91" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "bd0deaa1113b588d70449535ab9cbf0f2bd0e72f" + "sha": "5747555f7620113d9a2078a48f4c047a99d31b3e" } } ], From bacb3fa26edf6f552e522313826795ee021e2bcc Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 19 Aug 2020 09:42:09 -0700 Subject: [PATCH 071/169] chore: start tracking obsolete files (#93) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/7a1b0b96-8ddb-4836-a1a2-d2f73b7e6ffe/targets - [ ] To automatically regenerate this PR, check this box. --- packages/google-cloud-billing/synth.metadata | 85 +++++++++++++++++++- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index c8cdf3457ad..5366b72a396 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,22 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "becf8e885f91413ea0b1a0f65e4ae12dc9d1ea91" + "sha": "355931be004e7f11c4132d3696d7d826aab105be" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "94006b3cb8d2fb44703cf535da15608eed6bf7db", - "internalRef": "325949033" + "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", + "internalRef": "327369997" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5747555f7620113d9a2078a48f4c047a99d31b3e" + "sha": "1a60ff2a3975c2f5054431588bd95db9c3b862ba" } } ], @@ -33,5 +33,82 @@ "generator": "bazel" } } + ], + "generatedFiles": [ + ".eslintignore", + ".eslintrc.json", + ".gitattributes", + ".github/ISSUE_TEMPLATE/bug_report.md", + ".github/ISSUE_TEMPLATE/feature_request.md", + ".github/ISSUE_TEMPLATE/support_request.md", + ".github/PULL_REQUEST_TEMPLATE.md", + ".github/publish.yml", + ".github/release-please.yml", + ".github/workflows/ci.yaml", + ".gitignore", + ".jsdoc.js", + ".kokoro/.gitattributes", + ".kokoro/common.cfg", + ".kokoro/continuous/node10/common.cfg", + ".kokoro/continuous/node10/docs.cfg", + ".kokoro/continuous/node10/lint.cfg", + ".kokoro/continuous/node10/samples-test.cfg", + ".kokoro/continuous/node10/system-test.cfg", + ".kokoro/continuous/node10/test.cfg", + ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/test.cfg", + ".kokoro/docs.sh", + ".kokoro/lint.sh", + ".kokoro/populate-secrets.sh", + ".kokoro/presubmit/node10/common.cfg", + ".kokoro/presubmit/node10/samples-test.cfg", + ".kokoro/presubmit/node10/system-test.cfg", + ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/test.cfg", + ".kokoro/publish.sh", + ".kokoro/release/docs-devsite.cfg", + ".kokoro/release/docs-devsite.sh", + ".kokoro/release/docs.cfg", + ".kokoro/release/docs.sh", + ".kokoro/release/publish.cfg", + ".kokoro/samples-test.sh", + ".kokoro/system-test.sh", + ".kokoro/test.bat", + ".kokoro/test.sh", + ".kokoro/trampoline.sh", + ".mocharc.js", + ".nycrc", + ".prettierignore", + ".prettierrc.js", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE", + "README.md", + "api-extractor.json", + "linkinator.config.json", + "package-lock.json.1098049865", + "protos/google/cloud/billing/v1/cloud_billing.proto", + "protos/google/cloud/billing/v1/cloud_catalog.proto", + "protos/protos.d.ts", + "protos/protos.js", + "protos/protos.json", + "renovate.json", + "samples/README.md", + "samples/package-lock.json.2846676223", + "src/index.ts", + "src/v1/cloud_billing_client.ts", + "src/v1/cloud_billing_client_config.json", + "src/v1/cloud_billing_proto_list.json", + "src/v1/cloud_catalog_client.ts", + "src/v1/cloud_catalog_client_config.json", + "src/v1/cloud_catalog_proto_list.json", + "src/v1/index.ts", + "system-test/fixtures/sample/src/index.js", + "system-test/fixtures/sample/src/index.ts", + "system-test/install.ts", + "test/gapic_cloud_billing_v1.ts", + "test/gapic_cloud_catalog_v1.ts", + "tsconfig.json", + "webpack.config.js" ] } \ No newline at end of file From 4d566763d1903c9cdc5fc523ed84b1274ccb4a28 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 21 Aug 2020 09:26:30 -0700 Subject: [PATCH 072/169] build: move system and samples test from Node 10 to Node 12 (#94) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/ba2d388f-b3b2-4ad7-a163-0c6b4d86894f/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/05de3e1e14a0b07eab8b474e669164dbd31f81fb --- packages/google-cloud-billing/synth.metadata | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 5366b72a396..12e78162850 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "355931be004e7f11c4132d3696d7d826aab105be" + "sha": "7be157c25bfadcd0576c947242fed2a341b92a56" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1a60ff2a3975c2f5054431588bd95db9c3b862ba" + "sha": "05de3e1e14a0b07eab8b474e669164dbd31f81fb" } } ], @@ -51,19 +51,19 @@ ".kokoro/common.cfg", ".kokoro/continuous/node10/common.cfg", ".kokoro/continuous/node10/docs.cfg", - ".kokoro/continuous/node10/lint.cfg", - ".kokoro/continuous/node10/samples-test.cfg", - ".kokoro/continuous/node10/system-test.cfg", ".kokoro/continuous/node10/test.cfg", ".kokoro/continuous/node12/common.cfg", + ".kokoro/continuous/node12/lint.cfg", + ".kokoro/continuous/node12/samples-test.cfg", + ".kokoro/continuous/node12/system-test.cfg", ".kokoro/continuous/node12/test.cfg", ".kokoro/docs.sh", ".kokoro/lint.sh", ".kokoro/populate-secrets.sh", ".kokoro/presubmit/node10/common.cfg", - ".kokoro/presubmit/node10/samples-test.cfg", - ".kokoro/presubmit/node10/system-test.cfg", ".kokoro/presubmit/node12/common.cfg", + ".kokoro/presubmit/node12/samples-test.cfg", + ".kokoro/presubmit/node12/system-test.cfg", ".kokoro/presubmit/node12/test.cfg", ".kokoro/publish.sh", ".kokoro/release/docs-devsite.cfg", @@ -86,7 +86,6 @@ "README.md", "api-extractor.json", "linkinator.config.json", - "package-lock.json.1098049865", "protos/google/cloud/billing/v1/cloud_billing.proto", "protos/google/cloud/billing/v1/cloud_catalog.proto", "protos/protos.d.ts", @@ -94,7 +93,6 @@ "protos/protos.json", "renovate.json", "samples/README.md", - "samples/package-lock.json.2846676223", "src/index.ts", "src/v1/cloud_billing_client.ts", "src/v1/cloud_billing_client_config.json", From 18298b7471409a81ab1d8964a34460a9e1ab902d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 28 Aug 2020 10:02:17 -0700 Subject: [PATCH 073/169] build: track flaky tests for "nightly", add new secrets for tagging (#95) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/a8ab5675-1982-4cf5-b9b7-36794038b975/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/8cf6d2834ad14318e64429c3b94f6443ae83daf9 --- packages/google-cloud-billing/synth.metadata | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 12e78162850..c30bdeac662 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "7be157c25bfadcd0576c947242fed2a341b92a56" + "sha": "82acb1444be1fd327a219c8532a04fb1a43dbe23" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "05de3e1e14a0b07eab8b474e669164dbd31f81fb" + "sha": "8cf6d2834ad14318e64429c3b94f6443ae83daf9" } } ], @@ -42,7 +42,6 @@ ".github/ISSUE_TEMPLATE/feature_request.md", ".github/ISSUE_TEMPLATE/support_request.md", ".github/PULL_REQUEST_TEMPLATE.md", - ".github/publish.yml", ".github/release-please.yml", ".github/workflows/ci.yaml", ".gitignore", From dc6bab6923b79e910aa5b80c8e42c1ac6bc4a6c3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sat, 12 Sep 2020 14:42:10 -0700 Subject: [PATCH 074/169] build(test): recursively find test files; fail on unsupported dependency versions (#98) Source-Author: Megan Potter <57276408+feywind@users.noreply.github.com> Source-Date: Fri Sep 11 18:47:00 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: fdd03c161003ab97657cc0218f25c82c89ddf4b6 Source-Link: https://github.com/googleapis/synthtool/commit/fdd03c161003ab97657cc0218f25c82c89ddf4b6 --- packages/google-cloud-billing/.mocharc.js | 3 ++- packages/google-cloud-billing/synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/.mocharc.js b/packages/google-cloud-billing/.mocharc.js index ff7b34fa5d1..0b600509bed 100644 --- a/packages/google-cloud-billing/.mocharc.js +++ b/packages/google-cloud-billing/.mocharc.js @@ -14,7 +14,8 @@ const config = { "enable-source-maps": true, "throw-deprecation": true, - "timeout": 10000 + "timeout": 10000, + "recursive": true } if (process.env.MOCHA_THROW_DEPRECATION === 'false') { delete config['throw-deprecation']; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index c30bdeac662..6fd7cd4df4f 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "82acb1444be1fd327a219c8532a04fb1a43dbe23" + "sha": "3bdf1e6a28f9506520ae0a61691d42b30c9386c2" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "8cf6d2834ad14318e64429c3b94f6443ae83daf9" + "sha": "fdd03c161003ab97657cc0218f25c82c89ddf4b6" } } ], From f1b5e2771692cb192a75071bd0fc52741c1ab4cb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 1 Oct 2020 05:13:29 -0700 Subject: [PATCH 075/169] chore: update bucket for cloud-rad (#100) Co-authored-by: gcf-merge-on-green[bot] <60162190+gcf-merge-on-green[bot]@users.noreply.github.com> Source-Author: F. Hinkelmann Source-Date: Wed Sep 30 14:13:57 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 079dcce498117f9570cebe6e6cff254b38ba3860 Source-Link: https://github.com/googleapis/synthtool/commit/079dcce498117f9570cebe6e6cff254b38ba3860 --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 6fd7cd4df4f..3c55c60f983 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "3bdf1e6a28f9506520ae0a61691d42b30c9386c2" + "sha": "9b7cf6b052315132407c8f455637664978404596" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "fdd03c161003ab97657cc0218f25c82c89ddf4b6" + "sha": "079dcce498117f9570cebe6e6cff254b38ba3860" } } ], From 4f5373269a136b0f728a48c71f1264721b93e859 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 6 Oct 2020 09:45:55 -0700 Subject: [PATCH 076/169] build(node_library): migrate to Trampoline V2 (#101) Source-Author: Takashi Matsuo Source-Date: Fri Oct 2 12:13:27 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: 0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9 Source-Link: https://github.com/googleapis/synthtool/commit/0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9 --- packages/google-cloud-billing/synth.metadata | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 3c55c60f983..110ebc16460 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "9b7cf6b052315132407c8f455637664978404596" + "sha": "b5dd878212b6f4a67f1926a89d64ec679b98c1b4" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "079dcce498117f9570cebe6e6cff254b38ba3860" + "sha": "0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9" } } ], @@ -75,10 +75,12 @@ ".kokoro/test.bat", ".kokoro/test.sh", ".kokoro/trampoline.sh", + ".kokoro/trampoline_v2.sh", ".mocharc.js", ".nycrc", ".prettierignore", ".prettierrc.js", + ".trampolinerc", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "LICENSE", From 7d5685ae9e089992280b38718eab8f87a2630ba6 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 12 Oct 2020 21:54:10 +0200 Subject: [PATCH 077/169] chore(deps): update dependency webpack-cli to v4 (#104) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [webpack-cli](https://togithub.com/webpack/webpack-cli) | devDependencies | major | [`^3.3.10` -> `^4.0.0`](https://renovatebot.com/diffs/npm/webpack-cli/3.3.12/4.0.0) | --- ### Release Notes
webpack/webpack-cli ### [`v4.0.0`](https://togithub.com/webpack/webpack-cli/blob/master/CHANGELOG.md#​400-httpsgithubcomwebpackwebpack-clicomparewebpack-cli400-rc1webpack-cli400-2020-10-10) [Compare Source](https://togithub.com/webpack/webpack-cli/compare/v3.3.12...webpack-cli@4.0.0) ##### Bug Fixes - add compilation lifecycle in watch instance ([#​1903](https://togithub.com/webpack/webpack-cli/issues/1903)) ([02b6d21](https://togithub.com/webpack/webpack-cli/commit/02b6d21eaa20166a7ed37816de716b8fc22b756a)) - cleanup `package-utils` package ([#​1822](https://togithub.com/webpack/webpack-cli/issues/1822)) ([fd5b92b](https://togithub.com/webpack/webpack-cli/commit/fd5b92b3cd40361daec5bf4486e455a41f4c9738)) - cli-executer supplies args further up ([#​1904](https://togithub.com/webpack/webpack-cli/issues/1904)) ([097564a](https://togithub.com/webpack/webpack-cli/commit/097564a851b36b63e0a6bf88144997ef65aa057a)) - exit code for validation errors ([59f6303](https://togithub.com/webpack/webpack-cli/commit/59f63037fcbdbb8934b578b9adf5725bc4ae1235)) - exit process in case of schema errors ([71e89b4](https://togithub.com/webpack/webpack-cli/commit/71e89b4092d953ea587cc4f606451ab78cbcdb93)) ##### Features - assign config paths in build dependencies in cache config ([#​1900](https://togithub.com/webpack/webpack-cli/issues/1900)) ([7e90f11](https://togithub.com/webpack/webpack-cli/commit/7e90f110b119f36ef9def4f66cf4e17ccf1438cd))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 1383aadd71f..8bef4b94453 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -48,7 +48,7 @@ "ts-loader": "^8.0.0", "typescript": "^3.8.3", "webpack": "^4.41.2", - "webpack-cli": "^3.3.10", + "webpack-cli": "^4.0.0", "@microsoft/api-documenter": "^7.8.10", "@microsoft/api-extractor": "^7.8.10" }, From 6999e689b75103098b49a5b2d4df320260e1bb15 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 14 Oct 2020 23:02:35 +0200 Subject: [PATCH 078/169] chore(deps): update dependency webpack to v5 (#103) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [webpack](https://togithub.com/webpack/webpack) | devDependencies | major | [`^4.41.2` -> `^5.0.0`](https://renovatebot.com/diffs/npm/webpack/4.44.2/5.1.0) | --- ### Release Notes
webpack/webpack ### [`v5.1.0`](https://togithub.com/webpack/webpack/releases/v5.1.0) [Compare Source](https://togithub.com/webpack/webpack/compare/v5.0.0...v5.1.0) ### Features - expose `webpack` property from `Compiler` - expose `cleverMerge`, `EntryOptionPlugin`, `DynamicEntryPlugin` ### Bugfixes - missing `require("..").xxx` in try-catch produces a warning instead of an error now - handle reexports in concatenated modules correctly when they are side-effect-free - fix incorrect deprecation message for ModuleTemplate.hooks.hash ### [`v5.0.0`](https://togithub.com/webpack/webpack/releases/v5.0.0) [Compare Source](https://togithub.com/webpack/webpack/compare/v4.44.2...v5.0.0) [Announcement and changelog](https://webpack.js.org/blog/2020-10-10-webpack-5-release/)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 8bef4b94453..3d9588a021b 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -47,7 +47,7 @@ "sinon": "^9.0.1", "ts-loader": "^8.0.0", "typescript": "^3.8.3", - "webpack": "^4.41.2", + "webpack": "^5.0.0", "webpack-cli": "^4.0.0", "@microsoft/api-documenter": "^7.8.10", "@microsoft/api-extractor": "^7.8.10" From 62a8ab8e564ecfa8d314a4b96f45d99a464c9589 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 16 Oct 2020 10:10:06 -0700 Subject: [PATCH 079/169] build: only check --engine-strict for production deps (#105) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/220288a4-7076-443b-9721-9f71deddc661/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/5451633881133e5573cc271a18e73b18caca8b1b --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 110ebc16460..50016898017 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "b5dd878212b6f4a67f1926a89d64ec679b98c1b4" + "sha": "b7d72c719ae8109d6dbf8a64ddbc1580ff228635" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0c868d49b8e05bc1f299bc773df9eb4ef9ed96e9" + "sha": "5451633881133e5573cc271a18e73b18caca8b1b" } } ], From 939d69287821d6b22b978f7b27c3f7fd0b7ce785 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 21 Oct 2020 16:14:40 -0700 Subject: [PATCH 080/169] chore: clean up Node.js TOC for cloud-rad (#106) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/5f7bb900-b4ec-41d2-acea-c5c2f5dfb4fa/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/901ddd44e9ef7887ee681b9183bbdea99437fdcc Source-Link: https://github.com/googleapis/synthtool/commit/f96d3b455fe27c3dc7bc37c3c9cd27b1c6d269c8 --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 50016898017..fcd15f6ae7e 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "b7d72c719ae8109d6dbf8a64ddbc1580ff228635" + "sha": "c5ee92d765130c624e5d9bdbacbca080692361d3" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "5451633881133e5573cc271a18e73b18caca8b1b" + "sha": "901ddd44e9ef7887ee681b9183bbdea99437fdcc" } } ], From fc5f9e9148afcd7bb2c4f87b1b7cc29d85c72a14 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 27 Oct 2020 08:38:49 -0700 Subject: [PATCH 081/169] docs: updated code of conduct (includes update to actions) (#109) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/6dcea365-b918-4c52-b1db-d7a62c956000/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/89c849ba5013e45e8fb688b138f33c2ec6083dc5 Source-Link: https://github.com/googleapis/synthtool/commit/a783321fd55f010709294455584a553f4b24b944 Source-Link: https://github.com/googleapis/synthtool/commit/b7413d38b763827c72c0360f0a3d286c84656eeb Source-Link: https://github.com/googleapis/synthtool/commit/5f6ef0ec5501d33c4667885b37a7685a30d41a76 --- .../google-cloud-billing/CODE_OF_CONDUCT.md | 123 +++++++++++++----- packages/google-cloud-billing/synth.metadata | 4 +- 2 files changed, 89 insertions(+), 38 deletions(-) diff --git a/packages/google-cloud-billing/CODE_OF_CONDUCT.md b/packages/google-cloud-billing/CODE_OF_CONDUCT.md index 46b2a08ea6d..2add2547a81 100644 --- a/packages/google-cloud-billing/CODE_OF_CONDUCT.md +++ b/packages/google-cloud-billing/CODE_OF_CONDUCT.md @@ -1,43 +1,94 @@ -# Contributor Code of Conduct + +# Code of Conduct -As contributors and maintainers of this project, -and in the interest of fostering an open and welcoming community, -we pledge to respect all people who contribute through reporting issues, -posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. +## Our Pledge -We are committed to making participation in this project -a harassment-free experience for everyone, -regardless of level of experience, gender, gender identity and expression, -sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, religion, or nationality. +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery -* Personal attacks -* Trolling or insulting/derogatory comments -* Public or private harassment -* Publishing other's private information, -such as physical or electronic -addresses, without explicit permission -* Other unethical or unprofessional conduct. +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct. -By adopting this Code of Conduct, -project maintainers commit themselves to fairly and consistently -applying these principles to every aspect of managing this project. -Project maintainers who do not follow or enforce the Code of Conduct -may be permanently removed from the project team. - -This code of conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. - -Instances of abusive, harassing, or otherwise unacceptable behavior -may be reported by opening an issue -or contacting one or more of the project maintainers. - -This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, -available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index fcd15f6ae7e..377b61f2228 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "c5ee92d765130c624e5d9bdbacbca080692361d3" + "sha": "7fcb5407c90cf562a694c8d9416196fbd249c51b" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "901ddd44e9ef7887ee681b9183bbdea99437fdcc" + "sha": "89c849ba5013e45e8fb688b138f33c2ec6083dc5" } } ], From f10bb373c605896ac2ad9c065170cc5c4aa59f6d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 2 Nov 2020 15:58:37 -0800 Subject: [PATCH 082/169] build(node): add KOKORO_BUILD_ARTIFACTS_SUBDIR to env (#110) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9f0ce149-63bd-4aad-917d-44f82c8912a6/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/ba9918cd22874245b55734f57470c719b577e591 --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 377b61f2228..d639640ab55 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "7fcb5407c90cf562a694c8d9416196fbd249c51b" + "sha": "881e40ffd1cfd794dd5edb6f81d7441876074b69" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "89c849ba5013e45e8fb688b138f33c2ec6083dc5" + "sha": "ba9918cd22874245b55734f57470c719b577e591" } } ], From fe34aca8bf731a7174a71bde1885808f7da0e372 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Fri, 6 Nov 2020 15:42:20 -0800 Subject: [PATCH 083/169] fix: do not modify options object, use defaultScopes (#111) Regenerated the library using [gapic-generator-typescript](https://github.com/googleapis/gapic-generator-typescript) v1.2.1. --- packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/src/index.ts | 2 + .../src/v1/cloud_billing_client.ts | 228 ++++++++++-------- .../src/v1/cloud_catalog_client.ts | 184 +++++++------- packages/google-cloud-billing/synth.metadata | 16 +- .../system-test/fixtures/sample/src/index.ts | 16 +- .../system-test/install.ts | 18 +- 7 files changed, 257 insertions(+), 209 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 3d9588a021b..0a80e9dea53 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -29,7 +29,7 @@ "api-documenter": "api-documenter yaml --input-folder=temp" }, "dependencies": { - "google-gax": "^2.1.0" + "google-gax": "^2.9.2" }, "devDependencies": { "@types/mocha": "^8.0.0", diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index 41db5b4968b..dd162d63199 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -18,7 +18,9 @@ import * as v1 from './v1'; const CloudBillingClient = v1.CloudBillingClient; +type CloudBillingClient = v1.CloudBillingClient; const CloudCatalogClient = v1.CloudCatalogClient; +type CloudCatalogClient = v1.CloudCatalogClient; export {v1, CloudBillingClient, CloudCatalogClient}; export default {v1, CloudBillingClient, CloudCatalogClient}; import * as protos from '../protos/protos'; diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index f93ceab7431..c04315cad74 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -60,8 +60,10 @@ export class CloudBillingClient { /** * Construct an instance of CloudBillingClient. * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] @@ -81,42 +83,33 @@ export class CloudBillingClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. + * TODO(@alexander-fenster): link to gax documentation. + * @param {boolean} fallback - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. */ - constructor(opts?: ClientOptions) { - // Ensure that options include the service address and port. + // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CloudBillingClient; const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; - const port = opts && opts.port ? opts.port : staticMembers.port; + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? typeof window !== 'undefined'; + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - if (!opts) { - opts = {servicePath, port}; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; } - opts.servicePath = opts.servicePath || servicePath; - opts.port = opts.port || port; - - // users can override the config from client side, like retry codes name. - // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 - // The way to override client config for Showcase API: - // - // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} - // const showcaseClient = new showcaseClient({ projectId, customConfig }); - opts.clientConfig = opts.clientConfig || {}; - // If we're running in browser, it's OK to omit `fallback` since - // google-gax has `browser` field in its `package.json`. - // For Electron (which does not respect `browser` field), - // pass `{fallback: true}` to the CloudBillingClient constructor. + // Choose either gRPC or proto-over-HTTP implementation of google-gax. this._gaxModule = opts.fallback ? gax.fallback : gax; - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = (this.constructor as typeof CloudBillingClient).scopes; + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. @@ -125,6 +118,11 @@ export class CloudBillingClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -273,6 +271,7 @@ export class CloudBillingClient { /** * The DNS address for this API service. + * @returns {string} The DNS address for this service. */ static get servicePath() { return 'cloudbilling.googleapis.com'; @@ -281,6 +280,7 @@ export class CloudBillingClient { /** * 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 'cloudbilling.googleapis.com'; @@ -288,6 +288,7 @@ export class CloudBillingClient { /** * The port for this API service. + * @returns {number} The default port for this service. */ static get port() { return 443; @@ -296,6 +297,7 @@ export class CloudBillingClient { /** * 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']; @@ -305,8 +307,7 @@ export class CloudBillingClient { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. + * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( callback?: Callback @@ -366,7 +367,11 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getBillingAccount(request); */ getBillingAccount( request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, @@ -464,7 +469,11 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateBillingAccount(request); */ updateBillingAccount( request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, @@ -564,7 +573,11 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.createBillingAccount(request); */ createBillingAccount( request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, @@ -649,7 +662,11 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getProjectBillingInfo(request); */ getProjectBillingInfo( request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, @@ -774,7 +791,11 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.updateProjectBillingInfo(request); */ updateProjectBillingInfo( request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, @@ -872,7 +893,11 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getIamPolicy(request); */ getIamPolicy( request: protos.google.iam.v1.IGetIamPolicyRequest, @@ -962,7 +987,11 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.setIamPolicy(request); */ setIamPolicy( request: protos.google.iam.v1.ISetIamPolicyRequest, @@ -1050,7 +1079,11 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.testIamPermissions(request); */ testIamPermissions( request: protos.google.iam.v1.ITestIamPermissionsRequest, @@ -1149,19 +1182,14 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * The client library support auto-pagination by default: it will call the API as many + * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListBillingAccountsRequest]{@link google.cloud.billing.v1.ListBillingAccountsRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListBillingAccountsResponse]{@link google.cloud.billing.v1.ListBillingAccountsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. + * Note that it can affect your quota. + * We recommend using `listBillingAccountsAsync()` + * 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. */ listBillingAccounts( request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, @@ -1202,18 +1230,7 @@ export class CloudBillingClient { } /** - * Equivalent to {@link listBillingAccounts}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listBillingAccounts} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {number} request.pageSize @@ -1234,6 +1251,13 @@ export class CloudBillingClient { * 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 [BillingAccount]{@link google.cloud.billing.v1.BillingAccount} 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 `listBillingAccountsAsync()` + * 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. */ listBillingAccountsStream( request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, @@ -1251,10 +1275,9 @@ export class CloudBillingClient { } /** - * Equivalent to {@link listBillingAccounts}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * Equivalent to `listBillingAccounts`, but returns an iterable object. * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {number} request.pageSize @@ -1274,7 +1297,18 @@ export class CloudBillingClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. 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.listBillingAccountsAsync(request); + * for await (const response of iterable) { + * // process response + * } */ listBillingAccountsAsync( request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, @@ -1344,19 +1378,14 @@ export class CloudBillingClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * The client library support auto-pagination by default: it will call the API as many + * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListProjectBillingInfoRequest]{@link google.cloud.billing.v1.ListProjectBillingInfoRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListProjectBillingInfoResponse]{@link google.cloud.billing.v1.ListProjectBillingInfoResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. + * Note that it can affect your quota. + * We recommend using `listProjectBillingInfoAsync()` + * 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. */ listProjectBillingInfo( request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, @@ -1408,18 +1437,7 @@ export class CloudBillingClient { } /** - * Equivalent to {@link listProjectBillingInfo}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProjectBillingInfo} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.name @@ -1436,6 +1454,13 @@ export class CloudBillingClient { * 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 [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo} 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 `listProjectBillingInfoAsync()` + * 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. */ listProjectBillingInfoStream( request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, @@ -1460,10 +1485,9 @@ export class CloudBillingClient { } /** - * Equivalent to {@link listProjectBillingInfo}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * Equivalent to `listProjectBillingInfo`, but returns an iterable object. * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {string} request.name @@ -1479,7 +1503,18 @@ export class CloudBillingClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. 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.listProjectBillingInfoAsync(request); + * for await (const response of iterable) { + * // process response + * } */ listProjectBillingInfoAsync( request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, @@ -1592,9 +1627,10 @@ export class CloudBillingClient { } /** - * Terminate the GRPC channel and close the client. + * Terminate the gRPC channel and close the client. * * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { this.initialize(); diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 98bd83e25be..7f912d4250c 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -62,8 +62,10 @@ export class CloudCatalogClient { /** * Construct an instance of CloudCatalogClient. * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] @@ -83,42 +85,33 @@ export class CloudCatalogClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. + * TODO(@alexander-fenster): link to gax documentation. + * @param {boolean} fallback - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. */ - constructor(opts?: ClientOptions) { - // Ensure that options include the service address and port. + // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CloudCatalogClient; const servicePath = - opts && opts.servicePath - ? opts.servicePath - : opts && opts.apiEndpoint - ? opts.apiEndpoint - : staticMembers.servicePath; - const port = opts && opts.port ? opts.port : staticMembers.port; - - if (!opts) { - opts = {servicePath, port}; + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? typeof window !== 'undefined'; + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; } - opts.servicePath = opts.servicePath || servicePath; - opts.port = opts.port || port; - - // users can override the config from client side, like retry codes name. - // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/master/src/gax.ts#L546 - // The way to override client config for Showcase API: - // - // const customConfig = {"interfaces": {"google.showcase.v1beta1.Echo": {"methods": {"Echo": {"retry_codes_name": "idempotent", "retry_params_name": "default"}}}}} - // const showcaseClient = new showcaseClient({ projectId, customConfig }); - opts.clientConfig = opts.clientConfig || {}; - - // If we're running in browser, it's OK to omit `fallback` since - // google-gax has `browser` field in its `package.json`. - // For Electron (which does not respect `browser` field), - // pass `{fallback: true}` to the CloudCatalogClient constructor. + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. this._gaxModule = opts.fallback ? gax.fallback : gax; - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = (this.constructor as typeof CloudCatalogClient).scopes; + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. @@ -127,6 +120,11 @@ export class CloudCatalogClient { // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -261,6 +259,7 @@ export class CloudCatalogClient { /** * The DNS address for this API service. + * @returns {string} The DNS address for this service. */ static get servicePath() { return 'cloudbilling.googleapis.com'; @@ -269,6 +268,7 @@ export class CloudCatalogClient { /** * 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 'cloudbilling.googleapis.com'; @@ -276,6 +276,7 @@ export class CloudCatalogClient { /** * The port for this API service. + * @returns {number} The default port for this service. */ static get port() { return 443; @@ -284,6 +285,7 @@ export class CloudCatalogClient { /** * 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']; @@ -293,8 +295,7 @@ export class CloudCatalogClient { getProjectId(callback: Callback): void; /** * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. + * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId( callback?: Callback @@ -352,19 +353,14 @@ export class CloudCatalogClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Service]{@link google.cloud.billing.v1.Service}. - * The client library support auto-pagination by default: it will call the API as many + * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Service]{@link google.cloud.billing.v1.Service} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListServicesRequest]{@link google.cloud.billing.v1.ListServicesRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListServicesResponse]{@link google.cloud.billing.v1.ListServicesResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. */ listServices( request: protos.google.cloud.billing.v1.IListServicesRequest, @@ -403,18 +399,7 @@ export class CloudCatalogClient { } /** - * Equivalent to {@link listServices}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listServices} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {number} request.pageSize @@ -427,6 +412,13 @@ export class CloudCatalogClient { * 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 [Service]{@link google.cloud.billing.v1.Service} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. */ listServicesStream( request?: protos.google.cloud.billing.v1.IListServicesRequest, @@ -444,10 +436,9 @@ export class CloudCatalogClient { } /** - * Equivalent to {@link listServices}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * Equivalent to `listServices`, but returns an iterable object. * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. * @param {Object} request * The request object that will be sent. * @param {number} request.pageSize @@ -459,7 +450,18 @@ export class CloudCatalogClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Service]{@link google.cloud.billing.v1.Service}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listServicesAsync(request); + * for await (const response of iterable) { + * // process response + * } */ listServicesAsync( request?: protos.google.cloud.billing.v1.IListServicesRequest, @@ -539,19 +541,14 @@ export class CloudCatalogClient { * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Sku]{@link google.cloud.billing.v1.Sku}. - * The client library support auto-pagination by default: it will call the API as many + * The client library will perform auto-pagination by default: it will call the API as many * times as needed and will merge results from all the pages into this array. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Sku]{@link google.cloud.billing.v1.Sku} that corresponds to - * the one page received from the API server. - * If the second element is not null it contains the request object of type [ListSkusRequest]{@link google.cloud.billing.v1.ListSkusRequest} - * that can be used to obtain the next page of the results. - * If it is null, the next page does not exist. - * The third element contains the raw response received from the API server. Its type is - * [ListSkusResponse]{@link google.cloud.billing.v1.ListSkusResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. + * Note that it can affect your quota. + * We recommend using `listSkusAsync()` + * 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. */ listSkus( request: protos.google.cloud.billing.v1.IListSkusRequest, @@ -595,18 +592,7 @@ export class CloudCatalogClient { } /** - * Equivalent to {@link listSkus}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listSkus} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. * @param {Object} request * The request object that will be sent. * @param {string} request.parent @@ -640,6 +626,13 @@ export class CloudCatalogClient { * 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 [Sku]{@link google.cloud.billing.v1.Sku} 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 `listSkusAsync()` + * 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. */ listSkusStream( request?: protos.google.cloud.billing.v1.IListSkusRequest, @@ -664,10 +657,9 @@ export class CloudCatalogClient { } /** - * Equivalent to {@link listSkus}, but returns an iterable object. - * - * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * Equivalent to `listSkus`, 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 @@ -700,7 +692,18 @@ export class CloudCatalogClient { * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Sku]{@link google.cloud.billing.v1.Sku}. 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.listSkusAsync(request); + * for await (const response of iterable) { + * // process response + * } */ listSkusAsync( request?: protos.google.cloud.billing.v1.IListSkusRequest, @@ -788,9 +791,10 @@ export class CloudCatalogClient { } /** - * Terminate the GRPC channel and close the client. + * Terminate the gRPC channel and close the client. * * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { this.initialize(); diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index d639640ab55..564f5ebd3bb 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,23 +3,15 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "881e40ffd1cfd794dd5edb6f81d7441876074b69" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "4c5071b615d96ef9dfd6a63d8429090f1f2872bb", - "internalRef": "327369997" + "remote": "git@github.com:googleapis/nodejs-billing.git", + "sha": "f76fe0026d03a8a8f3c0b3d4f352628ca7e9b7de" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "ba9918cd22874245b55734f57470c719b577e591" + "sha": "1f1148d3c7a7a52f0c98077f976bd9b3c948ee2b" } } ], @@ -87,6 +79,7 @@ "README.md", "api-extractor.json", "linkinator.config.json", + "package-lock.json.2677892991", "protos/google/cloud/billing/v1/cloud_billing.proto", "protos/google/cloud/billing/v1/cloud_catalog.proto", "protos/protos.d.ts", @@ -94,6 +87,7 @@ "protos/protos.json", "renovate.json", "samples/README.md", + "samples/package-lock.json.1460149391", "src/index.ts", "src/v1/cloud_billing_client.ts", "src/v1/cloud_billing_client_config.json", diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts index f9b03e70d14..7611d0a914d 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts @@ -18,9 +18,21 @@ import {CloudBillingClient, CloudCatalogClient} from '@google-cloud/billing'; +// check that the client class type name can be used +function doStuffWithCloudBillingClient(client: CloudBillingClient) { + client.close(); +} +function doStuffWithCloudCatalogClient(client: CloudCatalogClient) { + client.close(); +} + function main() { - new CloudBillingClient(); - new CloudCatalogClient(); + // check that the client instance can be created + const cloudBillingClient = new CloudBillingClient(); + doStuffWithCloudBillingClient(cloudBillingClient); + // check that the client instance can be created + const cloudCatalogClient = new CloudCatalogClient(); + doStuffWithCloudCatalogClient(cloudCatalogClient); } main(); diff --git a/packages/google-cloud-billing/system-test/install.ts b/packages/google-cloud-billing/system-test/install.ts index 4c1ba3eb79a..39d90f771de 100644 --- a/packages/google-cloud-billing/system-test/install.ts +++ b/packages/google-cloud-billing/system-test/install.ts @@ -20,32 +20,32 @@ import {packNTest} from 'pack-n-play'; import {readFileSync} from 'fs'; import {describe, it} from 'mocha'; -describe('typescript consumer tests', () => { - it('should have correct type signature for typescript users', async function () { +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), sample: { - description: 'typescript based user can use the type definitions', + description: 'TypeScript user can use the type definitions', ts: readFileSync( './system-test/fixtures/sample/src/index.ts' ).toString(), }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); }); - it('should have correct type signature for javascript users', async function () { + it('JavaScript code', async function () { this.timeout(300000); const options = { - packageDir: process.cwd(), // path to your module. + packageDir: process.cwd(), sample: { - description: 'typescript based user can use the type definitions', + description: 'JavaScript user can use the library', ts: readFileSync( './system-test/fixtures/sample/src/index.js' ).toString(), }, }; - await packNTest(options); // will throw upon error. + await packNTest(options); }); }); From 80f889e62cff03f417f0ef6dfb4f647de7cb6017 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 23 Nov 2020 12:14:45 -0800 Subject: [PATCH 084/169] fix(browser): check for fetch on window --- .../google-cloud-billing/protos/protos.json | 179 ++++++++++++++++-- .../src/v1/cloud_billing_client.ts | 124 ++++++------ .../src/v1/cloud_catalog_client.ts | 44 +++-- packages/google-cloud-billing/synth.metadata | 14 +- 4 files changed, 266 insertions(+), 95 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.json b/packages/google-cloud-billing/protos/protos.json index 33e609c1e96..0867dc9ac63 100644 --- a/packages/google-cloud-billing/protos/protos.json +++ b/packages/google-cloud-billing/protos/protos.json @@ -28,7 +28,17 @@ "options": { "(google.api.http).get": "/v1/{name=billingAccounts/*}", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=billingAccounts/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "ListBillingAccounts": { "requestType": "ListBillingAccountsRequest", @@ -36,7 +46,17 @@ "options": { "(google.api.http).get": "/v1/billingAccounts", "(google.api.method_signature)": "" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/billingAccounts" + } + }, + { + "(google.api.method_signature)": "" + } + ] }, "UpdateBillingAccount": { "requestType": "UpdateBillingAccountRequest", @@ -45,7 +65,18 @@ "(google.api.http).patch": "/v1/{name=billingAccounts/*}", "(google.api.http).body": "account", "(google.api.method_signature)": "name,account" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{name=billingAccounts/*}", + "body": "account" + } + }, + { + "(google.api.method_signature)": "name,account" + } + ] }, "CreateBillingAccount": { "requestType": "CreateBillingAccountRequest", @@ -54,7 +85,18 @@ "(google.api.http).post": "/v1/billingAccounts", "(google.api.http).body": "billing_account", "(google.api.method_signature)": "billing_account" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/billingAccounts", + "body": "billing_account" + } + }, + { + "(google.api.method_signature)": "billing_account" + } + ] }, "ListProjectBillingInfo": { "requestType": "ListProjectBillingInfoRequest", @@ -62,7 +104,17 @@ "options": { "(google.api.http).get": "/v1/{name=billingAccounts/*}/projects", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=billingAccounts/*}/projects" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "GetProjectBillingInfo": { "requestType": "GetProjectBillingInfoRequest", @@ -70,7 +122,17 @@ "options": { "(google.api.http).get": "/v1/{name=projects/*}/billingInfo", "(google.api.method_signature)": "name" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*}/billingInfo" + } + }, + { + "(google.api.method_signature)": "name" + } + ] }, "UpdateProjectBillingInfo": { "requestType": "UpdateProjectBillingInfoRequest", @@ -79,7 +141,18 @@ "(google.api.http).put": "/v1/{name=projects/*}/billingInfo", "(google.api.http).body": "project_billing_info", "(google.api.method_signature)": "name,project_billing_info" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "put": "/v1/{name=projects/*}/billingInfo", + "body": "project_billing_info" + } + }, + { + "(google.api.method_signature)": "name,project_billing_info" + } + ] }, "GetIamPolicy": { "requestType": "google.iam.v1.GetIamPolicyRequest", @@ -87,7 +160,17 @@ "options": { "(google.api.http).get": "/v1/{resource=billingAccounts/*}:getIamPolicy", "(google.api.method_signature)": "resource" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{resource=billingAccounts/*}:getIamPolicy" + } + }, + { + "(google.api.method_signature)": "resource" + } + ] }, "SetIamPolicy": { "requestType": "google.iam.v1.SetIamPolicyRequest", @@ -96,7 +179,18 @@ "(google.api.http).post": "/v1/{resource=billingAccounts/*}:setIamPolicy", "(google.api.http).body": "*", "(google.api.method_signature)": "resource,policy" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=billingAccounts/*}:setIamPolicy", + "body": "*" + } + }, + { + "(google.api.method_signature)": "resource,policy" + } + ] }, "TestIamPermissions": { "requestType": "google.iam.v1.TestIamPermissionsRequest", @@ -105,7 +199,18 @@ "(google.api.http).post": "/v1/{resource=billingAccounts/*}:testIamPermissions", "(google.api.http).body": "*", "(google.api.method_signature)": "resource,permissions" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=billingAccounts/*}:testIamPermissions", + "body": "*" + } + }, + { + "(google.api.method_signature)": "resource,permissions" + } + ] } } }, @@ -301,7 +406,17 @@ "options": { "(google.api.http).get": "/v1/services", "(google.api.method_signature)": "" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/services" + } + }, + { + "(google.api.method_signature)": "" + } + ] }, "ListSkus": { "requestType": "ListSkusRequest", @@ -309,7 +424,17 @@ "options": { "(google.api.http).get": "/v1/{parent=services/*}/skus", "(google.api.method_signature)": "parent" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=services/*}/skus" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] } } }, @@ -1713,7 +1838,15 @@ "options": { "(google.api.http).post": "/v1/{resource=**}:setIamPolicy", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:setIamPolicy", + "body": "*" + } + } + ] }, "GetIamPolicy": { "requestType": "GetIamPolicyRequest", @@ -1721,7 +1854,15 @@ "options": { "(google.api.http).post": "/v1/{resource=**}:getIamPolicy", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:getIamPolicy", + "body": "*" + } + } + ] }, "TestIamPermissions": { "requestType": "TestIamPermissionsRequest", @@ -1729,7 +1870,15 @@ "options": { "(google.api.http).post": "/v1/{resource=**}:testIamPermissions", "(google.api.http).body": "*" - } + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{resource=**}:testIamPermissions", + "body": "*" + } + } + ] } } }, diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index c04315cad74..15b8d394aae 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, @@ -30,6 +31,11 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1/cloud_billing_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './cloud_billing_client_config.json'; const version = require('../../../package.json').version; @@ -83,9 +89,9 @@ export class CloudBillingClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -98,7 +104,9 @@ export class CloudBillingClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -324,7 +332,7 @@ export class CloudBillingClient { // ------------------- getBillingAccount( request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.IBillingAccount, @@ -334,7 +342,7 @@ export class CloudBillingClient { >; getBillingAccount( request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.billing.v1.IBillingAccount, | protos.google.cloud.billing.v1.IGetBillingAccountRequest @@ -376,7 +384,7 @@ export class CloudBillingClient { getBillingAccount( request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.billing.v1.IBillingAccount, | protos.google.cloud.billing.v1.IGetBillingAccountRequest @@ -399,12 +407,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -419,7 +427,7 @@ export class CloudBillingClient { } updateBillingAccount( request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.IBillingAccount, @@ -429,7 +437,7 @@ export class CloudBillingClient { >; updateBillingAccount( request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.billing.v1.IBillingAccount, | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest @@ -478,7 +486,7 @@ export class CloudBillingClient { updateBillingAccount( request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.billing.v1.IBillingAccount, | protos.google.cloud.billing.v1.IUpdateBillingAccountRequest @@ -501,12 +509,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -521,7 +529,7 @@ export class CloudBillingClient { } createBillingAccount( request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.IBillingAccount, @@ -531,7 +539,7 @@ export class CloudBillingClient { >; createBillingAccount( request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.billing.v1.IBillingAccount, | protos.google.cloud.billing.v1.ICreateBillingAccountRequest @@ -582,7 +590,7 @@ export class CloudBillingClient { createBillingAccount( request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.billing.v1.IBillingAccount, | protos.google.cloud.billing.v1.ICreateBillingAccountRequest @@ -605,12 +613,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; this.initialize(); @@ -618,7 +626,7 @@ export class CloudBillingClient { } getProjectBillingInfo( request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.IProjectBillingInfo, @@ -628,7 +636,7 @@ export class CloudBillingClient { >; getProjectBillingInfo( request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.billing.v1.IProjectBillingInfo, | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest @@ -671,7 +679,7 @@ export class CloudBillingClient { getProjectBillingInfo( request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.billing.v1.IProjectBillingInfo, | protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest @@ -694,12 +702,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -714,7 +722,7 @@ export class CloudBillingClient { } updateProjectBillingInfo( request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.IProjectBillingInfo, @@ -727,7 +735,7 @@ export class CloudBillingClient { >; updateProjectBillingInfo( request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.cloud.billing.v1.IProjectBillingInfo, | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest @@ -800,7 +808,7 @@ export class CloudBillingClient { updateProjectBillingInfo( request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.cloud.billing.v1.IProjectBillingInfo, | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest @@ -826,12 +834,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -850,7 +858,7 @@ export class CloudBillingClient { } getIamPolicy( request: protos.google.iam.v1.IGetIamPolicyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.iam.v1.IPolicy, @@ -860,7 +868,7 @@ export class CloudBillingClient { >; getIamPolicy( request: protos.google.iam.v1.IGetIamPolicyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, @@ -902,7 +910,7 @@ export class CloudBillingClient { getIamPolicy( request: protos.google.iam.v1.IGetIamPolicyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, @@ -921,12 +929,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -941,7 +949,7 @@ export class CloudBillingClient { } setIamPolicy( request: protos.google.iam.v1.ISetIamPolicyRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.iam.v1.IPolicy, @@ -951,7 +959,7 @@ export class CloudBillingClient { >; setIamPolicy( request: protos.google.iam.v1.ISetIamPolicyRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, @@ -996,7 +1004,7 @@ export class CloudBillingClient { setIamPolicy( request: protos.google.iam.v1.ISetIamPolicyRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, @@ -1015,12 +1023,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1035,7 +1043,7 @@ export class CloudBillingClient { } testIamPermissions( request: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.iam.v1.ITestIamPermissionsResponse, @@ -1045,7 +1053,7 @@ export class CloudBillingClient { >; testIamPermissions( request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: gax.CallOptions, + options: CallOptions, callback: Callback< protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, @@ -1088,7 +1096,7 @@ export class CloudBillingClient { testIamPermissions( request: protos.google.iam.v1.ITestIamPermissionsRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | Callback< protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, @@ -1107,12 +1115,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1128,7 +1136,7 @@ export class CloudBillingClient { listBillingAccounts( request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.IBillingAccount[], @@ -1138,7 +1146,7 @@ export class CloudBillingClient { >; listBillingAccounts( request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options: gax.CallOptions, + options: CallOptions, callback: PaginationCallback< protos.google.cloud.billing.v1.IListBillingAccountsRequest, | protos.google.cloud.billing.v1.IListBillingAccountsResponse @@ -1194,7 +1202,7 @@ export class CloudBillingClient { listBillingAccounts( request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | PaginationCallback< protos.google.cloud.billing.v1.IListBillingAccountsRequest, | protos.google.cloud.billing.v1.IListBillingAccountsResponse @@ -1217,12 +1225,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; this.initialize(); @@ -1261,7 +1269,7 @@ export class CloudBillingClient { */ listBillingAccountsStream( request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions + options?: CallOptions ): Transform { request = request || {}; options = options || {}; @@ -1312,7 +1320,7 @@ export class CloudBillingClient { */ listBillingAccountsAsync( request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: gax.CallOptions + options?: CallOptions ): AsyncIterable { request = request || {}; options = options || {}; @@ -1327,7 +1335,7 @@ export class CloudBillingClient { } listProjectBillingInfo( request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.IProjectBillingInfo[], @@ -1337,7 +1345,7 @@ export class CloudBillingClient { >; listProjectBillingInfo( request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options: gax.CallOptions, + options: CallOptions, callback: PaginationCallback< protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse @@ -1390,7 +1398,7 @@ export class CloudBillingClient { listProjectBillingInfo( request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | PaginationCallback< protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse @@ -1413,12 +1421,12 @@ export class CloudBillingClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -1464,7 +1472,7 @@ export class CloudBillingClient { */ listProjectBillingInfoStream( request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions + options?: CallOptions ): Transform { request = request || {}; options = options || {}; @@ -1518,7 +1526,7 @@ export class CloudBillingClient { */ listProjectBillingInfoAsync( request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: gax.CallOptions + options?: CallOptions ): AsyncIterable { request = request || {}; options = options || {}; diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 7f912d4250c..6d91a66a66f 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -16,6 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** +/* global window */ import * as gax from 'google-gax'; import { Callback, @@ -30,6 +31,11 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v1/cloud_catalog_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ import * as gapicConfig from './cloud_catalog_client_config.json'; const version = require('../../../package.json').version; @@ -85,9 +91,9 @@ export class CloudCatalogClient { * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - client configuration override. - * TODO(@alexander-fenster): link to gax documentation. - * @param {boolean} fallback - Use HTTP fallback mode. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` @@ -100,7 +106,9 @@ export class CloudCatalogClient { opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? typeof window !== 'undefined'; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. @@ -313,7 +321,7 @@ export class CloudCatalogClient { listServices( request: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.IService[], @@ -323,7 +331,7 @@ export class CloudCatalogClient { >; listServices( request: protos.google.cloud.billing.v1.IListServicesRequest, - options: gax.CallOptions, + options: CallOptions, callback: PaginationCallback< protos.google.cloud.billing.v1.IListServicesRequest, protos.google.cloud.billing.v1.IListServicesResponse | null | undefined, @@ -365,7 +373,7 @@ export class CloudCatalogClient { listServices( request: protos.google.cloud.billing.v1.IListServicesRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | PaginationCallback< protos.google.cloud.billing.v1.IListServicesRequest, | protos.google.cloud.billing.v1.IListServicesResponse @@ -386,12 +394,12 @@ export class CloudCatalogClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; this.initialize(); @@ -422,7 +430,7 @@ export class CloudCatalogClient { */ listServicesStream( request?: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions + options?: CallOptions ): Transform { request = request || {}; options = options || {}; @@ -465,7 +473,7 @@ export class CloudCatalogClient { */ listServicesAsync( request?: protos.google.cloud.billing.v1.IListServicesRequest, - options?: gax.CallOptions + options?: CallOptions ): AsyncIterable { request = request || {}; options = options || {}; @@ -480,7 +488,7 @@ export class CloudCatalogClient { } listSkus( request: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions + options?: CallOptions ): Promise< [ protos.google.cloud.billing.v1.ISku[], @@ -490,7 +498,7 @@ export class CloudCatalogClient { >; listSkus( request: protos.google.cloud.billing.v1.IListSkusRequest, - options: gax.CallOptions, + options: CallOptions, callback: PaginationCallback< protos.google.cloud.billing.v1.IListSkusRequest, protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, @@ -553,7 +561,7 @@ export class CloudCatalogClient { listSkus( request: protos.google.cloud.billing.v1.IListSkusRequest, optionsOrCallback?: - | gax.CallOptions + | CallOptions | PaginationCallback< protos.google.cloud.billing.v1.IListSkusRequest, protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, @@ -572,12 +580,12 @@ export class CloudCatalogClient { ] > | void { request = request || {}; - let options: gax.CallOptions; + let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { - options = optionsOrCallback as gax.CallOptions; + options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; @@ -636,7 +644,7 @@ export class CloudCatalogClient { */ listSkusStream( request?: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions + options?: CallOptions ): Transform { request = request || {}; options = options || {}; @@ -707,7 +715,7 @@ export class CloudCatalogClient { */ listSkusAsync( request?: protos.google.cloud.billing.v1.IListSkusRequest, - options?: gax.CallOptions + options?: CallOptions ): AsyncIterable { request = request || {}; options = options || {}; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 564f5ebd3bb..f8624d928eb 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -3,8 +3,16 @@ { "git": { "name": ".", - "remote": "git@github.com:googleapis/nodejs-billing.git", - "sha": "f76fe0026d03a8a8f3c0b3d4f352628ca7e9b7de" + "remote": "https://github.com/googleapis/nodejs-billing.git", + "sha": "be029ad5c807cc8d04b8bddde83eb2d53f580a1c" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "2f019bf70bfe06f1e2af1b04011b0a2405190e43", + "internalRef": "343202295" } }, { @@ -79,7 +87,6 @@ "README.md", "api-extractor.json", "linkinator.config.json", - "package-lock.json.2677892991", "protos/google/cloud/billing/v1/cloud_billing.proto", "protos/google/cloud/billing/v1/cloud_catalog.proto", "protos/protos.d.ts", @@ -87,7 +94,6 @@ "protos/protos.json", "renovate.json", "samples/README.md", - "samples/package-lock.json.1460149391", "src/index.ts", "src/v1/cloud_billing_client.ts", "src/v1/cloud_billing_client_config.json", From c4b596419b509ac81001626989cf719e9fc8ef7f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 25 Nov 2020 08:34:44 -0800 Subject: [PATCH 085/169] docs: spelling correction for "targetting" (#115) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/c503f640-90ae-4547-bcc8-a154d32c609e/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/15013eff642a7e7e855aed5a29e6e83c39beba2a --- packages/google-cloud-billing/README.md | 2 +- packages/google-cloud-billing/synth.metadata | 80 +------------------- 2 files changed, 3 insertions(+), 79 deletions(-) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index d15b0342b3a..3518e69995c 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -103,7 +103,7 @@ Our client libraries follow the [Node.js release schedule](https://nodejs.org/en Libraries are compatible with all current _active_ and _maintenance_ versions of Node.js. -Client libraries targetting some end-of-life versions of Node.js are available, and +Client libraries targeting some end-of-life versions of Node.js are available, and can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). The dist-tags follow the naming convention `legacy-(version)`. diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index f8624d928eb..aa6d2b1ddae 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "be029ad5c807cc8d04b8bddde83eb2d53f580a1c" + "sha": "abd30678d328bdb62c54dc892c5300342c275e72" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "1f1148d3c7a7a52f0c98077f976bd9b3c948ee2b" + "sha": "15013eff642a7e7e855aed5a29e6e83c39beba2a" } } ], @@ -33,81 +33,5 @@ "generator": "bazel" } } - ], - "generatedFiles": [ - ".eslintignore", - ".eslintrc.json", - ".gitattributes", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/release-please.yml", - ".github/workflows/ci.yaml", - ".gitignore", - ".jsdoc.js", - ".kokoro/.gitattributes", - ".kokoro/common.cfg", - ".kokoro/continuous/node10/common.cfg", - ".kokoro/continuous/node10/docs.cfg", - ".kokoro/continuous/node10/test.cfg", - ".kokoro/continuous/node12/common.cfg", - ".kokoro/continuous/node12/lint.cfg", - ".kokoro/continuous/node12/samples-test.cfg", - ".kokoro/continuous/node12/system-test.cfg", - ".kokoro/continuous/node12/test.cfg", - ".kokoro/docs.sh", - ".kokoro/lint.sh", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/node10/common.cfg", - ".kokoro/presubmit/node12/common.cfg", - ".kokoro/presubmit/node12/samples-test.cfg", - ".kokoro/presubmit/node12/system-test.cfg", - ".kokoro/presubmit/node12/test.cfg", - ".kokoro/publish.sh", - ".kokoro/release/docs-devsite.cfg", - ".kokoro/release/docs-devsite.sh", - ".kokoro/release/docs.cfg", - ".kokoro/release/docs.sh", - ".kokoro/release/publish.cfg", - ".kokoro/samples-test.sh", - ".kokoro/system-test.sh", - ".kokoro/test.bat", - ".kokoro/test.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".mocharc.js", - ".nycrc", - ".prettierignore", - ".prettierrc.js", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.md", - "LICENSE", - "README.md", - "api-extractor.json", - "linkinator.config.json", - "protos/google/cloud/billing/v1/cloud_billing.proto", - "protos/google/cloud/billing/v1/cloud_catalog.proto", - "protos/protos.d.ts", - "protos/protos.js", - "protos/protos.json", - "renovate.json", - "samples/README.md", - "src/index.ts", - "src/v1/cloud_billing_client.ts", - "src/v1/cloud_billing_client_config.json", - "src/v1/cloud_billing_proto_list.json", - "src/v1/cloud_catalog_client.ts", - "src/v1/cloud_catalog_client_config.json", - "src/v1/cloud_catalog_proto_list.json", - "src/v1/index.ts", - "system-test/fixtures/sample/src/index.js", - "system-test/fixtures/sample/src/index.ts", - "system-test/install.ts", - "test/gapic_cloud_billing_v1.ts", - "test/gapic_cloud_catalog_v1.ts", - "tsconfig.json", - "webpack.config.js" ] } \ No newline at end of file From 28f1b8da99df4de579b4ed3ff52cf5ae46ae1bf7 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2020 19:40:36 +0000 Subject: [PATCH 086/169] chore: release 2.1.3 (#114) :robot: I have created a release \*beep\* \*boop\* --- ### [2.1.3](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.2...v2.1.3) (2020-11-25) ### Bug Fixes * **browser:** check for fetch on window ([abd3067](https://www.github.com/googleapis/nodejs-billing/commit/abd30678d328bdb62c54dc892c5300342c275e72)) * do not modify options object, use defaultScopes ([#111](https://www.github.com/googleapis/nodejs-billing/issues/111)) ([be029ad](https://www.github.com/googleapis/nodejs-billing/commit/be029ad5c807cc8d04b8bddde83eb2d53f580a1c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- packages/google-cloud-billing/CHANGELOG.md | 8 ++++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 1c5e0c55db1..eab2af69f5f 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [2.1.3](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.2...v2.1.3) (2020-11-25) + + +### Bug Fixes + +* **browser:** check for fetch on window ([abd3067](https://www.github.com/googleapis/nodejs-billing/commit/abd30678d328bdb62c54dc892c5300342c275e72)) +* do not modify options object, use defaultScopes ([#111](https://www.github.com/googleapis/nodejs-billing/issues/111)) ([be029ad](https://www.github.com/googleapis/nodejs-billing/commit/be029ad5c807cc8d04b8bddde83eb2d53f580a1c)) + ### [2.1.2](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.1...v2.1.2) (2020-07-09) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 0a80e9dea53..b3f722037b9 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.1.2", + "version": "2.1.3", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index b6db411e666..0c38d5fa871 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.1.2" + "@google-cloud/billing": "^2.1.3" }, "devDependencies": { "c8": "^7.1.0", From 06b42c64dd954e36785a5070e41d2bd2609a5028 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 4 Dec 2020 08:56:17 -0800 Subject: [PATCH 087/169] chore: generate GAPIC metadata JSON file (#116) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/464906e9-6f3c-41d1-906e-fd7073c42d19/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 345596855 Source-Link: https://github.com/googleapis/googleapis/commit/d189e871205fea665a9648f7c4676f027495ccaf --- .../src/v1/gapic_metadata.json | 108 ++++++++++++++++++ packages/google-cloud-billing/synth.metadata | 6 +- 2 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 packages/google-cloud-billing/src/v1/gapic_metadata.json diff --git a/packages/google-cloud-billing/src/v1/gapic_metadata.json b/packages/google-cloud-billing/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..7ca271242d7 --- /dev/null +++ b/packages/google-cloud-billing/src/v1/gapic_metadata.json @@ -0,0 +1,108 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.billing.v1", + "libraryPackage": "@google-cloud/billing", + "services": {"CloudBilling": {"clients": { + "grpc": { + "libraryClient": "CloudBillingClient", + "rpcs": {"GetBillingAccount": { + "methods": ["getBillingAccount"] + },"UpdateBillingAccount": { + "methods": ["updateBillingAccount"] + },"CreateBillingAccount": { + "methods": ["createBillingAccount"] + },"GetProjectBillingInfo": { + "methods": ["getProjectBillingInfo"] + },"UpdateProjectBillingInfo": { + "methods": ["updateProjectBillingInfo"] + },"GetIamPolicy": { + "methods": ["getIamPolicy"] + },"SetIamPolicy": { + "methods": ["setIamPolicy"] + },"TestIamPermissions": { + "methods": ["testIamPermissions"] + },"ListBillingAccounts": { + "methods": [ + "listBillingAccounts", + "listBillingAccountsStream", + "listBillingAccountsAsync" + ] + },"ListProjectBillingInfo": { + "methods": [ + "listProjectBillingInfo", + "listProjectBillingInfoStream", + "listProjectBillingInfoAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "CloudBillingClient", + "rpcs": {"GetBillingAccount": { + "methods": ["getBillingAccount"] + },"UpdateBillingAccount": { + "methods": ["updateBillingAccount"] + },"CreateBillingAccount": { + "methods": ["createBillingAccount"] + },"GetProjectBillingInfo": { + "methods": ["getProjectBillingInfo"] + },"UpdateProjectBillingInfo": { + "methods": ["updateProjectBillingInfo"] + },"GetIamPolicy": { + "methods": ["getIamPolicy"] + },"SetIamPolicy": { + "methods": ["setIamPolicy"] + },"TestIamPermissions": { + "methods": ["testIamPermissions"] + },"ListBillingAccounts": { + "methods": [ + "listBillingAccounts", + "listBillingAccountsStream", + "listBillingAccountsAsync" + ] + },"ListProjectBillingInfo": { + "methods": [ + "listProjectBillingInfo", + "listProjectBillingInfoStream", + "listProjectBillingInfoAsync" + ] + }} + } + } + },"CloudCatalog": {"clients": { + "grpc": { + "libraryClient": "CloudCatalogClient", + "rpcs": {"ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + },"ListSkus": { + "methods": [ + "listSkus", + "listSkusStream", + "listSkusAsync" + ] + }} + }, + "grpc-fallback": { + "libraryClient": "CloudCatalogClient", + "rpcs": {,"ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + },"ListSkus": { + "methods": [ + "listSkus", + "listSkusStream", + "listSkusAsync" + ] + }} + } + } + }} +} diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index aa6d2b1ddae..beed0c0d62a 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "abd30678d328bdb62c54dc892c5300342c275e72" + "sha": "d6f17adc70f0d3f8ab5ad649a5e0cbd1d1d8e3e1" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2f019bf70bfe06f1e2af1b04011b0a2405190e43", - "internalRef": "343202295" + "sha": "d189e871205fea665a9648f7c4676f027495ccaf", + "internalRef": "345596855" } }, { From 79372c754eb73142b0d307e4dc09dbd936dc3c8c Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 7 Dec 2020 09:09:43 -0800 Subject: [PATCH 088/169] chore: fixing syntax error in the GAPIC metadata JSON file (#117) Use gapic-generator-typescript v1.2.8. Committer: @alexander-fenster PiperOrigin-RevId: 345712055 Source-Author: Google APIs Source-Date: Fri Dec 4 10:54:47 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 16dd59787d6ce130ab66066c02eeea9dac0c8f0e Source-Link: https://github.com/googleapis/googleapis/commit/16dd59787d6ce130ab66066c02eeea9dac0c8f0e --- .../src/v1/gapic_metadata.json | 223 +++++++++++------- packages/google-cloud-billing/synth.metadata | 6 +- 2 files changed, 147 insertions(+), 82 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/gapic_metadata.json b/packages/google-cloud-billing/src/v1/gapic_metadata.json index 7ca271242d7..57395f94def 100644 --- a/packages/google-cloud-billing/src/v1/gapic_metadata.json +++ b/packages/google-cloud-billing/src/v1/gapic_metadata.json @@ -4,105 +4,170 @@ "language": "typescript", "protoPackage": "google.cloud.billing.v1", "libraryPackage": "@google-cloud/billing", - "services": {"CloudBilling": {"clients": { + "services": { + "CloudBilling": { + "clients": { "grpc": { "libraryClient": "CloudBillingClient", - "rpcs": {"GetBillingAccount": { - "methods": ["getBillingAccount"] - },"UpdateBillingAccount": { - "methods": ["updateBillingAccount"] - },"CreateBillingAccount": { - "methods": ["createBillingAccount"] - },"GetProjectBillingInfo": { - "methods": ["getProjectBillingInfo"] - },"UpdateProjectBillingInfo": { - "methods": ["updateProjectBillingInfo"] - },"GetIamPolicy": { - "methods": ["getIamPolicy"] - },"SetIamPolicy": { - "methods": ["setIamPolicy"] - },"TestIamPermissions": { - "methods": ["testIamPermissions"] - },"ListBillingAccounts": { - "methods": [ - "listBillingAccounts", - "listBillingAccountsStream", - "listBillingAccountsAsync" - ] - },"ListProjectBillingInfo": { - "methods": [ - "listProjectBillingInfo", - "listProjectBillingInfoStream", - "listProjectBillingInfoAsync" - ] - }} + "rpcs": { + "GetBillingAccount": { + "methods": [ + "getBillingAccount" + ] + }, + "UpdateBillingAccount": { + "methods": [ + "updateBillingAccount" + ] + }, + "CreateBillingAccount": { + "methods": [ + "createBillingAccount" + ] + }, + "GetProjectBillingInfo": { + "methods": [ + "getProjectBillingInfo" + ] + }, + "UpdateProjectBillingInfo": { + "methods": [ + "updateProjectBillingInfo" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "ListBillingAccounts": { + "methods": [ + "listBillingAccounts", + "listBillingAccountsStream", + "listBillingAccountsAsync" + ] + }, + "ListProjectBillingInfo": { + "methods": [ + "listProjectBillingInfo", + "listProjectBillingInfoStream", + "listProjectBillingInfoAsync" + ] + } + } }, "grpc-fallback": { "libraryClient": "CloudBillingClient", - "rpcs": {"GetBillingAccount": { - "methods": ["getBillingAccount"] - },"UpdateBillingAccount": { - "methods": ["updateBillingAccount"] - },"CreateBillingAccount": { - "methods": ["createBillingAccount"] - },"GetProjectBillingInfo": { - "methods": ["getProjectBillingInfo"] - },"UpdateProjectBillingInfo": { - "methods": ["updateProjectBillingInfo"] - },"GetIamPolicy": { - "methods": ["getIamPolicy"] - },"SetIamPolicy": { - "methods": ["setIamPolicy"] - },"TestIamPermissions": { - "methods": ["testIamPermissions"] - },"ListBillingAccounts": { - "methods": [ - "listBillingAccounts", - "listBillingAccountsStream", - "listBillingAccountsAsync" - ] - },"ListProjectBillingInfo": { - "methods": [ - "listProjectBillingInfo", - "listProjectBillingInfoStream", - "listProjectBillingInfoAsync" - ] - }} + "rpcs": { + "GetBillingAccount": { + "methods": [ + "getBillingAccount" + ] + }, + "UpdateBillingAccount": { + "methods": [ + "updateBillingAccount" + ] + }, + "CreateBillingAccount": { + "methods": [ + "createBillingAccount" + ] + }, + "GetProjectBillingInfo": { + "methods": [ + "getProjectBillingInfo" + ] + }, + "UpdateProjectBillingInfo": { + "methods": [ + "updateProjectBillingInfo" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "ListBillingAccounts": { + "methods": [ + "listBillingAccounts", + "listBillingAccountsStream", + "listBillingAccountsAsync" + ] + }, + "ListProjectBillingInfo": { + "methods": [ + "listProjectBillingInfo", + "listProjectBillingInfoStream", + "listProjectBillingInfoAsync" + ] + } + } } } - },"CloudCatalog": {"clients": { + }, + "CloudCatalog": { + "clients": { "grpc": { "libraryClient": "CloudCatalogClient", - "rpcs": {"ListServices": { + "rpcs": { + "ListServices": { "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" + "listServices", + "listServicesStream", + "listServicesAsync" ] - },"ListSkus": { + }, + "ListSkus": { "methods": [ - "listSkus", - "listSkusStream", - "listSkusAsync" + "listSkus", + "listSkusStream", + "listSkusAsync" ] - }} + } + } }, "grpc-fallback": { "libraryClient": "CloudCatalogClient", - "rpcs": {,"ListServices": { + "rpcs": { + "ListServices": { "methods": [ - "listServices", - "listServicesStream", - "listServicesAsync" + "listServices", + "listServicesStream", + "listServicesAsync" ] - },"ListSkus": { + }, + "ListSkus": { "methods": [ - "listSkus", - "listSkusStream", - "listSkusAsync" + "listSkus", + "listSkusStream", + "listSkusAsync" ] - }} + } + } } } - }} + } + } } diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index beed0c0d62a..1f48773fc4e 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "d6f17adc70f0d3f8ab5ad649a5e0cbd1d1d8e3e1" + "sha": "f68988c1f8830d89c635efdf73a1c7cf83f501e5" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "d189e871205fea665a9648f7c4676f027495ccaf", - "internalRef": "345596855" + "sha": "16dd59787d6ce130ab66066c02eeea9dac0c8f0e", + "internalRef": "345712055" } }, { From 6c379160a951e9acacd3514e349b7514577f3c41 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 22 Dec 2020 11:44:19 -0800 Subject: [PATCH 089/169] docs: add instructions for authenticating for system tests (#118) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9943226b-8e9b-44fd-b025-446fc572242a/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/363fe305e9ce34a6cd53951c6ee5f997094b54ee --- packages/google-cloud-billing/CONTRIBUTING.md | 15 +++++++++++++-- packages/google-cloud-billing/README.md | 3 +-- packages/google-cloud-billing/synth.metadata | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-billing/CONTRIBUTING.md b/packages/google-cloud-billing/CONTRIBUTING.md index f6c4cf010e3..5436815212e 100644 --- a/packages/google-cloud-billing/CONTRIBUTING.md +++ b/packages/google-cloud-billing/CONTRIBUTING.md @@ -37,6 +37,15 @@ accept your pull requests. 1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling. 1. Submit a pull request. +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Cloud Billing API][enable_api]. +1. [Set up authentication with a service account][auth] so you can access the + API from your local workstation. + + ## Running the tests 1. [Prepare your environment for Node.js setup][setup]. @@ -51,11 +60,9 @@ accept your pull requests. npm test # Run sample integration tests. - gcloud auth application-default login npm run samples-test # Run all system tests. - gcloud auth application-default login npm run system-test 1. Lint (and maybe fix) any changes: @@ -63,3 +70,7 @@ accept your pull requests. npm run fix [setup]: https://cloud.google.com/nodejs/docs/setup +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudbilling.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 3518e69995c..06f084f2123 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -85,8 +85,7 @@ listBillingAccounts(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-billing/tree/master/samples) directory. The samples' `README.md` -has instructions for running the samples. +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-billing/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 1f48773fc4e..e9b82d26738 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "f68988c1f8830d89c635efdf73a1c7cf83f501e5" + "sha": "49935bf7953f6b9a4b405dff747e00c452c790e5" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "15013eff642a7e7e855aed5a29e6e83c39beba2a" + "sha": "363fe305e9ce34a6cd53951c6ee5f997094b54ee" } } ], From f937b031e36c286ad1403b9b4730b3198464af49 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 7 Jan 2021 11:36:49 -0800 Subject: [PATCH 090/169] docs: update year on headings (#119) --- packages/google-cloud-billing/.jsdoc.js | 4 ++-- packages/google-cloud-billing/protos/protos.d.ts | 2 +- packages/google-cloud-billing/protos/protos.js | 2 +- packages/google-cloud-billing/src/index.ts | 2 +- packages/google-cloud-billing/src/v1/cloud_billing_client.ts | 2 +- packages/google-cloud-billing/src/v1/cloud_catalog_client.ts | 2 +- packages/google-cloud-billing/src/v1/index.ts | 2 +- packages/google-cloud-billing/synth.metadata | 2 +- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- packages/google-cloud-billing/system-test/install.ts | 2 +- packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts | 2 +- packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/google-cloud-billing/.jsdoc.js b/packages/google-cloud-billing/.jsdoc.js index 70028a95946..be80b46b0bd 100644 --- a/packages/google-cloud-billing/.jsdoc.js +++ b/packages/google-cloud-billing/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2020 Google LLC', + copyright: 'Copyright 2021 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/billing', diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index 14ed436dc47..ba4f3ec8b88 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index c781d429a5a..f2b37ab0513 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index dd162d63199..332ac39cfe2 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 15b8d394aae..01f66a6c6c7 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 6d91a66a66f..3931f27dcd8 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/src/v1/index.ts b/packages/google-cloud-billing/src/v1/index.ts index 6e2f971b42f..188a628d1e6 100644 --- a/packages/google-cloud-billing/src/v1/index.ts +++ b/packages/google-cloud-billing/src/v1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index e9b82d26738..115c93dec92 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "49935bf7953f6b9a4b405dff747e00c452c790e5" + "sha": "748ef69ff67cf1cdc1926c2cf75307f469d7f997" } }, { diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js index 44b4cebd3a2..575d6a7e3d9 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts index 7611d0a914d..8453df928f5 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/system-test/install.ts b/packages/google-cloud-billing/system-test/install.ts index 39d90f771de..d2d61c0396f 100644 --- a/packages/google-cloud-billing/system-test/install.ts +++ b/packages/google-cloud-billing/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 2df2bb4e9e5..37a518d9e3f 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index ebbfe17647b..aca1aab9cba 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 65c8b901b405eab5b73602896caacd6a3a06db5f Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 8 Jan 2021 18:40:35 -0800 Subject: [PATCH 091/169] feat: adds style enumeration (#120) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/792bebba-dea1-4f73-8394-fb548c6dd86b/targets - [ ] To automatically regenerate this PR, check this box. --- .../google-cloud-billing/protos/protos.d.ts | 12 +++ .../google-cloud-billing/protos/protos.js | 78 ++++++++++++++++++- .../google-cloud-billing/protos/protos.json | 13 +++- packages/google-cloud-billing/synth.metadata | 2 +- 4 files changed, 102 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index ba4f3ec8b88..858abf7d176 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -2989,6 +2989,9 @@ export namespace google { /** ResourceDescriptor singular */ singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); } /** Represents a ResourceDescriptor. */ @@ -3018,6 +3021,9 @@ export namespace google { /** ResourceDescriptor singular. */ public singular: string; + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + /** * Creates a new ResourceDescriptor instance using the specified properties. * @param [properties] Properties to set @@ -3097,6 +3103,12 @@ export namespace google { ORIGINALLY_SINGLE_PATTERN = 1, FUTURE_MULTI_PATTERN = 2 } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } } /** Properties of a ResourceReference. */ diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index f2b37ab0513..043b5f2aa67 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -6945,6 +6945,7 @@ * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history * @property {string|null} [plural] ResourceDescriptor plural * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style */ /** @@ -6957,6 +6958,7 @@ */ function ResourceDescriptor(properties) { this.pattern = []; + this.style = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7011,6 +7013,14 @@ */ ResourceDescriptor.prototype.singular = ""; + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + /** * Creates a new ResourceDescriptor instance using the specified properties. * @function create @@ -7048,6 +7058,12 @@ writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } return writer; }; @@ -7102,6 +7118,16 @@ case 6: message.singular = reader.string(); break; + case 10: + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; default: reader.skipType(tag & 7); break; @@ -7165,6 +7191,18 @@ if (message.singular != null && message.hasOwnProperty("singular")) if (!$util.isString(message.singular)) return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } return null; }; @@ -7209,6 +7247,23 @@ message.plural = String(object.plural); if (object.singular != null) message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } return message; }; @@ -7225,8 +7280,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.pattern = []; + object.style = []; + } if (options.defaults) { object.type = ""; object.nameField = ""; @@ -7249,6 +7306,11 @@ object.plural = message.plural; if (message.singular != null && message.hasOwnProperty("singular")) object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } return object; }; @@ -7279,6 +7341,20 @@ return values; })(); + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + return ResourceDescriptor; })(); diff --git a/packages/google-cloud-billing/protos/protos.json b/packages/google-cloud-billing/protos/protos.json index 0867dc9ac63..9133c50cca6 100644 --- a/packages/google-cloud-billing/protos/protos.json +++ b/packages/google-cloud-billing/protos/protos.json @@ -870,6 +870,11 @@ "singular": { "type": "string", "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 } }, "nested": { @@ -879,6 +884,12 @@ "ORIGINALLY_SINGLE_PATTERN": 1, "FUTURE_MULTI_PATTERN": 2 } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } } } }, @@ -898,7 +909,7 @@ }, "protobuf": { "options": { - "go_package": "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor", + "go_package": "google.golang.org/protobuf/types/descriptorpb", "java_package": "com.google.protobuf", "java_outer_classname": "DescriptorProtos", "csharp_namespace": "Google.Protobuf.Reflection", diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 115c93dec92..8aa28b9cd66 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "748ef69ff67cf1cdc1926c2cf75307f469d7f997" + "sha": "f4e68c42af86121de0da550e44c94572efe1f74b" } }, { From 865ea6865a89c48b449ca92f594ada9d0df6425b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 12 Jan 2021 18:36:31 +0000 Subject: [PATCH 092/169] chore: release 2.2.0 (#121) :robot: I have created a release \*beep\* \*boop\* --- ## [2.2.0](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.3...v2.2.0) (2021-01-09) ### Features * adds style enumeration ([#120](https://www.github.com/googleapis/nodejs-billing/issues/120)) ([8f70df9](https://www.github.com/googleapis/nodejs-billing/commit/8f70df92f1a2a5217ae64c10819da55cb01b20fd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index eab2af69f5f..f1cd31a183b 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.2.0](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.3...v2.2.0) (2021-01-09) + + +### Features + +* adds style enumeration ([#120](https://www.github.com/googleapis/nodejs-billing/issues/120)) ([8f70df9](https://www.github.com/googleapis/nodejs-billing/commit/8f70df92f1a2a5217ae64c10819da55cb01b20fd)) + ### [2.1.3](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.2...v2.1.3) (2020-11-25) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index b3f722037b9..f0d3c463d4d 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.1.3", + "version": "2.2.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 0c38d5fa871..ac7a7dda295 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.1.3" + "@google-cloud/billing": "^2.2.0" }, "devDependencies": { "c8": "^7.1.0", From 7d0436f625bf5b716e1d9b5fd32d5f255173a92c Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 27 Jan 2021 08:42:23 -0800 Subject: [PATCH 093/169] refactor(nodejs): move build cop to flakybot (#123) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/dfbad313-7afb-4cf6-b229-0476fcc2130c/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/57c23fa5705499a4181095ced81f0ee0933b64f6 --- packages/google-cloud-billing/synth.metadata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index 8aa28b9cd66..f2e720d0553 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "f4e68c42af86121de0da550e44c94572efe1f74b" + "sha": "d9ad464effebc2b9eb101f44bf3cd1d797005d32" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "363fe305e9ce34a6cd53951c6ee5f997094b54ee" + "sha": "57c23fa5705499a4181095ced81f0ee0933b64f6" } } ], From 45b21fba9cd3ec3abfd8449634e655fa92ede163 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 3 Feb 2021 17:58:18 -0800 Subject: [PATCH 094/169] build: adds UNORDERED_LIST enum (#124) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/3c80116f-2a08-4668-9798-3d8677b45629/targets - [ ] To automatically regenerate this PR, check this box. --- packages/google-cloud-billing/protos/protos.d.ts | 3 ++- packages/google-cloud-billing/protos/protos.js | 7 +++++++ packages/google-cloud-billing/protos/protos.json | 3 ++- packages/google-cloud-billing/synth.metadata | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index 858abf7d176..4fe7aeae9bb 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -2966,7 +2966,8 @@ export namespace google { REQUIRED = 2, OUTPUT_ONLY = 3, INPUT_ONLY = 4, - IMMUTABLE = 5 + IMMUTABLE = 5, + UNORDERED_LIST = 6 } /** Properties of a ResourceDescriptor. */ diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index 043b5f2aa67..f0e301f4008 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -6921,6 +6921,7 @@ * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value * @property {number} INPUT_ONLY=4 INPUT_ONLY value * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value */ api.FieldBehavior = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -6930,6 +6931,7 @@ values[valuesById[3] = "OUTPUT_ONLY"] = 3; values[valuesById[4] = "INPUT_ONLY"] = 4; values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; return values; })(); @@ -13097,6 +13099,7 @@ case 3: case 4: case 5: + case 6: break; } } @@ -13197,6 +13200,10 @@ case 5: message[".google.api.fieldBehavior"][i] = 5; break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; } } if (object[".google.api.resourceReference"] != null) { diff --git a/packages/google-cloud-billing/protos/protos.json b/packages/google-cloud-billing/protos/protos.json index 9133c50cca6..c67b6ee9b02 100644 --- a/packages/google-cloud-billing/protos/protos.json +++ b/packages/google-cloud-billing/protos/protos.json @@ -825,7 +825,8 @@ "REQUIRED": 2, "OUTPUT_ONLY": 3, "INPUT_ONLY": 4, - "IMMUTABLE": 5 + "IMMUTABLE": 5, + "UNORDERED_LIST": 6 } }, "resourceReference": { diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index f2e720d0553..d1516ed55a3 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "d9ad464effebc2b9eb101f44bf3cd1d797005d32" + "sha": "3a1635db47a67ee14caade8c4403b92f0fde1baf" } }, { From 5873be6ad872aa2f61dcaf60a180ab40ecaa4afa Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sun, 7 Mar 2021 09:00:29 -0800 Subject: [PATCH 095/169] build: update gapic-generator-typescript to v1.2.10. (#126) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9f8e7599-f87d-4fac-8f3a-a2e1781c33be/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 361273630 Source-Link: https://github.com/googleapis/googleapis/commit/5477122b3e8037a1dc5bc920536158edbd151dc4 --- packages/google-cloud-billing/synth.metadata | 6 +++--- packages/google-cloud-billing/webpack.config.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata index d1516ed55a3..d77a37c561f 100644 --- a/packages/google-cloud-billing/synth.metadata +++ b/packages/google-cloud-billing/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "3a1635db47a67ee14caade8c4403b92f0fde1baf" + "sha": "fa058adac852bcbc14f4450620ebe2dab7e28250" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "16dd59787d6ce130ab66066c02eeea9dac0c8f0e", - "internalRef": "345712055" + "sha": "5477122b3e8037a1dc5bc920536158edbd151dc4", + "internalRef": "361273630" } }, { diff --git a/packages/google-cloud-billing/webpack.config.js b/packages/google-cloud-billing/webpack.config.js index 21d8795fa42..54886307455 100644 --- a/packages/google-cloud-billing/webpack.config.js +++ b/packages/google-cloud-billing/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 3db8e9c1e4df148661fc2e5424ddb7c1dede24f2 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 23 Mar 2021 17:48:08 +0100 Subject: [PATCH 096/169] chore(deps): update dependency sinon to v10 (#128) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^9.0.1` -> `^10.0.0`](https://renovatebot.com/diffs/npm/sinon/9.2.4/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/compatibility-slim/9.2.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/10.0.0/confidence-slim/9.2.4)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v10.0.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1000--2021-03-22) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v9.2.4...v10.0.0) ================== - Upgrade nise to 4.1.0 - Use [@​sinonjs/eslint-config](https://togithub.com/sinonjs/eslint-config)[@​4](https://togithub.com/4) => Adopts ES2017 => Drops support for IE 11, Legacy Edge and legacy Safari
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index f0d3c463d4d..65f5b5b63a8 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -44,7 +44,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^9.0.1", + "sinon": "^10.0.0", "ts-loader": "^8.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From de90295e8d0c371c60b7306bf4b112ec7de5b840 Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Thu, 1 Apr 2021 23:52:43 -0700 Subject: [PATCH 097/169] chore: migrate to owl bot (#129) * chore: migrate to owl bot * chore: copy files from googleapis-gen fb91803ccef5d7c695139b22788b309e2197856b * chore: run the post processor --- .../google-cloud-billing/.github/.OwlBot.yaml | 25 +++++++++++++ .../google-cloud-billing/.repo-metadata.json | 15 ++++---- packages/google-cloud-billing/src/index.ts | 8 ++-- packages/google-cloud-billing/synth.metadata | 37 ------------------- 4 files changed, 38 insertions(+), 47 deletions(-) create mode 100644 packages/google-cloud-billing/.github/.OwlBot.yaml delete mode 100644 packages/google-cloud-billing/synth.metadata diff --git a/packages/google-cloud-billing/.github/.OwlBot.yaml b/packages/google-cloud-billing/.github/.OwlBot.yaml new file mode 100644 index 00000000000..7f86dd9be40 --- /dev/null +++ b/packages/google-cloud-billing/.github/.OwlBot.yaml @@ -0,0 +1,25 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +docker: + image: gcr.io/repo-automation-bots/owlbot-nodejs:latest + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/billing/(v.*)/.*-nodejs/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: fb91803ccef5d7c695139b22788b309e2197856b + diff --git a/packages/google-cloud-billing/.repo-metadata.json b/packages/google-cloud-billing/.repo-metadata.json index fd3f2d863b2..f884b66bd5e 100644 --- a/packages/google-cloud-billing/.repo-metadata.json +++ b/packages/google-cloud-billing/.repo-metadata.json @@ -1,13 +1,14 @@ { - "name": "billing", - "name_pretty": "Cloud Billing", - "product_documentation": "https://cloud.google.com/billing/docs", - "client_documentation": "https://googleapis.dev/nodejs/billing/latest/index.html", - "issue_tracker": "https://issuetracker.google.com/savedsearches/559770", - "release_level": "ga", "language": "nodejs", + "requires_billing": true, + "product_documentation": "https://cloud.google.com/billing/docs", "repo": "googleapis/nodejs-billing", + "default_version": "v1", + "name_pretty": "Cloud Billing", + "release_level": "ga", "distribution_name": "@google-cloud/billing", + "name": "billing", + "client_documentation": "https://googleapis.dev/nodejs/billing/latest/index.html", "api_id": "cloudbilling.googleapis.com", - "requires_billing": true + "issue_tracker": "https://issuetracker.google.com/savedsearches/559770" } diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index 332ac39cfe2..d7bd82d2a3f 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. @@ -12,15 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; + const CloudBillingClient = v1.CloudBillingClient; type CloudBillingClient = v1.CloudBillingClient; const CloudCatalogClient = v1.CloudCatalogClient; type CloudCatalogClient = v1.CloudCatalogClient; + export {v1, CloudBillingClient, CloudCatalogClient}; export default {v1, CloudBillingClient, CloudCatalogClient}; import * as protos from '../protos/protos'; diff --git a/packages/google-cloud-billing/synth.metadata b/packages/google-cloud-billing/synth.metadata deleted file mode 100644 index d77a37c561f..00000000000 --- a/packages/google-cloud-billing/synth.metadata +++ /dev/null @@ -1,37 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/nodejs-billing.git", - "sha": "fa058adac852bcbc14f4450620ebe2dab7e28250" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5477122b3e8037a1dc5bc920536158edbd151dc4", - "internalRef": "361273630" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "57c23fa5705499a4181095ced81f0ee0933b64f6" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "billing", - "apiVersion": "v1", - "language": "nodejs", - "generator": "bazel" - } - } - ] -} \ No newline at end of file From 963af561ec2fa68e93cf797091ded6d88edb8812 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Mon, 5 Apr 2021 17:28:57 -0700 Subject: [PATCH 098/169] build: delete synth.py file to stop nightly gen (#132) --- packages/google-cloud-billing/synth.py | 39 -------------------------- 1 file changed, 39 deletions(-) delete mode 100644 packages/google-cloud-billing/synth.py diff --git a/packages/google-cloud-billing/synth.py b/packages/google-cloud-billing/synth.py deleted file mode 100644 index b0e9d0f4585..00000000000 --- a/packages/google-cloud-billing/synth.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""This script is used to synthesize generated parts of this library.""" - -import synthtool as s -import synthtool.gcp as gcp -import synthtool.languages.node as node -import logging - -logging.basicConfig(level=logging.DEBUG) - -AUTOSYNTH_MULTIPLE_COMMITS = True - - -# run the gapic generator -name = 'billing' -gapic = gcp.GAPICBazel() -versions = ['v1'] -for version in versions: - library = gapic.node_library(name, version) -s.copy(library, excludes=['package.json', 'README.md']) - -# Copy common templates -common_templates = gcp.CommonTemplates() -templates = common_templates.node_library(source_location='build/src') -s.copy(templates, excludes=[]) - -node.postprocess_gapic_library() From f431936d520fbc08cf559aa90579bfca11441fc7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 14 Apr 2021 23:10:18 +0200 Subject: [PATCH 099/169] chore(deps): update dependency @types/sinon to v10 (#135) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^9.0.0` -> `^10.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/9.0.11/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/compatibility-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/confidence-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 65f5b5b63a8..a462a1a6cdf 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -34,7 +34,7 @@ "devDependencies": { "@types/mocha": "^8.0.0", "@types/node": "^12.0.0", - "@types/sinon": "^9.0.0", + "@types/sinon": "^10.0.0", "c8": "^7.0.0", "gts": "^2.0.0", "jsdoc": "^3.5.5", From 1a02a4e40874e4e22a08a7e6aaa501f58f130131 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 20 Apr 2021 00:56:22 +0200 Subject: [PATCH 100/169] chore(deps): update dependency ts-loader to v9 (#139) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ts-loader](https://togithub.com/TypeStrong/ts-loader) | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/ts-loader/8.1.0/9.0.0) | [![age](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/compatibility-slim/8.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/ts-loader/9.0.0/confidence-slim/8.1.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
TypeStrong/ts-loader ### [`v9.0.0`](https://togithub.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md#v900) [Compare Source](https://togithub.com/TypeStrong/ts-loader/compare/v8.1.0...v9.0.0) Breaking changes: - minimum webpack version: 5 - minimum node version: 12 Changes: - [webpack 5 migration](https://togithub.com/TypeStrong/ts-loader/pull/1251) - thanks [@​johnnyreilly](https://togithub.com/johnnyreilly), [@​jonwallsten](https://togithub.com/jonwallsten), [@​sokra](https://togithub.com/sokra), [@​appzuka](https://togithub.com/appzuka), [@​alexander-akait](https://togithub.com/alexander-akait)
--- ### Configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index a462a1a6cdf..d4c16cba841 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -45,7 +45,7 @@ "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", "sinon": "^10.0.0", - "ts-loader": "^8.0.0", + "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", "webpack-cli": "^4.0.0", From d29a2ee1a1e3d46b7f92e7a3823ecc24ddce0d7f Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 6 May 2021 17:48:35 -0700 Subject: [PATCH 101/169] fix(deps): require google-gax v2.12.0 (#143) --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index d4c16cba841..1092b94a877 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -29,7 +29,7 @@ "api-documenter": "api-documenter yaml --input-folder=temp" }, "dependencies": { - "google-gax": "^2.9.2" + "google-gax": "^2.12.0" }, "devDependencies": { "@types/mocha": "^8.0.0", From b7491a14838f18b3d4d3b97b27636de5d699fdd4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 17:00:23 +0000 Subject: [PATCH 102/169] chore: new owl bot post processor docker image (#145) gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:f93bb861d6f12574437bb9aee426b71eafd63b419669ff0ed029f4b7e7162e3f --- .../google-cloud-billing/protos/protos.d.ts | 10 +- .../google-cloud-billing/protos/protos.js | 20 +- .../src/v1/cloud_billing_client.ts | 109 ++++----- .../src/v1/cloud_catalog_client.ts | 46 ++-- .../test/gapic_cloud_billing_v1.ts | 219 ++++++++---------- .../test/gapic_cloud_catalog_v1.ts | 53 ++--- 6 files changed, 211 insertions(+), 246 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index 4fe7aeae9bb..357aa03c493 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -2763,19 +2763,19 @@ export namespace google { public selector: string; /** HttpRule get. */ - public get: string; + public get?: (string|null); /** HttpRule put. */ - public put: string; + public put?: (string|null); /** HttpRule post. */ - public post: string; + public post?: (string|null); /** HttpRule delete. */ - public delete: string; + public delete?: (string|null); /** HttpRule patch. */ - public patch: string; + public patch?: (string|null); /** HttpRule custom. */ public custom?: (google.api.ICustomHttpPattern|null); diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index f0e301f4008..3056801cf81 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -6282,43 +6282,43 @@ /** * HttpRule get. - * @member {string} get + * @member {string|null|undefined} get * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.get = ""; + HttpRule.prototype.get = null; /** * HttpRule put. - * @member {string} put + * @member {string|null|undefined} put * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.put = ""; + HttpRule.prototype.put = null; /** * HttpRule post. - * @member {string} post + * @member {string|null|undefined} post * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.post = ""; + HttpRule.prototype.post = null; /** * HttpRule delete. - * @member {string} delete + * @member {string|null|undefined} delete * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype["delete"] = ""; + HttpRule.prototype["delete"] = null; /** * HttpRule patch. - * @member {string} patch + * @member {string|null|undefined} patch * @memberof google.api.HttpRule * @instance */ - HttpRule.prototype.patch = ""; + HttpRule.prototype.patch = null; /** * HttpRule custom. diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 01f66a6c6c7..59e4b709a2a 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -252,13 +252,14 @@ export class CloudBillingClient { ]; for (const methodName of cloudBillingStubMethods) { const callPromise = this.cloudBillingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -417,11 +418,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getBillingAccount(request, options, callback); } @@ -519,11 +519,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.updateBillingAccount(request, options, callback); } @@ -712,11 +711,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.getProjectBillingInfo(request, options, callback); } @@ -844,11 +842,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.updateProjectBillingInfo( request, @@ -939,11 +936,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } @@ -1033,11 +1029,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } @@ -1125,11 +1120,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - resource: request.resource || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + resource: request.resource || '', + }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); } @@ -1329,7 +1323,7 @@ export class CloudBillingClient { this.initialize(); return this.descriptors.page.listBillingAccounts.asyncIterate( this.innerApiCalls['listBillingAccounts'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -1431,11 +1425,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); this.initialize(); return this.innerApiCalls.listProjectBillingInfo( request, @@ -1478,11 +1471,10 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listProjectBillingInfo.createStream( @@ -1532,17 +1524,16 @@ export class CloudBillingClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listProjectBillingInfo.asyncIterate( this.innerApiCalls['listProjectBillingInfo'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 3931f27dcd8..d8b62c532d7 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -240,13 +240,14 @@ export class CloudCatalogClient { const cloudCatalogStubMethods = ['listServices', 'listSkus']; for (const methodName of cloudCatalogStubMethods) { const callPromise = this.cloudCatalogStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err: Error | null | undefined) => () => { throw err; } @@ -482,7 +483,7 @@ export class CloudCatalogClient { this.initialize(); return this.descriptors.page.listServices.asyncIterate( this.innerApiCalls['listServices'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } @@ -590,11 +591,10 @@ export class CloudCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); this.initialize(); return this.innerApiCalls.listSkus(request, options, callback); } @@ -650,11 +650,10 @@ export class CloudCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listSkus.createStream( @@ -721,17 +720,16 @@ export class CloudCatalogClient { options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent || '', - }); + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); options = options || {}; const callSettings = new gax.CallSettings(options); this.initialize(); return this.descriptors.page.listSkus.asyncIterate( this.innerApiCalls['listSkus'] as GaxCall, - (request as unknown) as RequestType, + request as unknown as RequestType, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 37a518d9e3f..8f9b042f1cd 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -247,9 +246,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); - client.innerApiCalls.getBillingAccount = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getBillingAccount = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getBillingAccount( request, @@ -328,9 +326,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); - client.innerApiCalls.updateBillingAccount = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.updateBillingAccount = + stubSimpleCall(expectedResponse); const [response] = await client.updateBillingAccount(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -361,9 +358,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); - client.innerApiCalls.updateBillingAccount = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateBillingAccount = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateBillingAccount( request, @@ -434,9 +430,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); - client.innerApiCalls.createBillingAccount = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.createBillingAccount = + stubSimpleCall(expectedResponse); const [response] = await client.createBillingAccount(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -459,9 +454,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); - client.innerApiCalls.createBillingAccount = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.createBillingAccount = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.createBillingAccount( request, @@ -532,9 +526,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() ); - client.innerApiCalls.getProjectBillingInfo = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.getProjectBillingInfo = + stubSimpleCall(expectedResponse); const [response] = await client.getProjectBillingInfo(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -565,9 +558,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() ); - client.innerApiCalls.getProjectBillingInfo = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getProjectBillingInfo = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getProjectBillingInfo( request, @@ -649,9 +641,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() ); - client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.updateProjectBillingInfo = + stubSimpleCall(expectedResponse); const [response] = await client.updateProjectBillingInfo(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -682,9 +673,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() ); - client.innerApiCalls.updateProjectBillingInfo = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.updateProjectBillingInfo = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.updateProjectBillingInfo( request, @@ -797,9 +787,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.getIamPolicy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.getIamPolicy( request, @@ -909,9 +898,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.setIamPolicy = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.setIamPolicy( request, @@ -990,9 +978,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsResponse() ); - client.innerApiCalls.testIamPermissions = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.testIamPermissions = + stubSimpleCall(expectedResponse); const [response] = await client.testIamPermissions(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1023,9 +1010,8 @@ describe('v1.CloudBillingClient', () => { const expectedResponse = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsResponse() ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.testIamPermissions = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.testIamPermissions( request, @@ -1104,9 +1090,8 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.BillingAccount() ), ]; - client.innerApiCalls.listBillingAccounts = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listBillingAccounts = + stubSimpleCall(expectedResponse); const [response] = await client.listBillingAccounts(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1137,9 +1122,8 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.BillingAccount() ), ]; - client.innerApiCalls.listBillingAccounts = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listBillingAccounts = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listBillingAccounts( request, @@ -1207,9 +1191,8 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.BillingAccount() ), ]; - client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listBillingAccounts.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listBillingAccountsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; @@ -1245,10 +1228,8 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListBillingAccountsRequest() ); const expectedError = new Error('expected'); - client.descriptors.page.listBillingAccounts.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listBillingAccounts.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listBillingAccountsStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.billing.v1.BillingAccount[] = []; @@ -1293,9 +1274,8 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.BillingAccount() ), ]; - client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listBillingAccounts.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; const iterable = client.listBillingAccountsAsync(request); for await (const resource of iterable) { @@ -1303,8 +1283,9 @@ describe('v1.CloudBillingClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listBillingAccounts - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listBillingAccounts.asyncIterate as SinonStub + ).getCall(0).args[1], request ); }); @@ -1319,10 +1300,8 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListBillingAccountsRequest() ); const expectedError = new Error('expected'); - client.descriptors.page.listBillingAccounts.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listBillingAccounts.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listBillingAccountsAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.billing.v1.IBillingAccount[] = []; @@ -1331,8 +1310,9 @@ describe('v1.CloudBillingClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listBillingAccounts - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listBillingAccounts.asyncIterate as SinonStub + ).getCall(0).args[1], request ); }); @@ -1368,9 +1348,8 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ProjectBillingInfo() ), ]; - client.innerApiCalls.listProjectBillingInfo = stubSimpleCall( - expectedResponse - ); + client.innerApiCalls.listProjectBillingInfo = + stubSimpleCall(expectedResponse); const [response] = await client.listProjectBillingInfo(request); assert.deepStrictEqual(response, expectedResponse); assert( @@ -1409,9 +1388,8 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ProjectBillingInfo() ), ]; - client.innerApiCalls.listProjectBillingInfo = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listProjectBillingInfo = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listProjectBillingInfo( request, @@ -1492,12 +1470,12 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ProjectBillingInfo() ), ]; - client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listProjectBillingInfo.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listProjectBillingInfoStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; + const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = + []; stream.on( 'data', (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { @@ -1514,16 +1492,18 @@ describe('v1.CloudBillingClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listProjectBillingInfo - .createStream as SinonStub) + ( + client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listProjectBillingInfo, request) ); assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1540,13 +1520,12 @@ describe('v1.CloudBillingClient', () => { request.name = ''; const expectedHeaderRequestParams = 'name='; const expectedError = new Error('expected'); - client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall( - undefined, - expectedError - ); + client.descriptors.page.listProjectBillingInfo.createStream = + stubPageStreamingCall(undefined, expectedError); const stream = client.listProjectBillingInfoStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = []; + const responses: protos.google.cloud.billing.v1.ProjectBillingInfo[] = + []; stream.on( 'data', (response: protos.google.cloud.billing.v1.ProjectBillingInfo) => { @@ -1562,16 +1541,18 @@ describe('v1.CloudBillingClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listProjectBillingInfo - .createStream as SinonStub) + ( + client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub + ) .getCall(0) .calledWith(client.innerApiCalls.listProjectBillingInfo, request) ); assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo - .createStream as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listProjectBillingInfo + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1598,25 +1579,27 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ProjectBillingInfo() ), ]; - client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); - const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; + client.descriptors.page.listProjectBillingInfo.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = + []; const iterable = client.listProjectBillingInfoAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listProjectBillingInfo - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1633,27 +1616,28 @@ describe('v1.CloudBillingClient', () => { request.name = ''; const expectedHeaderRequestParams = 'name='; const expectedError = new Error('expected'); - client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listProjectBillingInfo.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listProjectBillingInfoAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = []; + const responses: protos.google.cloud.billing.v1.IProjectBillingInfo[] = + []; for await (const resource of iterable) { responses.push(resource!); } }); assert.deepStrictEqual( - (client.descriptors.page.listProjectBillingInfo - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub + ).getCall(0).args[1], request ); assert.strictEqual( - (client.descriptors.page.listProjectBillingInfo - .asyncIterate as SinonStub).getCall(0).args[2].otherArgs.headers[ - 'x-goog-request-params' - ], + ( + client.descriptors.page.listProjectBillingInfo + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], expectedHeaderRequestParams ); }); @@ -1688,9 +1672,8 @@ describe('v1.CloudBillingClient', () => { }); it('matchBillingAccountFromBillingAccountName', () => { - const result = client.matchBillingAccountFromBillingAccountName( - fakePath - ); + const result = + client.matchBillingAccountFromBillingAccountName(fakePath); assert.strictEqual(result, 'billingAccountValue'); assert( (client.pathTemplates.billingAccountPathTemplate.match as SinonStub) diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index aca1aab9cba..064be8d0a73 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -28,10 +28,9 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message).toObject( - instance as protobuf.Message, - {defaults: true} - ); + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); return (instance.constructor as typeof protobuf.Message).fromObject( filledObject ) as T; @@ -235,9 +234,8 @@ describe('v1.CloudCatalogClient', () => { generateSampleMessage(new protos.google.cloud.billing.v1.Service()), generateSampleMessage(new protos.google.cloud.billing.v1.Service()), ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listServices = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listServices( request, @@ -299,9 +297,8 @@ describe('v1.CloudCatalogClient', () => { generateSampleMessage(new protos.google.cloud.billing.v1.Service()), generateSampleMessage(new protos.google.cloud.billing.v1.Service()), ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listServices.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listServicesStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.billing.v1.Service[] = []; @@ -379,9 +376,8 @@ describe('v1.CloudCatalogClient', () => { generateSampleMessage(new protos.google.cloud.billing.v1.Service()), generateSampleMessage(new protos.google.cloud.billing.v1.Service()), ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listServices.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.billing.v1.IService[] = []; const iterable = client.listServicesAsync(request); for await (const resource of iterable) { @@ -389,8 +385,9 @@ describe('v1.CloudCatalogClient', () => { } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( - (client.descriptors.page.listServices - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[1], request ); }); @@ -405,10 +402,8 @@ describe('v1.CloudCatalogClient', () => { new protos.google.cloud.billing.v1.ListServicesRequest() ); const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError - ); + client.descriptors.page.listServices.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); const iterable = client.listServicesAsync(request); await assert.rejects(async () => { const responses: protos.google.cloud.billing.v1.IService[] = []; @@ -417,8 +412,9 @@ describe('v1.CloudCatalogClient', () => { } }); assert.deepStrictEqual( - (client.descriptors.page.listServices - .asyncIterate as SinonStub).getCall(0).args[1], + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[1], request ); }); @@ -481,9 +477,8 @@ describe('v1.CloudCatalogClient', () => { generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), ]; - client.innerApiCalls.listSkus = stubSimpleCallWithCallback( - expectedResponse - ); + client.innerApiCalls.listSkus = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { client.listSkus( request, @@ -552,9 +547,8 @@ describe('v1.CloudCatalogClient', () => { generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), ]; - client.descriptors.page.listSkus.createStream = stubPageStreamingCall( - expectedResponse - ); + client.descriptors.page.listSkus.createStream = + stubPageStreamingCall(expectedResponse); const stream = client.listSkusStream(request); const promise = new Promise((resolve, reject) => { const responses: protos.google.cloud.billing.v1.Sku[] = []; @@ -640,9 +634,8 @@ describe('v1.CloudCatalogClient', () => { generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), ]; - client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall( - expectedResponse - ); + client.descriptors.page.listSkus.asyncIterate = + stubAsyncIterationCall(expectedResponse); const responses: protos.google.cloud.billing.v1.ISku[] = []; const iterable = client.listSkusAsync(request); for await (const resource of iterable) { From bfc8680bb3f2ec23a5015b7b113b4aec21afa6ad Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 21:56:34 +0000 Subject: [PATCH 103/169] fix: use require() to load JSON protos (#146) The library is regenerated with gapic-generator-typescript v1.3.1. Committer: @alexander-fenster PiperOrigin-RevId: 372468161 Source-Link: https://github.com/googleapis/googleapis/commit/75880c3e6a6aa2597400582848e81bbbfac51dea Source-Link: https://github.com/googleapis/googleapis-gen/commit/77b18044813d4c8c415ff9ea68e76e307eb8e904 --- .../src/v1/cloud_billing_client.ts | 18 ++---------------- .../src/v1/cloud_catalog_client.ts | 18 ++---------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 59e4b709a2a..ac9d190bb33 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -31,6 +31,7 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v1/cloud_billing_client_config.json`. @@ -145,22 +146,7 @@ export class CloudBillingClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index d8b62c532d7..478dae2efe9 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -31,6 +31,7 @@ import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); /** * Client JSON configuration object, loaded from * `src/v1/cloud_catalog_client_config.json`. @@ -147,22 +148,7 @@ export class CloudCatalogClient { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - this._protos = this._gaxGrpc.loadProto( - opts.fallback - ? // eslint-disable-next-line @typescript-eslint/no-var-requires - require('../../protos/protos.json') - : nodejsProtoPath - ); + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. From 5464ca4eb25cd0b9adcdd7b8d0ef999355b23690 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 23:12:33 +0000 Subject: [PATCH 104/169] chore: update gapic-generator-typescript to v1.3.2 (#147) Committer: @alexander-fenster PiperOrigin-RevId: 372656503 Source-Link: https://github.com/googleapis/googleapis/commit/6fa858c6489b1bbc505a7d7afe39f2dc45819c38 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d7c95df3ab1ea1b4c22a4542bad4924cc46d1388 --- packages/google-cloud-billing/src/v1/cloud_billing_client.ts | 1 - packages/google-cloud-billing/src/v1/cloud_catalog_client.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index ac9d190bb33..db94596491a 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -26,7 +26,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; -import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 478dae2efe9..60cea7bacf7 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -26,7 +26,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; -import * as path from 'path'; import {Transform} from 'stream'; import {RequestType} from 'google-gax/build/src/apitypes'; From 58d3d91c283a6ead11aec2182e2d47c35ea502bb Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 13 May 2021 10:33:58 -0700 Subject: [PATCH 105/169] chore: release 2.2.1 (#144) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 8 ++++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index f1cd31a183b..330e38acab1 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [2.2.1](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.0...v2.2.1) (2021-05-12) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#143](https://www.github.com/googleapis/nodejs-billing/issues/143)) ([3e56f40](https://www.github.com/googleapis/nodejs-billing/commit/3e56f40026b51001fbefa23a0544a19fdbba8c25)) +* use require() to load JSON protos ([#146](https://www.github.com/googleapis/nodejs-billing/issues/146)) ([c06c0d0](https://www.github.com/googleapis/nodejs-billing/commit/c06c0d09af9882b3f305fbaf25864f84d5aebfa6)) + ## [2.2.0](https://www.github.com/googleapis/nodejs-billing/compare/v2.1.3...v2.2.0) (2021-01-09) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 1092b94a877..480776f4ac2 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.2.0", + "version": "2.2.1", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index ac7a7dda295..1b0c461ce24 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.2.0" + "@google-cloud/billing": "^2.2.1" }, "devDependencies": { "c8": "^7.1.0", From bc377cc58fab4a17f88884894545a28278dc9871 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 21 May 2021 19:04:18 +0200 Subject: [PATCH 106/169] chore(deps): update dependency @types/node to v14 (#150) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^12.0.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/12.20.13/14.17.0) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/14.17.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/14.17.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/14.17.0/compatibility-slim/12.20.13)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/14.17.0/confidence-slim/12.20.13)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 480776f4ac2..459946f175b 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -33,7 +33,7 @@ }, "devDependencies": { "@types/mocha": "^8.0.0", - "@types/node": "^12.0.0", + "@types/node": "^14.0.0", "@types/sinon": "^10.0.0", "c8": "^7.0.0", "gts": "^2.0.0", From 0e8f908bdd288da527640c84515811ee3540d4a9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 25 May 2021 17:54:18 +0200 Subject: [PATCH 107/169] chore(deps): update dependency sinon to v11 (#151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^10.0.0` -> `^11.0.0`](https://renovatebot.com/diffs/npm/sinon/10.0.0/11.1.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/compatibility-slim/10.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/confidence-slim/10.0.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v11.1.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1110--2021-05-25) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v11.0.0...31be9a5d5a4762ef01cb195f29024616dfee9ce8) \================== - Add sinon.promise() implementation ([#​2369](https://togithub.com/sinonjs/sinon/issues/2369)) - Set wrappedMethod on getters/setters ([#​2378](https://togithub.com/sinonjs/sinon/issues/2378)) - \[Docs] Update fake-server usage & descriptions ([#​2365](https://togithub.com/sinonjs/sinon/issues/2365)) - Fake docs improvement ([#​2360](https://togithub.com/sinonjs/sinon/issues/2360)) - Update nise to 5.1.0 (fixed [#​2318](https://togithub.com/sinonjs/sinon/issues/2318)) ### [`v11.0.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1100--2021-05-24) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v10.0.1...v11.0.0) \================== - Explicitly use samsam 6.0.2 with fix for [#​2345](https://togithub.com/sinonjs/sinon/issues/2345) - Update most packages ([#​2371](https://togithub.com/sinonjs/sinon/issues/2371)) - Update compatibility docs ([#​2366](https://togithub.com/sinonjs/sinon/issues/2366)) - Update packages (includes breaking fake-timers change, see [#​2352](https://togithub.com/sinonjs/sinon/issues/2352)) - Warn of potential memory leaks ([#​2357](https://togithub.com/sinonjs/sinon/issues/2357)) - Fix clock test errors ### [`v10.0.1`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#​1001--2021-04-08) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v10.0.0...v10.0.1) \================== - Upgrade sinon components (bumps y18n to 4.0.1) - Bump y18n from 4.0.0 to 4.0.1
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 459946f175b..c3acc9192fb 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -44,7 +44,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^10.0.0", + "sinon": "^11.0.0", "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From 6d03341b7981f26954782c581962eab9054285e9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 May 2021 20:48:39 +0000 Subject: [PATCH 108/169] fix: GoogleAdsError missing using generator version after 1.3.0 (#152) [PR](https://github.com/googleapis/gapic-generator-typescript/pull/878) within updated gapic-generator-typescript version 1.4.0 Committer: @summer-ji-eng PiperOrigin-RevId: 375759421 Source-Link: https://github.com/googleapis/googleapis/commit/95fa72fdd0d69b02d72c33b37d1e4cc66d4b1446 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f40a34377ad488a7c2bc3992b3c8d5faf5a15c46 --- packages/google-cloud-billing/src/v1/cloud_billing_client.ts | 2 ++ packages/google-cloud-billing/src/v1/cloud_catalog_client.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index db94596491a..f9425123327 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -140,6 +140,8 @@ export class CloudBillingClient { } 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}`); diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 60cea7bacf7..f4ecafdebc3 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -142,6 +142,8 @@ export class CloudCatalogClient { } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); From af044e75ec27a405bda7dccc2f58892e13bf1138 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 25 May 2021 18:38:47 -0400 Subject: [PATCH 109/169] chore: release 2.2.2 (#153) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 330e38acab1..0f5f714be8e 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.2](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.1...v2.2.2) (2021-05-25) + + +### Bug Fixes + +* GoogleAdsError missing using generator version after 1.3.0 ([#152](https://www.github.com/googleapis/nodejs-billing/issues/152)) ([139287c](https://www.github.com/googleapis/nodejs-billing/commit/139287cfb544d8fe84cc0fc2abd2d4f4755e563b)) + ### [2.2.1](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.0...v2.2.1) (2021-05-12) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index c3acc9192fb..b64babb11e1 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.2.1", + "version": "2.2.2", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 1b0c461ce24..0f9d709ccf3 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.2.1" + "@google-cloud/billing": "^2.2.2" }, "devDependencies": { "c8": "^7.1.0", From b290d6b669f9694699a57a2a1512d9d64fcd5ea4 Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Thu, 10 Jun 2021 23:00:44 +0200 Subject: [PATCH 110/169] chore(nodejs): remove api-extractor dependencies (#158) --- packages/google-cloud-billing/package.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index b64babb11e1..3fdcd291888 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -24,9 +24,7 @@ "system-test": "c8 mocha build/system-test", "test": "c8 mocha build/test", "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "precompile": "gts clean", - "api-extractor": "api-extractor run --local", - "api-documenter": "api-documenter yaml --input-folder=temp" + "precompile": "gts clean" }, "dependencies": { "google-gax": "^2.12.0" @@ -48,9 +46,7 @@ "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", - "webpack-cli": "^4.0.0", - "@microsoft/api-documenter": "^7.8.10", - "@microsoft/api-extractor": "^7.8.10" + "webpack-cli": "^4.0.0" }, "engines": { "node": ">=10" From 96fbc665d67419ab407a3ba36e9af2ac6b240798 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:20:29 +0000 Subject: [PATCH 111/169] fix: make request optional in all cases (#160) ... chore: update gapic-generator-ruby to the latest commit chore: release gapic-generator-typescript 1.5.0 Committer: @miraleung PiperOrigin-RevId: 380641501 Source-Link: https://github.com/googleapis/googleapis/commit/076f7e9f0b258bdb54338895d7251b202e8f0de3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/27e4c88b4048e5f56508d4e1aa417d60a3380892 --- .../src/v1/cloud_billing_client.ts | 40 +++++++++---------- .../src/v1/cloud_catalog_client.ts | 8 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index f9425123327..e7b7a71dc3e 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -319,7 +319,7 @@ export class CloudBillingClient { // -- Service calls -- // ------------------- getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + request?: protos.google.cloud.billing.v1.IGetBillingAccountRequest, options?: CallOptions ): Promise< [ @@ -370,7 +370,7 @@ export class CloudBillingClient { * const [response] = await client.getBillingAccount(request); */ getBillingAccount( - request: protos.google.cloud.billing.v1.IGetBillingAccountRequest, + request?: protos.google.cloud.billing.v1.IGetBillingAccountRequest, optionsOrCallback?: | CallOptions | Callback< @@ -413,7 +413,7 @@ export class CloudBillingClient { return this.innerApiCalls.getBillingAccount(request, options, callback); } updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + request?: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, options?: CallOptions ): Promise< [ @@ -471,7 +471,7 @@ export class CloudBillingClient { * const [response] = await client.updateBillingAccount(request); */ updateBillingAccount( - request: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, + request?: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, optionsOrCallback?: | CallOptions | Callback< @@ -514,7 +514,7 @@ export class CloudBillingClient { return this.innerApiCalls.updateBillingAccount(request, options, callback); } createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + request?: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, options?: CallOptions ): Promise< [ @@ -574,7 +574,7 @@ export class CloudBillingClient { * const [response] = await client.createBillingAccount(request); */ createBillingAccount( - request: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, + request?: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, optionsOrCallback?: | CallOptions | Callback< @@ -611,7 +611,7 @@ export class CloudBillingClient { return this.innerApiCalls.createBillingAccount(request, options, callback); } getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + request?: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, options?: CallOptions ): Promise< [ @@ -663,7 +663,7 @@ export class CloudBillingClient { * const [response] = await client.getProjectBillingInfo(request); */ getProjectBillingInfo( - request: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, + request?: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, optionsOrCallback?: | CallOptions | Callback< @@ -706,7 +706,7 @@ export class CloudBillingClient { return this.innerApiCalls.getProjectBillingInfo(request, options, callback); } updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + request?: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, options?: CallOptions ): Promise< [ @@ -791,7 +791,7 @@ export class CloudBillingClient { * const [response] = await client.updateProjectBillingInfo(request); */ updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + request?: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, optionsOrCallback?: | CallOptions | Callback< @@ -841,7 +841,7 @@ export class CloudBillingClient { ); } getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, + request?: protos.google.iam.v1.IGetIamPolicyRequest, options?: CallOptions ): Promise< [ @@ -892,7 +892,7 @@ export class CloudBillingClient { * const [response] = await client.getIamPolicy(request); */ getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, + request?: protos.google.iam.v1.IGetIamPolicyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -931,7 +931,7 @@ export class CloudBillingClient { return this.innerApiCalls.getIamPolicy(request, options, callback); } setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, + request?: protos.google.iam.v1.ISetIamPolicyRequest, options?: CallOptions ): Promise< [ @@ -985,7 +985,7 @@ export class CloudBillingClient { * const [response] = await client.setIamPolicy(request); */ setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, + request?: protos.google.iam.v1.ISetIamPolicyRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1024,7 +1024,7 @@ export class CloudBillingClient { return this.innerApiCalls.setIamPolicy(request, options, callback); } testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, + request?: protos.google.iam.v1.ITestIamPermissionsRequest, options?: CallOptions ): Promise< [ @@ -1076,7 +1076,7 @@ export class CloudBillingClient { * const [response] = await client.testIamPermissions(request); */ testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, + request?: protos.google.iam.v1.ITestIamPermissionsRequest, optionsOrCallback?: | CallOptions | Callback< @@ -1116,7 +1116,7 @@ export class CloudBillingClient { } listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, options?: CallOptions ): Promise< [ @@ -1181,7 +1181,7 @@ export class CloudBillingClient { * for more details and examples. */ listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, optionsOrCallback?: | CallOptions | PaginationCallback< @@ -1315,7 +1315,7 @@ export class CloudBillingClient { ) as AsyncIterable; } listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, options?: CallOptions ): Promise< [ @@ -1377,7 +1377,7 @@ export class CloudBillingClient { * for more details and examples. */ listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, optionsOrCallback?: | CallOptions | PaginationCallback< diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index f4ecafdebc3..1ff8ada156b 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -308,7 +308,7 @@ export class CloudCatalogClient { // ------------------- listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, + request?: protos.google.cloud.billing.v1.IListServicesRequest, options?: CallOptions ): Promise< [ @@ -359,7 +359,7 @@ export class CloudCatalogClient { * for more details and examples. */ listServices( - request: protos.google.cloud.billing.v1.IListServicesRequest, + request?: protos.google.cloud.billing.v1.IListServicesRequest, optionsOrCallback?: | CallOptions | PaginationCallback< @@ -475,7 +475,7 @@ export class CloudCatalogClient { ) as AsyncIterable; } listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, + request?: protos.google.cloud.billing.v1.IListSkusRequest, options?: CallOptions ): Promise< [ @@ -547,7 +547,7 @@ export class CloudCatalogClient { * for more details and examples. */ listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, + request?: protos.google.cloud.billing.v1.IListSkusRequest, optionsOrCallback?: | CallOptions | PaginationCallback< From 1cab03521fb1909533b1b0c4ab7052284845210b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 25 Jun 2021 09:56:07 -0700 Subject: [PATCH 112/169] chore: release 2.2.3 (#161) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 0f5f714be8e..f0a607332a5 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.3](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.2...v2.2.3) (2021-06-24) + + +### Bug Fixes + +* make request optional in all cases ([#160](https://www.github.com/googleapis/nodejs-billing/issues/160)) ([b3859bd](https://www.github.com/googleapis/nodejs-billing/commit/b3859bd8e4aca9df94c4b8dea62b1709c80bd86d)) + ### [2.2.2](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.1...v2.2.2) (2021-05-25) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 3fdcd291888..5eda56f4c1c 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.2.2", + "version": "2.2.3", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 0f9d709ccf3..b528b005721 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.2.2" + "@google-cloud/billing": "^2.2.3" }, "devDependencies": { "c8": "^7.1.0", From cbcc3e19bb4f77aa724144b1180961ed144da1ec Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 29 Jun 2021 11:28:22 -0400 Subject: [PATCH 113/169] fix(deps): google-gax v2.17.0 with mTLS (#164) --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 5eda56f4c1c..66d1a6e5b24 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^2.12.0" + "google-gax": "^2.17.0" }, "devDependencies": { "@types/mocha": "^8.0.0", From 1133aad8b35447154f0ce540235fefe958cb8553 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 29 Jun 2021 15:54:35 +0000 Subject: [PATCH 114/169] chore: release 2.2.4 (#165) :robot: I have created a release \*beep\* \*boop\* --- ### [2.2.4](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.3...v2.2.4) (2021-06-29) ### Bug Fixes * **deps:** google-gax v2.17.0 with mTLS ([#164](https://www.github.com/googleapis/nodejs-billing/issues/164)) ([f07c6b0](https://www.github.com/googleapis/nodejs-billing/commit/f07c6b0128e7d4962d98f2ae8f0c2f60d91c289f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index f0a607332a5..f87e471cfe7 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.4](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.3...v2.2.4) (2021-06-29) + + +### Bug Fixes + +* **deps:** google-gax v2.17.0 with mTLS ([#164](https://www.github.com/googleapis/nodejs-billing/issues/164)) ([f07c6b0](https://www.github.com/googleapis/nodejs-billing/commit/f07c6b0128e7d4962d98f2ae8f0c2f60d91c289f)) + ### [2.2.3](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.2...v2.2.3) (2021-06-24) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 66d1a6e5b24..3f1f7508f24 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.2.3", + "version": "2.2.4", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index b528b005721..788a4dea3fa 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.2.3" + "@google-cloud/billing": "^2.2.4" }, "devDependencies": { "c8": "^7.1.0", From a45c117cde7781a2a42cf2ce4497aa491c268555 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 12 Jul 2021 17:46:18 -0400 Subject: [PATCH 115/169] fix(deps): google-gax v2.17.1 (#167) --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 3f1f7508f24..91812e56f62 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^2.17.0" + "google-gax": "^2.17.1" }, "devDependencies": { "@types/mocha": "^8.0.0", From 6a3aeadc15df5e5face4a56c517bf616bc57050c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 13 Jul 2021 13:17:47 -0700 Subject: [PATCH 116/169] chore: release 2.2.5 (#168) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index f87e471cfe7..e9f5081be02 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.5](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.4...v2.2.5) (2021-07-12) + + +### Bug Fixes + +* **deps:** google-gax v2.17.1 ([#167](https://www.github.com/googleapis/nodejs-billing/issues/167)) ([a3cc52e](https://www.github.com/googleapis/nodejs-billing/commit/a3cc52ec1b8a73a7c439f1756e37e14b521e0598)) + ### [2.2.4](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.3...v2.2.4) (2021-06-29) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 91812e56f62..252bb7949dc 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.2.4", + "version": "2.2.5", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 788a4dea3fa..145dc919199 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.2.4" + "@google-cloud/billing": "^2.2.5" }, "devDependencies": { "c8": "^7.1.0", From 6705d98acb58a721590464707e5cca626a2b3c54 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 19:08:46 +0000 Subject: [PATCH 117/169] fix: Updating WORKSPACE files to use the newest version of the Typescript generator. (#169) Also removing the explicit generator tag for the IAMPolicy mixin for the kms and pubsub APIS as the generator will now read it from the .yaml file. PiperOrigin-RevId: 385101839 Source-Link: https://github.com/googleapis/googleapis/commit/80f404215a9346259db760d80d0671f28c433453 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d3509d2520fb8db862129633f1cf8406d17454e1 --- .../src/v1/cloud_billing_client.ts | 11 ++++++++++- .../src/v1/cloud_catalog_client.ts | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index e7b7a71dc3e..3a94ca252dc 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -48,6 +48,7 @@ const version = require('../../../package.json').version; export class CloudBillingClient { 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: {}; @@ -59,6 +60,7 @@ export class CloudBillingClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; cloudBillingStub?: Promise<{[name: string]: Function}>; @@ -102,6 +104,9 @@ export class CloudBillingClient { const staticMembers = this.constructor as typeof CloudBillingClient; 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 = @@ -192,6 +197,9 @@ export class CloudBillingClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -220,7 +228,8 @@ export class CloudBillingClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.billing.v1.CloudBilling, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 1ff8ada156b..1cdcdcb44b6 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -50,6 +50,7 @@ const version = require('../../../package.json').version; export class CloudCatalogClient { 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: {}; @@ -61,6 +62,7 @@ export class CloudCatalogClient { longrunning: {}, batching: {}, }; + warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; pathTemplates: {[name: string]: gax.PathTemplate}; cloudCatalogStub?: Promise<{[name: string]: Function}>; @@ -104,6 +106,9 @@ export class CloudCatalogClient { const staticMembers = this.constructor as typeof CloudCatalogClient; 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 = @@ -191,6 +196,9 @@ export class CloudCatalogClient { // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; } /** @@ -219,7 +227,8 @@ export class CloudCatalogClient { ) : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.billing.v1.CloudCatalog, - this._opts + this._opts, + this._providedCustomServicePath ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides From e5c02423c88ac3f0e2b57edd97c07a20c4904bf7 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 12:53:28 -0700 Subject: [PATCH 118/169] chore: release 2.2.6 (#170) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index e9f5081be02..0e3ecdb4b84 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.6](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.5...v2.2.6) (2021-07-16) + + +### Bug Fixes + +* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#169](https://www.github.com/googleapis/nodejs-billing/issues/169)) ([012b494](https://www.github.com/googleapis/nodejs-billing/commit/012b4942d77e8f59c7a434f8e8c34622d6991553)) + ### [2.2.5](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.4...v2.2.5) (2021-07-12) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 252bb7949dc..8aca4f04a99 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.2.5", + "version": "2.2.6", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 145dc919199..ed7a0c9472a 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.2.5" + "@google-cloud/billing": "^2.2.6" }, "devDependencies": { "c8": "^7.1.0", From 184eb6c74255619ade53ee246e3aa53d364913ab Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Wed, 4 Aug 2021 16:00:45 -0400 Subject: [PATCH 119/169] chore(nodejs): update client ref docs link in metadata (#175) --- packages/google-cloud-billing/.repo-metadata.json | 2 +- packages/google-cloud-billing/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/.repo-metadata.json b/packages/google-cloud-billing/.repo-metadata.json index f884b66bd5e..1dbcc83b182 100644 --- a/packages/google-cloud-billing/.repo-metadata.json +++ b/packages/google-cloud-billing/.repo-metadata.json @@ -8,7 +8,7 @@ "release_level": "ga", "distribution_name": "@google-cloud/billing", "name": "billing", - "client_documentation": "https://googleapis.dev/nodejs/billing/latest/index.html", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/billing/latest", "api_id": "cloudbilling.googleapis.com", "issue_tracker": "https://issuetracker.google.com/savedsearches/559770" } diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 06f084f2123..830eaf917c5 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -152,7 +152,7 @@ Apache Version 2.0 See [LICENSE](https://github.com/googleapis/nodejs-billing/blob/master/LICENSE) -[client-docs]: https://googleapis.dev/nodejs/billing/latest/index.html +[client-docs]: https://cloud.google.com/nodejs/docs/reference/billing/latest [product-docs]: https://cloud.google.com/billing/docs [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project From bf30b08da945e0bfbd8d5c3aafd85fc1f24568fd Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 16 Aug 2021 22:42:32 -0400 Subject: [PATCH 120/169] fix(deps): google-gax v2.24.1 (#177) --- packages/google-cloud-billing/README.md | 10 +++++----- packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/README.md | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 830eaf917c5..8bc5e09149d 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -15,7 +15,7 @@ Billing client for Node.js A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/nodejs-billing/blob/master/CHANGELOG.md). +[the CHANGELOG](https://github.com/googleapis/nodejs-billing/blob/main/CHANGELOG.md). * [Cloud Billing Node.js Client API Reference][client-docs] * [Cloud Billing Documentation][product-docs] @@ -85,11 +85,11 @@ listBillingAccounts(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-billing/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample. +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-billing/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-billing/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-billing&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/nodejs-billing/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-billing&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | @@ -138,7 +138,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-billing/blob/master/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-billing/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`) @@ -150,7 +150,7 @@ to its template in this Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/nodejs-billing/blob/master/LICENSE) +See [LICENSE](https://github.com/googleapis/nodejs-billing/blob/main/LICENSE) [client-docs]: https://cloud.google.com/nodejs/docs/reference/billing/latest [product-docs]: https://cloud.google.com/billing/docs diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 8aca4f04a99..ed7eeafa7c0 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^2.17.1" + "google-gax": "^2.24.1" }, "devDependencies": { "@types/mocha": "^8.0.0", diff --git a/packages/google-cloud-billing/samples/README.md b/packages/google-cloud-billing/samples/README.md index f98b84e6e2b..d294718856f 100644 --- a/packages/google-cloud-billing/samples/README.md +++ b/packages/google-cloud-billing/samples/README.md @@ -31,7 +31,7 @@ Before running the samples, make sure you've followed the steps outlined in ### Quickstart -View the [source code](https://github.com/googleapis/nodejs-billing/blob/master/samples/quickstart.js). +View the [source code](https://github.com/googleapis/nodejs-billing/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-billing&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) From 98d38a92cc7e5d27234fbaceed4666b51fe5b122 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 03:06:37 +0000 Subject: [PATCH 121/169] chore: release 2.2.7 (#178) :robot: I have created a release \*beep\* \*boop\* --- ### [2.2.7](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.6...v2.2.7) (2021-08-17) ### Bug Fixes * **deps:** google-gax v2.24.1 ([#177](https://www.github.com/googleapis/nodejs-billing/issues/177)) ([ffad245](https://www.github.com/googleapis/nodejs-billing/commit/ffad2459f25bc1e05a8f022fe754fb28896a021c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 0e3ecdb4b84..5306fe2d468 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [2.2.7](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.6...v2.2.7) (2021-08-17) + + +### Bug Fixes + +* **deps:** google-gax v2.24.1 ([#177](https://www.github.com/googleapis/nodejs-billing/issues/177)) ([ffad245](https://www.github.com/googleapis/nodejs-billing/commit/ffad2459f25bc1e05a8f022fe754fb28896a021c)) + ### [2.2.6](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.5...v2.2.6) (2021-07-16) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index ed7eeafa7c0..ce683455426 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.2.6", + "version": "2.2.7", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index ed7a0c9472a..0b672492bfc 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.2.6" + "@google-cloud/billing": "^2.2.7" }, "devDependencies": { "c8": "^7.1.0", From 3389312011f7f735827a6f04d527f1ecd2def43e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 18:30:23 +0000 Subject: [PATCH 122/169] feat: turns on self-signed JWT feature flag (#179) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 392067151 Source-Link: https://github.com/googleapis/googleapis/commit/06345f7b95c4b4a3ffe4303f1f2984ccc304b2e0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/95882b37970e41e4cd51b22fa507cfd46dc7c4b6 --- .../google-cloud-billing/src/v1/cloud_billing_client.ts | 6 ++++++ .../google-cloud-billing/src/v1/cloud_catalog_client.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 3a94ca252dc..fbc0c19fc52 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -131,6 +131,12 @@ export class CloudBillingClient { // 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; diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 1cdcdcb44b6..50e03be9cc5 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -133,6 +133,12 @@ export class CloudCatalogClient { // 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; From c36aa8b2c5073758e9631778c1b17e5195075fac Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 08:35:00 -0700 Subject: [PATCH 123/169] chore: release 2.3.0 (#180) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 5306fe2d468..a6eb3fdef87 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.3.0](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.7...v2.3.0) (2021-08-23) + + +### Features + +* turns on self-signed JWT feature flag ([#179](https://www.github.com/googleapis/nodejs-billing/issues/179)) ([9ef0c0d](https://www.github.com/googleapis/nodejs-billing/commit/9ef0c0dfb125a57073fb16ff0ea6bf7c7109816d)) + ### [2.2.7](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.6...v2.2.7) (2021-08-17) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index ce683455426..57fd2635f05 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.2.7", + "version": "2.3.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 0b672492bfc..6edd9611dd8 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.2.7" + "@google-cloud/billing": "^2.3.0" }, "devDependencies": { "c8": "^7.1.0", From 9e32d4823aa95edaf55082cd7baa1176bbd65c58 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 23:34:45 +0000 Subject: [PATCH 124/169] chore: disable renovate dependency dashboard (#1194) (#182) --- packages/google-cloud-billing/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 8bc5e09149d..c8599916909 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -6,7 +6,7 @@ [![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/billing.svg)](https://www.npmjs.org/package/@google-cloud/billing) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-billing/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-billing) +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-billing/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-billing) @@ -143,8 +143,8 @@ Contributions welcome! See the [Contributing Guide](https://github.com/googleapi Please note that this `README.md`, the `samples/README.md`, and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) are generated from a central template. To edit one of these files, make an edit -to its template in this -[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library). +to its templates in +[directory](https://github.com/googleapis/synthtool). ## License From ecc2aad964c91e82868b03beefb61c4314a3261e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 23:38:33 +0000 Subject: [PATCH 125/169] docs(samples): add auto-generated samples for Node with api short name in region tag (#187) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 399287285 Source-Link: https://github.com/googleapis/googleapis/commit/15759865d1c54e3d46429010f7e472fe6c3d3715 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b27fff623a5d8d586b703b5e4919856abe7c2eb3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9 --- .../cloud_billing.create_billing_account.js | 55 ++++++++++++ .../v1/cloud_billing.get_billing_account.js | 53 +++++++++++ .../v1/cloud_billing.get_iam_policy.js | 58 ++++++++++++ .../cloud_billing.get_project_billing_info.js | 53 +++++++++++ .../v1/cloud_billing.list_billing_accounts.js | 68 ++++++++++++++ ...cloud_billing.list_project_billing_info.js | 66 ++++++++++++++ .../v1/cloud_billing.set_iam_policy.js | 61 +++++++++++++ .../v1/cloud_billing.test_iam_permissions.js | 61 +++++++++++++ .../cloud_billing.update_billing_account.js | 62 +++++++++++++ ...oud_billing.update_project_billing_info.js | 58 ++++++++++++ .../v1/cloud_catalog.list_services.js | 58 ++++++++++++ .../generated/v1/cloud_catalog.list_skus.js | 89 +++++++++++++++++++ .../google-cloud-billing/samples/package.json | 2 +- .../src/v1/cloud_billing_client.ts | 12 ++- .../src/v1/cloud_catalog_client.ts | 12 ++- 15 files changed, 759 insertions(+), 9 deletions(-) create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js create mode 100644 packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js new file mode 100644 index 00000000000..b239a65c6b5 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(billingAccount) { + // [START cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The billing account resource to create. + * Currently CreateBillingAccount only supports subaccount creation, so + * any created billing accounts must be under a provided master billing + * account. + */ + // const billingAccount = '' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function createBillingAccount() { + // Construct request + const request = { + billingAccount, + }; + + // Run request + const response = await billingClient.createBillingAccount(request); + console.log(response); + } + + createBillingAccount(); + // [END cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js new file mode 100644 index 00000000000..5abf1f74c21 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the billing account to retrieve. For example, + * `billingAccounts/012345-567890-ABCDEF`. + */ + // const name = 'abc123' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function getBillingAccount() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await billingClient.getBillingAccount(request); + console.log(response); + } + + getBillingAccount(); + // [END cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js new file mode 100644 index 00000000000..f8225ab891e --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(resource) { + // [START cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + */ + // const options = '' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function getIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await billingClient.getIamPolicy(request); + console.log(response); + } + + getIamPolicy(); + // [END cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js new file mode 100644 index 00000000000..75c6416f360 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START cloudbilling_v1_generated_CloudBilling_GetProjectBillingInfo_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the project for which billing information is + * retrieved. For example, `projects/tokyo-rain-123`. + */ + // const name = 'abc123' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function getProjectBillingInfo() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await billingClient.getProjectBillingInfo(request); + console.log(response); + } + + getProjectBillingInfo(); + // [END cloudbilling_v1_generated_CloudBilling_GetProjectBillingInfo_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js new file mode 100644 index 00000000000..5b3dcf4f821 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START cloudbilling_v1_generated_CloudBilling_ListBillingAccounts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Requested page size. The maximum page size is 100; this is also the + * default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListBillingAccounts` + * call. If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * Options for how to filter the returned billing accounts. + * Currently this only supports filtering for + * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * single provided reseller billing account. + * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + * Boolean algebra and other fields are not currently supported. + */ + // const filter = 'abc123' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function listBillingAccounts() { + // Construct request + const request = {}; + + // Run request + const iterable = await billingClient.listBillingAccountsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listBillingAccounts(); + // [END cloudbilling_v1_generated_CloudBilling_ListBillingAccounts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js new file mode 100644 index 00000000000..b3f6df2d2ee --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START cloudbilling_v1_generated_CloudBilling_ListProjectBillingInfo_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the billing account associated with the projects that + * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + */ + // const name = 'abc123' + /** + * Requested page size. The maximum page size is 100; this is also the + * default. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous `ListProjectBillingInfo` + * call. If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function listProjectBillingInfo() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await billingClient.listProjectBillingInfoAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listProjectBillingInfo(); + // [END cloudbilling_v1_generated_CloudBilling_ListProjectBillingInfo_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js new file mode 100644 index 00000000000..31bb92be858 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(resource, policy) { + // [START cloudbilling_v1_generated_CloudBilling_SetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = '' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function setIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await billingClient.setIamPolicy(request); + console.log(response); + } + + setIamPolicy(); + // [END cloudbilling_v1_generated_CloudBilling_SetIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js new file mode 100644 index 00000000000..bc35cbca3ab --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(resource, permissions) { + // [START cloudbilling_v1_generated_CloudBilling_TestIamPermissions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function testIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await billingClient.testIamPermissions(request); + console.log(response); + } + + testIamPermissions(); + // [END cloudbilling_v1_generated_CloudBilling_TestIamPermissions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js new file mode 100644 index 00000000000..84db4e4dcd3 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name, account) { + // [START cloudbilling_v1_generated_CloudBilling_UpdateBillingAccount_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the billing account resource to be updated. + */ + // const name = 'abc123' + /** + * Required. The billing account resource to replace the resource on the server. + */ + // const account = '' + /** + * The update mask applied to the resource. + * Only "display_name" is currently supported. + */ + // const updateMask = '' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function updateBillingAccount() { + // Construct request + const request = { + name, + account, + }; + + // Run request + const response = await billingClient.updateBillingAccount(request); + console.log(response); + } + + updateBillingAccount(); + // [END cloudbilling_v1_generated_CloudBilling_UpdateBillingAccount_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js new file mode 100644 index 00000000000..d7c55bf7157 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(name) { + // [START cloudbilling_v1_generated_CloudBilling_UpdateProjectBillingInfo_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the project associated with the billing information + * that you want to update. For example, `projects/tokyo-rain-123`. + */ + // const name = 'abc123' + /** + * The new billing information for the project. Read-only fields are ignored; + * thus, you can leave empty all fields except `billing_account_name`. + */ + // const projectBillingInfo = '' + + // Imports the Billing library + const {CloudBillingClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudBillingClient(); + + async function updateProjectBillingInfo() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await billingClient.updateProjectBillingInfo(request); + console.log(response); + } + + updateProjectBillingInfo(); + // [END cloudbilling_v1_generated_CloudBilling_UpdateProjectBillingInfo_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js new file mode 100644 index 00000000000..50ffada39f9 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main() { + // [START cloudbilling_v1_generated_CloudCatalog_ListServices_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Requested page size. Defaults to 5000. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + + // Imports the Billing library + const {CloudCatalogClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudCatalogClient(); + + async function listServices() { + // Construct request + const request = {}; + + // Run request + const iterable = await billingClient.listServicesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listServices(); + // [END cloudbilling_v1_generated_CloudCatalog_ListServices_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js new file mode 100644 index 00000000000..cc69bde8bf2 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js @@ -0,0 +1,89 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +function main(parent) { + // [START cloudbilling_v1_generated_CloudCatalog_ListSkus_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the service. + * Example: "services/DA34-426B-A397" + */ + // const parent = 'abc123' + /** + * Optional inclusive start time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + */ + // const startTime = '' + /** + * Optional exclusive end time of the time range for which the pricing + * versions will be returned. Timestamps in the future are not allowed. + * The time range has to be within a single calendar month in + * America/Los_Angeles timezone. Time range as a whole is optional. If not + * specified, the latest pricing will be returned (up to 12 hours old at + * most). + */ + // const endTime = '' + /** + * The ISO 4217 currency code for the pricing info in the response proto. + * Will use the conversion rate as of start_time. + * Optional. If not specified USD will be used. + */ + // const currencyCode = 'abc123' + /** + * Requested page size. Defaults to 5000. + */ + // const pageSize = 1234 + /** + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListSkus` + * call. If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + + // Imports the Billing library + const {CloudCatalogClient} = require('@google-cloud/billing').v1; + + // Instantiates a client + const billingClient = new CloudCatalogClient(); + + async function listSkus() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await billingClient.listSkusAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listSkus(); + // [END cloudbilling_v1_generated_CloudCatalog_ListSkus_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 6edd9611dd8..6cc6d8ca3a7 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=8" + "node": ">=10" }, "files": [ "*.js" diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index fbc0c19fc52..1a7449f56c0 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -1269,7 +1269,8 @@ export class CloudBillingClient { ): Transform { request = request || {}; options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listBillingAccounts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listBillingAccounts.createStream( this.innerApiCalls.listBillingAccounts as gax.GaxCall, @@ -1321,7 +1322,8 @@ export class CloudBillingClient { request = request || {}; options = options || {}; options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listBillingAccounts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listBillingAccounts.asyncIterate( this.innerApiCalls['listBillingAccounts'] as GaxCall, @@ -1477,7 +1479,8 @@ export class CloudBillingClient { gax.routingHeader.fromParams({ name: request.name || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProjectBillingInfo']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProjectBillingInfo.createStream( this.innerApiCalls.listProjectBillingInfo as gax.GaxCall, @@ -1531,7 +1534,8 @@ export class CloudBillingClient { name: request.name || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listProjectBillingInfo']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProjectBillingInfo.asyncIterate( this.innerApiCalls['listProjectBillingInfo'] as GaxCall, diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 50e03be9cc5..3ceb23c8b74 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -437,7 +437,8 @@ export class CloudCatalogClient { ): Transform { request = request || {}; options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServices.createStream( this.innerApiCalls.listServices as gax.GaxCall, @@ -481,7 +482,8 @@ export class CloudCatalogClient { request = request || {}; options = options || {}; options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listServices']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServices.asyncIterate( this.innerApiCalls['listServices'] as GaxCall, @@ -656,7 +658,8 @@ export class CloudCatalogClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listSkus']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listSkus.createStream( this.innerApiCalls.listSkus as gax.GaxCall, @@ -727,7 +730,8 @@ export class CloudCatalogClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listSkus']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listSkus.asyncIterate( this.innerApiCalls['listSkus'] as GaxCall, From 1464fb6e50d68cc1dbb7200207ab208cbc8fc88b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 00:50:18 +0000 Subject: [PATCH 126/169] build(node): update deps used during postprocessing (#1243) (#190) --- packages/google-cloud-billing/protos/protos.d.ts | 3 ++- packages/google-cloud-billing/protos/protos.js | 7 +++++++ packages/google-cloud-billing/protos/protos.json | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index 357aa03c493..d87753ee3fc 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -2967,7 +2967,8 @@ export namespace google { OUTPUT_ONLY = 3, INPUT_ONLY = 4, IMMUTABLE = 5, - UNORDERED_LIST = 6 + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 } /** Properties of a ResourceDescriptor. */ diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index 3056801cf81..f0aafc07ba0 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -6922,6 +6922,7 @@ * @property {number} INPUT_ONLY=4 INPUT_ONLY value * @property {number} IMMUTABLE=5 IMMUTABLE value * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value */ api.FieldBehavior = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -6932,6 +6933,7 @@ values[valuesById[4] = "INPUT_ONLY"] = 4; values[valuesById[5] = "IMMUTABLE"] = 5; values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; return values; })(); @@ -13100,6 +13102,7 @@ case 4: case 5: case 6: + case 7: break; } } @@ -13204,6 +13207,10 @@ case 6: message[".google.api.fieldBehavior"][i] = 6; break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; } } if (object[".google.api.resourceReference"] != null) { diff --git a/packages/google-cloud-billing/protos/protos.json b/packages/google-cloud-billing/protos/protos.json index c67b6ee9b02..03d4d38df43 100644 --- a/packages/google-cloud-billing/protos/protos.json +++ b/packages/google-cloud-billing/protos/protos.json @@ -826,7 +826,8 @@ "OUTPUT_ONLY": 3, "INPUT_ONLY": 4, "IMMUTABLE": 5, - "UNORDERED_LIST": 6 + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 } }, "resourceReference": { @@ -1469,6 +1470,18 @@ ] ], "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], [ 8, 8 From 26bc781e4386819dc38534862ef901e5e2c3271e Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Thu, 21 Oct 2021 11:30:31 -0400 Subject: [PATCH 127/169] chore(cloud-rad): delete api-extractor config (#191) --- .../google-cloud-billing/api-extractor.json | 369 ------------------ 1 file changed, 369 deletions(-) delete mode 100644 packages/google-cloud-billing/api-extractor.json diff --git a/packages/google-cloud-billing/api-extractor.json b/packages/google-cloud-billing/api-extractor.json deleted file mode 100644 index de228294b23..00000000000 --- a/packages/google-cloud-billing/api-extractor.json +++ /dev/null @@ -1,369 +0,0 @@ -/** - * Config file for API Extractor. For more info, please visit: https://api-extractor.com - */ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - - /** - * Optionally specifies another JSON config file that this file extends from. This provides a way for - * standard settings to be shared across multiple projects. - * - * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains - * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be - * resolved using NodeJS require(). - * - * SUPPORTED TOKENS: none - * DEFAULT VALUE: "" - */ - // "extends": "./shared/api-extractor-base.json" - // "extends": "my-package/include/api-extractor-base.json" - - /** - * Determines the "" token that can be used with other config file settings. The project folder - * typically contains the tsconfig.json and package.json config files, but the path is user-defined. - * - * The path is resolved relative to the folder of the config file that contains the setting. - * - * The default value for "projectFolder" is the token "", which means the folder is determined by traversing - * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder - * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error - * will be reported. - * - * SUPPORTED TOKENS: - * DEFAULT VALUE: "" - */ - // "projectFolder": "..", - - /** - * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor - * analyzes the symbols exported by this module. - * - * The file extension must be ".d.ts" and not ".ts". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - */ - "mainEntryPointFilePath": "/protos/protos.d.ts", - - /** - * A list of NPM package names whose exports should be treated as part of this package. - * - * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", - * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part - * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly - * imports library2. To avoid this, we can specify: - * - * "bundledPackages": [ "library2" ], - * - * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been - * local files for library1. - */ - "bundledPackages": [ ], - - /** - * Determines how the TypeScript compiler engine will be invoked by API Extractor. - */ - "compiler": { - /** - * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * Note: This setting will be ignored if "overrideTsconfig" is used. - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/tsconfig.json" - */ - // "tsconfigFilePath": "/tsconfig.json", - - /** - * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. - * The object must conform to the TypeScript tsconfig schema: - * - * http://json.schemastore.org/tsconfig - * - * If omitted, then the tsconfig.json file will be read from the "projectFolder". - * - * DEFAULT VALUE: no overrideTsconfig section - */ - // "overrideTsconfig": { - // . . . - // } - - /** - * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended - * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when - * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses - * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. - * - * DEFAULT VALUE: false - */ - // "skipLibCheck": true, - }, - - /** - * Configures how the API report file (*.api.md) will be generated. - */ - "apiReport": { - /** - * (REQUIRED) Whether to generate an API report. - */ - "enabled": true, - - /** - * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce - * a full file path. - * - * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". - * - * SUPPORTED TOKENS: , - * DEFAULT VALUE: ".api.md" - */ - // "reportFileName": ".api.md", - - /** - * Specifies the folder where the API report file is written. The file name portion is determined by - * the "reportFileName" setting. - * - * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, - * e.g. for an API review. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/etc/" - */ - // "reportFolder": "/etc/", - - /** - * Specifies the folder where the temporary report file is written. The file name portion is determined by - * the "reportFileName" setting. - * - * After the temporary file is written to disk, it is compared with the file in the "reportFolder". - * If they are different, a production build will fail. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/temp/" - */ - // "reportTempFolder": "/temp/" - }, - - /** - * Configures how the doc model file (*.api.json) will be generated. - */ - "docModel": { - /** - * (REQUIRED) Whether to generate a doc model file. - */ - "enabled": true, - - /** - * The output path for the doc model file. The file extension should be ".api.json". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/temp/.api.json" - */ - // "apiJsonFilePath": "/temp/.api.json" - }, - - /** - * Configures how the .d.ts rollup file will be generated. - */ - "dtsRollup": { - /** - * (REQUIRED) Whether to generate the .d.ts rollup file. - */ - "enabled": true, - - /** - * Specifies the output path for a .d.ts rollup file to be generated without any trimming. - * This file will include all declarations that are exported by the main entry point. - * - * If the path is an empty string, then this file will not be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "/dist/.d.ts" - */ - // "untrimmedFilePath": "/dist/.d.ts", - - /** - * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. - * This file will include only declarations that are marked as "@public" or "@beta". - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "betaTrimmedFilePath": "/dist/-beta.d.ts", - - - /** - * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. - * This file will include only declarations that are marked as "@public". - * - * If the path is an empty string, then this file will not be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "publicTrimmedFilePath": "/dist/-public.d.ts", - - /** - * When a declaration is trimmed, by default it will be replaced by a code comment such as - * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the - * declaration completely. - * - * DEFAULT VALUE: false - */ - // "omitTrimmingComments": true - }, - - /** - * Configures how the tsdoc-metadata.json file will be generated. - */ - "tsdocMetadata": { - /** - * Whether to generate the tsdoc-metadata.json file. - * - * DEFAULT VALUE: true - */ - // "enabled": true, - - /** - * Specifies where the TSDoc metadata file should be written. - * - * The path is resolved relative to the folder of the config file that contains the setting; to change this, - * prepend a folder token such as "". - * - * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", - * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup - * falls back to "tsdoc-metadata.json" in the package folder. - * - * SUPPORTED TOKENS: , , - * DEFAULT VALUE: "" - */ - // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" - }, - - /** - * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files - * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. - * To use the OS's default newline kind, specify "os". - * - * DEFAULT VALUE: "crlf" - */ - // "newlineKind": "crlf", - - /** - * Configures how API Extractor reports error and warning messages produced during analysis. - * - * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. - */ - "messages": { - /** - * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing - * the input .d.ts files. - * - * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" - * - * DEFAULT VALUE: A single "default" entry with logLevel=warning. - */ - "compilerMessageReporting": { - /** - * Configures the default routing for messages that don't match an explicit rule in this table. - */ - "default": { - /** - * Specifies whether the message should be written to the the tool's output log. Note that - * the "addToApiReportFile" property may supersede this option. - * - * Possible values: "error", "warning", "none" - * - * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail - * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes - * the "--local" option), the warning is displayed but the build will not fail. - * - * DEFAULT VALUE: "warning" - */ - "logLevel": "warning", - - /** - * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), - * then the message will be written inside that file; otherwise, the message is instead logged according to - * the "logLevel" option. - * - * DEFAULT VALUE: false - */ - // "addToApiReportFile": false - }, - - // "TS2551": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - }, - - /** - * Configures handling of messages reported by API Extractor during its analysis. - * - * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" - * - * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings - */ - "extractorMessageReporting": { - "default": { - "logLevel": "warning", - // "addToApiReportFile": false - }, - - // "ae-extra-release-tag": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - }, - - /** - * Configures handling of messages reported by the TSDoc parser when analyzing code comments. - * - * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" - * - * DEFAULT VALUE: A single "default" entry with logLevel=warning. - */ - "tsdocMessageReporting": { - "default": { - "logLevel": "warning", - // "addToApiReportFile": false - } - - // "tsdoc-link-tag-unescaped-text": { - // "logLevel": "warning", - // "addToApiReportFile": true - // }, - // - // . . . - } - } - -} From 0842a28a1302e2f5eb24e043bbd7de3a1e2f7a1f Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Wed, 27 Oct 2021 06:32:14 -0700 Subject: [PATCH 128/169] chore: fix the wrong post processor image (#193) --- packages/google-cloud-billing/.github/.OwlBot.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/.github/.OwlBot.yaml b/packages/google-cloud-billing/.github/.OwlBot.yaml index 7f86dd9be40..56fc8dbf595 100644 --- a/packages/google-cloud-billing/.github/.OwlBot.yaml +++ b/packages/google-cloud-billing/.github/.OwlBot.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. docker: - image: gcr.io/repo-automation-bots/owlbot-nodejs:latest + image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest deep-remove-regex: - /owl-bot-staging From 4a83a786200175a07119f6cecb9886680246a205 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 27 Oct 2021 17:32:35 +0200 Subject: [PATCH 129/169] chore(deps): update dependency @types/node to v16 (#192) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^14.0.0` -> `^16.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/14.17.32/16.11.6) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/compatibility-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/confidence-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 57fd2635f05..5e2daaf6fad 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "@types/mocha": "^8.0.0", - "@types/node": "^14.0.0", + "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.0.0", "gts": "^2.0.0", From 1eca5971c563e96d1f9ee9cc6f2163b3dee63466 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 4 Nov 2021 20:40:15 +0100 Subject: [PATCH 130/169] chore(deps): update dependency sinon to v12 (#194) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^11.0.0` -> `^12.0.0`](https://renovatebot.com/diffs/npm/sinon/11.1.2/12.0.1) | [![age](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/compatibility-slim/11.1.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/12.0.1/confidence-slim/11.1.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v12.0.1`](https://togithub.com/sinonjs/sinon/blob/master/CHANGES.md#​1201) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v12.0.0...v12.0.1) - [`3f598221`](https://togithub.com/sinonjs/sinon/commit/3f598221045904681f2b3b3ba1df617ed5e230e3) Fix issue with npm unlink for npm version > 6 (Carl-Erik Kopseng) > 'npm unlink' would implicitly unlink the current dir > until version 7, which requires an argument - [`51417a38`](https://togithub.com/sinonjs/sinon/commit/51417a38111eeeb7cd14338bfb762cc2df487e1b) Fix bundling of cjs module ([#​2412](https://togithub.com/sinonjs/sinon/issues/2412)) (Julian Grinblat) > - Fix bundling of cjs module > > - Run prettier *Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2021-11-04.* #### 12.0.0 ### [`v12.0.0`](https://togithub.com/sinonjs/sinon/compare/v11.1.2...v12.0.0) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v11.1.2...v12.0.0)
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 5e2daaf6fad..c6b7e946391 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -42,7 +42,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^11.0.0", + "sinon": "^12.0.0", "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From acda165b0d206f276b911f744291c4f1bcf117d3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:14:36 -0800 Subject: [PATCH 131/169] docs(samples): add example tags to generated samples (#195) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(samples): add example tags to generated samples PiperOrigin-RevId: 408439482 Source-Link: https://github.com/googleapis/googleapis/commit/b9f61843dc80c7c285fc34fd3a40aae55082c2b9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/eb888bc214efc7bf43bf4634b470254565a659a5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../linkinator.config.json | 2 +- .../cloud_billing.create_billing_account.js | 6 +- .../v1/cloud_billing.get_billing_account.js | 4 +- .../v1/cloud_billing.get_iam_policy.js | 6 +- .../cloud_billing.get_project_billing_info.js | 4 +- .../v1/cloud_billing.list_billing_accounts.js | 6 +- ...cloud_billing.list_project_billing_info.js | 4 +- .../v1/cloud_billing.set_iam_policy.js | 6 +- .../v1/cloud_billing.test_iam_permissions.js | 6 +- .../cloud_billing.update_billing_account.js | 8 +- ...oud_billing.update_project_billing_info.js | 6 +- .../v1/cloud_catalog.list_services.js | 4 +- .../generated/v1/cloud_catalog.list_skus.js | 8 +- .../src/v1/cloud_billing_client.ts | 566 +++++++++--------- .../src/v1/cloud_catalog_client.ts | 124 ++-- .../test/gapic_cloud_billing_v1.ts | 12 +- .../test/gapic_cloud_catalog_v1.ts | 6 +- 17 files changed, 388 insertions(+), 390 deletions(-) diff --git a/packages/google-cloud-billing/linkinator.config.json b/packages/google-cloud-billing/linkinator.config.json index 29a223b6db6..0121dfa684f 100644 --- a/packages/google-cloud-billing/linkinator.config.json +++ b/packages/google-cloud-billing/linkinator.config.json @@ -6,5 +6,5 @@ "img.shields.io" ], "silent": true, - "concurrency": 10 + "concurrency": 5 } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js index b239a65c6b5..3d7407c7f99 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js @@ -25,7 +25,7 @@ function main(billingAccount) { * any created billing accounts must be under a provided master billing * account. */ - // const billingAccount = '' + // const billingAccount = {} // Imports the Billing library const {CloudBillingClient} = require('@google-cloud/billing').v1; @@ -33,7 +33,7 @@ function main(billingAccount) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function createBillingAccount() { + async function callCreateBillingAccount() { // Construct request const request = { billingAccount, @@ -44,7 +44,7 @@ function main(billingAccount) { console.log(response); } - createBillingAccount(); + callCreateBillingAccount(); // [END cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js index 5abf1f74c21..7330019b05a 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js @@ -31,7 +31,7 @@ function main(name) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function getBillingAccount() { + async function callGetBillingAccount() { // Construct request const request = { name, @@ -42,7 +42,7 @@ function main(name) { console.log(response); } - getBillingAccount(); + callGetBillingAccount(); // [END cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js index f8225ab891e..06917f909a1 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js @@ -28,7 +28,7 @@ function main(resource) { * OPTIONAL: A `GetPolicyOptions` object for specifying options to * `GetIamPolicy`. This field is only used by Cloud IAM. */ - // const options = '' + // const options = {} // Imports the Billing library const {CloudBillingClient} = require('@google-cloud/billing').v1; @@ -36,7 +36,7 @@ function main(resource) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function getIamPolicy() { + async function callGetIamPolicy() { // Construct request const request = { resource, @@ -47,7 +47,7 @@ function main(resource) { console.log(response); } - getIamPolicy(); + callGetIamPolicy(); // [END cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js index 75c6416f360..c083d69296e 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js @@ -31,7 +31,7 @@ function main(name) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function getProjectBillingInfo() { + async function callGetProjectBillingInfo() { // Construct request const request = { name, @@ -42,7 +42,7 @@ function main(name) { console.log(response); } - getProjectBillingInfo(); + callGetProjectBillingInfo(); // [END cloudbilling_v1_generated_CloudBilling_GetProjectBillingInfo_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js index 5b3dcf4f821..4e688c90f86 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js @@ -33,7 +33,7 @@ function main() { /** * Options for how to filter the returned billing accounts. * Currently this only supports filtering for - * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + * subaccounts (https://cloud.google.com/billing/docs/concepts) under a * single provided reseller billing account. * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). * Boolean algebra and other fields are not currently supported. @@ -46,7 +46,7 @@ function main() { // Instantiates a client const billingClient = new CloudBillingClient(); - async function listBillingAccounts() { + async function callListBillingAccounts() { // Construct request const request = {}; @@ -57,7 +57,7 @@ function main() { } } - listBillingAccounts(); + callListBillingAccounts(); // [END cloudbilling_v1_generated_CloudBilling_ListBillingAccounts_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js index b3f6df2d2ee..e815441b64d 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js @@ -42,7 +42,7 @@ function main(name) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function listProjectBillingInfo() { + async function callListProjectBillingInfo() { // Construct request const request = { name, @@ -55,7 +55,7 @@ function main(name) { } } - listProjectBillingInfo(); + callListProjectBillingInfo(); // [END cloudbilling_v1_generated_CloudBilling_ListProjectBillingInfo_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js index 31bb92be858..b39e886ac8e 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js @@ -30,7 +30,7 @@ function main(resource, policy) { * valid policy but certain Cloud Platform services (such as Projects) * might reject them. */ - // const policy = '' + // const policy = {} // Imports the Billing library const {CloudBillingClient} = require('@google-cloud/billing').v1; @@ -38,7 +38,7 @@ function main(resource, policy) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function setIamPolicy() { + async function callSetIamPolicy() { // Construct request const request = { resource, @@ -50,7 +50,7 @@ function main(resource, policy) { console.log(response); } - setIamPolicy(); + callSetIamPolicy(); // [END cloudbilling_v1_generated_CloudBilling_SetIamPolicy_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js index bc35cbca3ab..687cf31efe7 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js @@ -28,7 +28,7 @@ function main(resource, 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). + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). */ // const permissions = 'abc123' @@ -38,7 +38,7 @@ function main(resource, permissions) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function testIamPermissions() { + async function callTestIamPermissions() { // Construct request const request = { resource, @@ -50,7 +50,7 @@ function main(resource, permissions) { console.log(response); } - testIamPermissions(); + callTestIamPermissions(); // [END cloudbilling_v1_generated_CloudBilling_TestIamPermissions_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js index 84db4e4dcd3..1634285bbde 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js @@ -26,12 +26,12 @@ function main(name, account) { /** * Required. The billing account resource to replace the resource on the server. */ - // const account = '' + // const account = {} /** * The update mask applied to the resource. * Only "display_name" is currently supported. */ - // const updateMask = '' + // const updateMask = {} // Imports the Billing library const {CloudBillingClient} = require('@google-cloud/billing').v1; @@ -39,7 +39,7 @@ function main(name, account) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function updateBillingAccount() { + async function callUpdateBillingAccount() { // Construct request const request = { name, @@ -51,7 +51,7 @@ function main(name, account) { console.log(response); } - updateBillingAccount(); + callUpdateBillingAccount(); // [END cloudbilling_v1_generated_CloudBilling_UpdateBillingAccount_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js index d7c55bf7157..7ba1106757a 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js @@ -28,7 +28,7 @@ function main(name) { * The new billing information for the project. Read-only fields are ignored; * thus, you can leave empty all fields except `billing_account_name`. */ - // const projectBillingInfo = '' + // const projectBillingInfo = {} // Imports the Billing library const {CloudBillingClient} = require('@google-cloud/billing').v1; @@ -36,7 +36,7 @@ function main(name) { // Instantiates a client const billingClient = new CloudBillingClient(); - async function updateProjectBillingInfo() { + async function callUpdateProjectBillingInfo() { // Construct request const request = { name, @@ -47,7 +47,7 @@ function main(name) { console.log(response); } - updateProjectBillingInfo(); + callUpdateProjectBillingInfo(); // [END cloudbilling_v1_generated_CloudBilling_UpdateProjectBillingInfo_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js index 50ffada39f9..962af3b8ab1 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js @@ -36,7 +36,7 @@ function main() { // Instantiates a client const billingClient = new CloudCatalogClient(); - async function listServices() { + async function callListServices() { // Construct request const request = {}; @@ -47,7 +47,7 @@ function main() { } } - listServices(); + callListServices(); // [END cloudbilling_v1_generated_CloudCatalog_ListServices_async] } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js index cc69bde8bf2..28278602f43 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js @@ -32,7 +32,7 @@ function main(parent) { * specified, the latest pricing will be returned (up to 12 hours old at * most). */ - // const startTime = '' + // const startTime = {} /** * Optional exclusive end time of the time range for which the pricing * versions will be returned. Timestamps in the future are not allowed. @@ -41,7 +41,7 @@ function main(parent) { * specified, the latest pricing will be returned (up to 12 hours old at * most). */ - // const endTime = '' + // const endTime = {} /** * The ISO 4217 currency code for the pricing info in the response proto. * Will use the conversion rate as of start_time. @@ -65,7 +65,7 @@ function main(parent) { // Instantiates a client const billingClient = new CloudCatalogClient(); - async function listSkus() { + async function callListSkus() { // Construct request const request = { parent, @@ -78,7 +78,7 @@ function main(parent) { } } - listSkus(); + callListSkus(); // [END cloudbilling_v1_generated_CloudCatalog_ListSkus_async] } diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 1a7449f56c0..5a3c98f7f03 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -333,6 +333,26 @@ export class CloudBillingClient { // ------------------- // -- Service calls -- // ------------------- + /** + * Gets information about a billing account. The current authenticated user + * must be a [viewer of the billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the billing account to retrieve. For example, + * `billingAccounts/012345-567890-ABCDEF`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * 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_billing.get_billing_account.js + * region_tag:cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async + */ getBillingAccount( request?: protos.google.cloud.billing.v1.IGetBillingAccountRequest, options?: CallOptions @@ -364,26 +384,6 @@ export class CloudBillingClient { {} | null | undefined > ): void; - /** - * Gets information about a billing account. The current authenticated user - * must be a [viewer of the billing - * account](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the billing account to retrieve. For example, - * `billingAccounts/012345-567890-ABCDEF`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * 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.getBillingAccount(request); - */ getBillingAccount( request?: protos.google.cloud.billing.v1.IGetBillingAccountRequest, optionsOrCallback?: @@ -427,6 +427,33 @@ export class CloudBillingClient { this.initialize(); return this.innerApiCalls.getBillingAccount(request, options, callback); } + /** + * Updates a billing account's fields. + * Currently the only field that can be edited is `display_name`. + * The current authenticated user must have the `billing.accounts.update` + * IAM permission, which is typically given to the + * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) + * of the billing account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the billing account resource to be updated. + * @param {google.cloud.billing.v1.BillingAccount} request.account + * Required. The billing account resource to replace the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The update mask applied to the resource. + * Only "display_name" is currently supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * 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_billing.update_billing_account.js + * region_tag:cloudbilling_v1_generated_CloudBilling_UpdateBillingAccount_async + */ updateBillingAccount( request?: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, options?: CallOptions @@ -458,33 +485,6 @@ export class CloudBillingClient { {} | null | undefined > ): void; - /** - * Updates a billing account's fields. - * Currently the only field that can be edited is `display_name`. - * The current authenticated user must have the `billing.accounts.update` - * IAM permission, which is typically given to the - * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) - * of the billing account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the billing account resource to be updated. - * @param {google.cloud.billing.v1.BillingAccount} request.account - * Required. The billing account resource to replace the resource on the server. - * @param {google.protobuf.FieldMask} request.updateMask - * The update mask applied to the resource. - * Only "display_name" is currently supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * 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.updateBillingAccount(request); - */ updateBillingAccount( request?: protos.google.cloud.billing.v1.IUpdateBillingAccountRequest, optionsOrCallback?: @@ -528,6 +528,35 @@ export class CloudBillingClient { this.initialize(); return this.innerApiCalls.updateBillingAccount(request, options, callback); } + /** + * Creates a billing account. + * This method can only be used to create + * [billing subaccounts](https://cloud.google.com/billing/docs/concepts) + * by GCP resellers. + * When creating a subaccount, the current authenticated user must have the + * `billing.accounts.update` IAM permission on the master account, which is + * typically given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * This method will return an error if the master account has not been + * provisioned as a reseller account. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.billing.v1.BillingAccount} request.billingAccount + * Required. The billing account resource to create. + * Currently CreateBillingAccount only supports subaccount creation, so + * any created billing accounts must be under a provided master billing + * account. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. + * 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_billing.create_billing_account.js + * region_tag:cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async + */ createBillingAccount( request?: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, options?: CallOptions @@ -559,35 +588,6 @@ export class CloudBillingClient { {} | null | undefined > ): void; - /** - * Creates a billing account. - * This method can only be used to create - * [billing subaccounts](https://cloud.google.com/billing/docs/concepts) - * by GCP resellers. - * When creating a subaccount, the current authenticated user must have the - * `billing.accounts.update` IAM permission on the master account, which is - * typically given to billing account - * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). - * This method will return an error if the master account has not been - * provisioned as a reseller account. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.billing.v1.BillingAccount} request.billingAccount - * Required. The billing account resource to create. - * Currently CreateBillingAccount only supports subaccount creation, so - * any created billing accounts must be under a provided master billing - * account. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BillingAccount]{@link google.cloud.billing.v1.BillingAccount}. - * 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.createBillingAccount(request); - */ createBillingAccount( request?: protos.google.cloud.billing.v1.ICreateBillingAccountRequest, optionsOrCallback?: @@ -622,9 +622,32 @@ export class CloudBillingClient { options = optionsOrCallback as CallOptions; } options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); return this.innerApiCalls.createBillingAccount(request, options, callback); } + /** + * Gets the billing information for a project. The current authenticated user + * must have [permission to view the + * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + * ). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the project for which billing information is + * retrieved. For example, `projects/tokyo-rain-123`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. + * 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_billing.get_project_billing_info.js + * region_tag:cloudbilling_v1_generated_CloudBilling_GetProjectBillingInfo_async + */ getProjectBillingInfo( request?: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, options?: CallOptions @@ -656,27 +679,6 @@ export class CloudBillingClient { {} | null | undefined > ): void; - /** - * Gets the billing information for a project. The current authenticated user - * must have [permission to view the - * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo - * ). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the project for which billing information is - * retrieved. For example, `projects/tokyo-rain-123`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProjectBillingInfo]{@link google.cloud.billing.v1.ProjectBillingInfo}. - * 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.getProjectBillingInfo(request); - */ getProjectBillingInfo( request?: protos.google.cloud.billing.v1.IGetProjectBillingInfoRequest, optionsOrCallback?: @@ -720,40 +722,6 @@ export class CloudBillingClient { this.initialize(); return this.innerApiCalls.getProjectBillingInfo(request, options, callback); } - updateProjectBillingInfo( - request?: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IProjectBillingInfo, - ( - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | undefined - ), - {} | undefined - ] - >; - updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - > - ): void; - updateProjectBillingInfo( - request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, - callback: Callback< - protos.google.cloud.billing.v1.IProjectBillingInfo, - | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest - | null - | undefined, - {} | null | undefined - > - ): void; /** * Sets or updates the billing account associated with a project. You specify * the new billing account by setting the `billing_account_name` in the @@ -802,9 +770,43 @@ export class CloudBillingClient { * 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.updateProjectBillingInfo(request); + * @example include:samples/generated/v1/cloud_billing.update_project_billing_info.js + * region_tag:cloudbilling_v1_generated_CloudBilling_UpdateProjectBillingInfo_async */ + updateProjectBillingInfo( + request?: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IProjectBillingInfo, + ( + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | undefined + ), + {} | undefined + ] + >; + updateProjectBillingInfo( + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateProjectBillingInfo( + request: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, + callback: Callback< + protos.google.cloud.billing.v1.IProjectBillingInfo, + | protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest + | null + | undefined, + {} | null | undefined + > + ): void; updateProjectBillingInfo( request?: protos.google.cloud.billing.v1.IUpdateProjectBillingInfoRequest, optionsOrCallback?: @@ -855,6 +857,30 @@ export class CloudBillingClient { callback ); } + /** + * Gets the access control policy for a billing account. + * The caller must have the `billing.accounts.getIamPolicy` permission on the + * account, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_billing.get_iam_policy.js + * region_tag:cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async + */ getIamPolicy( request?: protos.google.iam.v1.IGetIamPolicyRequest, options?: CallOptions @@ -882,30 +908,6 @@ export class CloudBillingClient { {} | null | undefined > ): void; - /** - * Gets the access control policy for a billing account. - * The caller must have the `billing.accounts.getIamPolicy` permission on the - * account, which is often given to billing account - * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.getIamPolicy(request); - */ getIamPolicy( request?: protos.google.iam.v1.IGetIamPolicyRequest, optionsOrCallback?: @@ -945,6 +947,33 @@ export class CloudBillingClient { this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); } + /** + * Sets the access control policy for a billing account. Replaces any existing + * policy. + * The caller must have the `billing.accounts.setIamPolicy` permission on the + * account, which is often given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/cloud_billing.set_iam_policy.js + * region_tag:cloudbilling_v1_generated_CloudBilling_SetIamPolicy_async + */ setIamPolicy( request?: protos.google.iam.v1.ISetIamPolicyRequest, options?: CallOptions @@ -972,33 +1001,6 @@ export class CloudBillingClient { {} | null | undefined > ): void; - /** - * Sets the access control policy for a billing account. Replaces any existing - * policy. - * The caller must have the `billing.accounts.setIamPolicy` permission on the - * account, which is often given to billing account - * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * const [response] = await client.setIamPolicy(request); - */ setIamPolicy( request?: protos.google.iam.v1.ISetIamPolicyRequest, optionsOrCallback?: @@ -1038,6 +1040,31 @@ export class CloudBillingClient { this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); } + /** + * Tests the access control policy for a billing account. This method takes + * the resource and a set of permissions as input and returns the subset of + * the input permissions that the caller is allowed for that resource. + * + * @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_billing.test_iam_permissions.js + * region_tag:cloudbilling_v1_generated_CloudBilling_TestIamPermissions_async + */ testIamPermissions( request?: protos.google.iam.v1.ITestIamPermissionsRequest, options?: CallOptions @@ -1065,31 +1092,6 @@ export class CloudBillingClient { {} | null | undefined > ): void; - /** - * Tests the access control policy for a billing account. This method takes - * the resource and a set of permissions as input and returns the subset of - * the input permissions that the caller is allowed for that resource. - * - * @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 - * const [response] = await client.testIamPermissions(request); - */ testIamPermissions( request?: protos.google.iam.v1.ITestIamPermissionsRequest, optionsOrCallback?: @@ -1130,37 +1132,6 @@ export class CloudBillingClient { return this.innerApiCalls.testIamPermissions(request, options, callback); } - listBillingAccounts( - request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IBillingAccount[], - protos.google.cloud.billing.v1.IListBillingAccountsRequest | null, - protos.google.cloud.billing.v1.IListBillingAccountsResponse - ] - >; - listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListBillingAccountsRequest, - | protos.google.cloud.billing.v1.IListBillingAccountsResponse - | null - | undefined, - protos.google.cloud.billing.v1.IBillingAccount - > - ): void; - listBillingAccounts( - request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListBillingAccountsRequest, - | protos.google.cloud.billing.v1.IListBillingAccountsResponse - | null - | undefined, - protos.google.cloud.billing.v1.IBillingAccount - > - ): void; /** * Lists the billing accounts that the current authenticated user has * permission to @@ -1195,6 +1166,37 @@ export class CloudBillingClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listBillingAccounts( + request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IBillingAccount[], + protos.google.cloud.billing.v1.IListBillingAccountsRequest | null, + protos.google.cloud.billing.v1.IListBillingAccountsResponse + ] + >; + listBillingAccounts( + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount + > + ): void; + listBillingAccounts( + request: protos.google.cloud.billing.v1.IListBillingAccountsRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListBillingAccountsRequest, + | protos.google.cloud.billing.v1.IListBillingAccountsResponse + | null + | undefined, + protos.google.cloud.billing.v1.IBillingAccount + > + ): void; listBillingAccounts( request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, optionsOrCallback?: @@ -1229,6 +1231,8 @@ export class CloudBillingClient { options = optionsOrCallback as CallOptions; } options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); return this.innerApiCalls.listBillingAccounts(request, options, callback); } @@ -1269,6 +1273,8 @@ export class CloudBillingClient { ): Transform { request = request || {}; options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; const defaultCallSettings = this._defaults['listBillingAccounts']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -1309,11 +1315,8 @@ export class CloudBillingClient { * 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.listBillingAccountsAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1/cloud_billing.list_billing_accounts.js + * region_tag:cloudbilling_v1_generated_CloudBilling_ListBillingAccounts_async */ listBillingAccountsAsync( request?: protos.google.cloud.billing.v1.IListBillingAccountsRequest, @@ -1321,7 +1324,8 @@ export class CloudBillingClient { ): AsyncIterable { request = request || {}; options = options || {}; - options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; const defaultCallSettings = this._defaults['listBillingAccounts']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -1331,37 +1335,6 @@ export class CloudBillingClient { callSettings ) as AsyncIterable; } - listProjectBillingInfo( - request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.IProjectBillingInfo[], - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, - protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - ] - >; - listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - | null - | undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo - > - ): void; - listProjectBillingInfo( - request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, - | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse - | null - | undefined, - protos.google.cloud.billing.v1.IProjectBillingInfo - > - ): void; /** * Lists the projects associated with a billing account. The current * authenticated user must have the `billing.resourceAssociations.list` IAM @@ -1393,6 +1366,37 @@ export class CloudBillingClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listProjectBillingInfo( + request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.IProjectBillingInfo[], + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest | null, + protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + ] + >; + listProjectBillingInfo( + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo + > + ): void; + listProjectBillingInfo( + request: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, + | protos.google.cloud.billing.v1.IListProjectBillingInfoResponse + | null + | undefined, + protos.google.cloud.billing.v1.IProjectBillingInfo + > + ): void; listProjectBillingInfo( request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, optionsOrCallback?: @@ -1515,11 +1519,8 @@ export class CloudBillingClient { * 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.listProjectBillingInfoAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1/cloud_billing.list_project_billing_info.js + * region_tag:cloudbilling_v1_generated_CloudBilling_ListProjectBillingInfo_async */ listProjectBillingInfoAsync( request?: protos.google.cloud.billing.v1.IListProjectBillingInfoRequest, @@ -1533,7 +1534,6 @@ export class CloudBillingClient { gax.routingHeader.fromParams({ name: request.name || '', }); - options = options || {}; const defaultCallSettings = this._defaults['listProjectBillingInfo']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 3ceb23c8b74..3a442f7b2d8 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -322,6 +322,30 @@ export class CloudCatalogClient { // -- Service calls -- // ------------------- + /** + * Lists all public cloud services. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * Requested page size. Defaults to 5000. + * @param {string} request.pageToken + * A token identifying a page of results to return. This should be a + * `next_page_token` value returned from a previous `ListServices` + * call. If unspecified, the first page of results is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Service]{@link google.cloud.billing.v1.Service}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServicesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ listServices( request?: protos.google.cloud.billing.v1.IListServicesRequest, options?: CallOptions @@ -349,30 +373,6 @@ export class CloudCatalogClient { protos.google.cloud.billing.v1.IService > ): void; - /** - * Lists all public cloud services. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * Requested page size. Defaults to 5000. - * @param {string} request.pageToken - * A token identifying a page of results to return. This should be a - * `next_page_token` value returned from a previous `ListServices` - * call. If unspecified, the first page of results is returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Service]{@link google.cloud.billing.v1.Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ listServices( request?: protos.google.cloud.billing.v1.IListServicesRequest, optionsOrCallback?: @@ -405,6 +405,8 @@ export class CloudCatalogClient { options = optionsOrCallback as CallOptions; } options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; this.initialize(); return this.innerApiCalls.listServices(request, options, callback); } @@ -437,6 +439,8 @@ export class CloudCatalogClient { ): Transform { request = request || {}; options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; const defaultCallSettings = this._defaults['listServices']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -469,11 +473,8 @@ export class CloudCatalogClient { * 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.listServicesAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1/cloud_catalog.list_services.js + * region_tag:cloudbilling_v1_generated_CloudCatalog_ListServices_async */ listServicesAsync( request?: protos.google.cloud.billing.v1.IListServicesRequest, @@ -481,7 +482,8 @@ export class CloudCatalogClient { ): AsyncIterable { request = request || {}; options = options || {}; - options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; const defaultCallSettings = this._defaults['listServices']; const callSettings = defaultCallSettings.merge(options); this.initialize(); @@ -491,33 +493,6 @@ export class CloudCatalogClient { callSettings ) as AsyncIterable; } - listSkus( - request?: protos.google.cloud.billing.v1.IListSkusRequest, - options?: CallOptions - ): Promise< - [ - protos.google.cloud.billing.v1.ISku[], - protos.google.cloud.billing.v1.IListSkusRequest | null, - protos.google.cloud.billing.v1.IListSkusResponse - ] - >; - listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, - protos.google.cloud.billing.v1.ISku - > - ): void; - listSkus( - request: protos.google.cloud.billing.v1.IListSkusRequest, - callback: PaginationCallback< - protos.google.cloud.billing.v1.IListSkusRequest, - protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, - protos.google.cloud.billing.v1.ISku - > - ): void; /** * Lists all publicly available SKUs for a given cloud service. * @@ -563,6 +538,33 @@ export class CloudCatalogClient { * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) * for more details and examples. */ + listSkus( + request?: protos.google.cloud.billing.v1.IListSkusRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.billing.v1.ISku[], + protos.google.cloud.billing.v1.IListSkusRequest | null, + protos.google.cloud.billing.v1.IListSkusResponse + ] + >; + listSkus( + request: protos.google.cloud.billing.v1.IListSkusRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku + > + ): void; + listSkus( + request: protos.google.cloud.billing.v1.IListSkusRequest, + callback: PaginationCallback< + protos.google.cloud.billing.v1.IListSkusRequest, + protos.google.cloud.billing.v1.IListSkusResponse | null | undefined, + protos.google.cloud.billing.v1.ISku + > + ): void; listSkus( request?: protos.google.cloud.billing.v1.IListSkusRequest, optionsOrCallback?: @@ -711,11 +713,8 @@ export class CloudCatalogClient { * 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.listSkusAsync(request); - * for await (const response of iterable) { - * // process response - * } + * @example include:samples/generated/v1/cloud_catalog.list_skus.js + * region_tag:cloudbilling_v1_generated_CloudCatalog_ListSkus_async */ listSkusAsync( request?: protos.google.cloud.billing.v1.IListSkusRequest, @@ -729,7 +728,6 @@ export class CloudCatalogClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - options = options || {}; const defaultCallSettings = this._defaults['listSkus']; const callSettings = defaultCallSettings.merge(options); this.initialize(); diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 8f9b042f1cd..16834f80986 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -426,7 +426,7 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.CreateBillingAccountRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); @@ -450,7 +450,7 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.CreateBillingAccountRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); @@ -489,7 +489,7 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.CreateBillingAccountRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.createBillingAccount = stubSimpleCall( undefined, @@ -1078,7 +1078,7 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListBillingAccountsRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() @@ -1110,7 +1110,7 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListBillingAccountsRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() @@ -1157,7 +1157,7 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListBillingAccountsRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.listBillingAccounts = stubSimpleCall( undefined, diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index 064be8d0a73..0719ac3131a 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -203,7 +203,7 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListServicesRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.billing.v1.Service()), generateSampleMessage(new protos.google.cloud.billing.v1.Service()), @@ -228,7 +228,7 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListServicesRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.billing.v1.Service()), generateSampleMessage(new protos.google.cloud.billing.v1.Service()), @@ -269,7 +269,7 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListServicesRequest() ); - const expectedOptions = {}; + const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.listServices = stubSimpleCall( undefined, From 6b6a14708b22e4f10bf0066f22dd8f6e6b34cf48 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 9 Dec 2021 22:40:24 +0000 Subject: [PATCH 132/169] build: add generated samples to .eslintignore (#196) --- packages/google-cloud-billing/.eslintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/google-cloud-billing/.eslintignore b/packages/google-cloud-billing/.eslintignore index 9340ad9b86d..ea5b04aebe6 100644 --- a/packages/google-cloud-billing/.eslintignore +++ b/packages/google-cloud-billing/.eslintignore @@ -4,3 +4,4 @@ test/fixtures build/ docs/ protos/ +samples/generated/ From 6b8d4d4ac29daed03159061cb9db9d1fd8a80858 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 29 Dec 2021 19:52:27 +0000 Subject: [PATCH 133/169] docs(node): support "stable"/"preview" release level (#1312) (#199) --- packages/google-cloud-billing/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index c8599916909..c777b530173 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -132,6 +132,8 @@ are addressed with the highest priority. + + More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages From 08d87dc0f4c999aae8bd637433edfad67fbcc26c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 30 Dec 2021 15:18:18 -0500 Subject: [PATCH 134/169] chore: add api_shortname and library_type to repo metadata (#198) --- packages/google-cloud-billing/.repo-metadata.json | 6 ++++-- packages/google-cloud-billing/README.md | 9 ++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-billing/.repo-metadata.json b/packages/google-cloud-billing/.repo-metadata.json index 1dbcc83b182..7ee5cc0ad47 100644 --- a/packages/google-cloud-billing/.repo-metadata.json +++ b/packages/google-cloud-billing/.repo-metadata.json @@ -5,10 +5,12 @@ "repo": "googleapis/nodejs-billing", "default_version": "v1", "name_pretty": "Cloud Billing", - "release_level": "ga", + "release_level": "stable", "distribution_name": "@google-cloud/billing", "name": "billing", "client_documentation": "https://cloud.google.com/nodejs/docs/reference/billing/latest", "api_id": "cloudbilling.googleapis.com", - "issue_tracker": "https://issuetracker.google.com/savedsearches/559770" + "issue_tracker": "https://issuetracker.google.com/savedsearches/559770", + "api_shortname": "cloudbilling", + "library_type": "GAPIC_AUTO" } diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index c777b530173..f54a3e0b110 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -4,7 +4,7 @@ # [Cloud Billing: Node.js Client](https://github.com/googleapis/nodejs-billing) -[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) + [![npm version](https://img.shields.io/npm/v/@google-cloud/billing.svg)](https://www.npmjs.org/package/@google-cloud/billing) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-billing/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-billing) @@ -122,10 +122,10 @@ _Legacy Node.js versions are supported as a best effort:_ This library follows [Semantic Versioning](http://semver.org/). -This library is considered to be **General Availability (GA)**. This means it -is stable; the code surface will not change in backwards-incompatible ways + +This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with -an extensive deprecation period. Issues and requests against **GA** libraries +an extensive deprecation period. Issues and requests against **stable** libraries are addressed with the highest priority. @@ -133,7 +133,6 @@ are addressed with the highest priority. - More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages From a0a3483ecc4351c9edba311f0d14b000344bbe31 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Dec 2021 23:20:15 +0000 Subject: [PATCH 135/169] docs(badges): tweak badge to use new preview/stable language (#1314) (#201) --- packages/google-cloud-billing/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index f54a3e0b110..74354ad51eb 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -4,9 +4,8 @@ # [Cloud Billing: Node.js Client](https://github.com/googleapis/nodejs-billing) - +[![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/billing.svg)](https://www.npmjs.org/package/@google-cloud/billing) -[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-billing/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-billing) From 238d02034bd7789dce015e5adbefba2f29c61bb1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:04:29 +0000 Subject: [PATCH 136/169] test(nodejs): remove 15 add 16 (#1322) (#203) --- packages/google-cloud-billing/protos/protos.d.ts | 2 +- packages/google-cloud-billing/protos/protos.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index d87753ee3fc..dd12d50db3f 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index f0aafc07ba0..f8475ef12ab 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 5fc5e0af92e399863916d05ede97ccc578b859fe Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 26 Jan 2022 22:14:22 +0000 Subject: [PATCH 137/169] chore: update v2.12.0 gapic-generator-typescript (#207) - [ ] Regenerate this pull request now. Committer: @summer-ji-eng PiperOrigin-RevId: 424244721 Source-Link: https://github.com/googleapis/googleapis/commit/4b6b01f507ebc3df95fdf8e1d76b0ae0ae33e52c Source-Link: https://github.com/googleapis/googleapis-gen/commit/8ac83fba606d008c7e8a42e7d55b6596ec4be35f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGFjODNmYmE2MDZkMDA4YzdlOGE0MmU3ZDU1YjY1OTZlYzRiZTM1ZiJ9 --- packages/google-cloud-billing/.jsdoc.js | 4 ++-- packages/google-cloud-billing/linkinator.config.json | 10 ++++++++-- .../v1/cloud_billing.create_billing_account.js | 1 + .../generated/v1/cloud_billing.get_billing_account.js | 1 + .../generated/v1/cloud_billing.get_iam_policy.js | 1 + .../v1/cloud_billing.get_project_billing_info.js | 1 + .../v1/cloud_billing.list_billing_accounts.js | 6 ++++-- .../v1/cloud_billing.list_project_billing_info.js | 3 ++- .../generated/v1/cloud_billing.set_iam_policy.js | 1 + .../generated/v1/cloud_billing.test_iam_permissions.js | 1 + .../v1/cloud_billing.update_billing_account.js | 1 + .../v1/cloud_billing.update_project_billing_info.js | 1 + .../generated/v1/cloud_catalog.list_services.js | 6 ++++-- .../samples/generated/v1/cloud_catalog.list_skus.js | 3 ++- .../src/v1/cloud_billing_client.ts | 2 +- .../src/v1/cloud_catalog_client.ts | 2 +- packages/google-cloud-billing/src/v1/index.ts | 2 +- .../system-test/fixtures/sample/src/index.js | 2 +- .../system-test/fixtures/sample/src/index.ts | 2 +- packages/google-cloud-billing/system-test/install.ts | 2 +- .../test/gapic_cloud_billing_v1.ts | 2 +- .../test/gapic_cloud_catalog_v1.ts | 2 +- 22 files changed, 38 insertions(+), 18 deletions(-) diff --git a/packages/google-cloud-billing/.jsdoc.js b/packages/google-cloud-billing/.jsdoc.js index be80b46b0bd..a1fe10efe19 100644 --- a/packages/google-cloud-billing/.jsdoc.js +++ b/packages/google-cloud-billing/.jsdoc.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ module.exports = { includePattern: '\\.js$' }, templates: { - copyright: 'Copyright 2021 Google LLC', + copyright: 'Copyright 2022 Google LLC', includeDate: false, sourceFiles: false, systemName: '@google-cloud/billing', diff --git a/packages/google-cloud-billing/linkinator.config.json b/packages/google-cloud-billing/linkinator.config.json index 0121dfa684f..befd23c8633 100644 --- a/packages/google-cloud-billing/linkinator.config.json +++ b/packages/google-cloud-billing/linkinator.config.json @@ -3,8 +3,14 @@ "skip": [ "https://codecov.io/gh/googleapis/", "www.googleapis.com", - "img.shields.io" + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" ], "silent": true, - "concurrency": 5 + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js index 3d7407c7f99..fecf344b33a 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(billingAccount) { diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js index 7330019b05a..1cb29dbb4ac 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js index 06917f909a1..0d2608c7c07 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(resource) { diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js index c083d69296e..7a516838b10 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js index 4e688c90f86..9d514b78e96 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -48,12 +49,13 @@ function main() { async function callListBillingAccounts() { // Construct request - const request = {}; + const request = { + }; // Run request const iterable = await billingClient.listBillingAccountsAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js index e815441b64d..480a899f493 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { @@ -51,7 +52,7 @@ function main(name) { // Run request const iterable = await billingClient.listProjectBillingInfoAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js index b39e886ac8e..d5310890b6b 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(resource, policy) { diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js index 687cf31efe7..de6b0f58cea 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(resource, permissions) { diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js index 1634285bbde..a014b620888 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name, account) { diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js index 7ba1106757a..5f40a9fd252 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(name) { diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js index 962af3b8ab1..4213e914632 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main() { @@ -38,12 +39,13 @@ function main() { async function callListServices() { // Construct request - const request = {}; + const request = { + }; // Run request const iterable = await billingClient.listServicesAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js index 28278602f43..7d39ef17514 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. + 'use strict'; function main(parent) { @@ -74,7 +75,7 @@ function main(parent) { // Run request const iterable = await billingClient.listSkusAsync(request); for await (const response of iterable) { - console.log(response); + console.log(response); } } diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 5a3c98f7f03..d1a8d61071e 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 3a442f7b2d8..5abede40784 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/src/v1/index.ts b/packages/google-cloud-billing/src/v1/index.ts index 188a628d1e6..def6d7cf917 100644 --- a/packages/google-cloud-billing/src/v1/index.ts +++ b/packages/google-cloud-billing/src/v1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js index 575d6a7e3d9..c710a66c652 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts index 8453df928f5..08be974583e 100644 --- a/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-billing/system-test/fixtures/sample/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/system-test/install.ts b/packages/google-cloud-billing/system-test/install.ts index d2d61c0396f..6dd1eaadafa 100644 --- a/packages/google-cloud-billing/system-test/install.ts +++ b/packages/google-cloud-billing/system-test/install.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 16834f80986..5b38c019802 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index 0719ac3131a..03870cd4b9e 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 668c5265fd648b5a27ea64e10d1a9e4d388dbe8f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 22:04:54 +0000 Subject: [PATCH 138/169] docs(nodejs): version support policy edits (#1346) (#211) --- packages/google-cloud-billing/README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 74354ad51eb..3475973ee50 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -100,21 +100,21 @@ also contains samples. Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). Libraries are compatible with all current _active_ and _maintenance_ versions of Node.js. +If you are using an end-of-life version of Node.js, we recommend that you update +as soon as possible to an actively supported LTS version. -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. - -_Legacy Node.js versions are supported as a best effort:_ +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: -* Legacy versions will not be tested in continuous integration. -* Some security patches may not be able to be backported. -* Dependencies will not be kept up-to-date, and features will not be backported. +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. -#### Legacy tags available - -* `legacy-8`: install client libraries from this dist-tag for versions - compatible with Node.js 8. +Client libraries targeting some end-of-life versions of Node.js are available, and +can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. +For example, `npm install @google-cloud/billing@legacy-8` installs client libraries +for versions compatible with Node.js 8. ## Versioning From 944872548bc774d438a8b5f6dcc53bd8132af719 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 5 Feb 2022 18:39:01 +0100 Subject: [PATCH 139/169] chore(deps): update dependency sinon to v13 (#209) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^12.0.0` -> `^13.0.0`](https://renovatebot.com/diffs/npm/sinon/12.0.1/13.0.1) | [![age](https://badges.renovateapi.com/packages/npm/sinon/13.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/13.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/13.0.1/compatibility-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/13.0.1/confidence-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v13.0.1`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#​1301) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v13.0.0...v13.0.1) - [`ec4223f9`](https://togithub.com/sinonjs/sinon/commit/ec4223f94076d809483e3c6a7536cfc1278dd3c9) Bump nise to fix [sinonjs/nise#​193](https://togithub.com/sinonjs/nise/issues/193) (Carl-Erik Kopseng) - [`f329a010`](https://togithub.com/sinonjs/sinon/commit/f329a01040bfa5a79e039419220b21eda56935d6) Add unimported to workflow ([#​2441](https://togithub.com/sinonjs/sinon/issues/2441)) (Morgan Roderick) - [`7f16cec9`](https://togithub.com/sinonjs/sinon/commit/7f16cec968c3c8d4e580267fb00195916d6f827d) Enable updates to same major version (Carl-Erik Kopseng) - [`f784d7ad`](https://togithub.com/sinonjs/sinon/commit/f784d7ad2c86be0fc65477d69f8bdafca846ef2c) Re-introduce new version.sh script to version hook (Joel Bradshaw) > This was inadvertently removed during merge conflicts, and is required > for any of the new release process stuff to work - [`51c508ab`](https://togithub.com/sinonjs/sinon/commit/51c508ab77cf0f9fb8c5305ff626f6a2eada178f) Add dry run mode to `npm version` ([#​2436](https://togithub.com/sinonjs/sinon/issues/2436)) (Joel Bradshaw) > - Add DRY_RUN flag to skip publish/push > > - Allow overriding branch names for testing - [`05341dcf`](https://togithub.com/sinonjs/sinon/commit/05341dcf92ddca4a1d4c90966b1fcdc7039cff18) Update npm version scripts to manage new releases branch (Joel Bradshaw) - [`fe658261`](https://togithub.com/sinonjs/sinon/commit/fe65826171db69ed2986a1060db77944dbc98a6d) Remove release archives from master (Joel Bradshaw) > These archives made it difficult to find things in the GitHub interface, > and take up a lot of space in a checked-out repo for something that is > not useful to most people checking out the repository. > > The main purpose of these archives is to make old versions and > documentation available on the Sinon website that is run out of this > repo. This can be supported by using a separate branch for website > releases, and to maintain the archives. > > Following this commit, the `npm version` scripts will be updated to > automatically handle archiving the releases in the new releases branch > and keeping it up to date with master. > > Also remove the directories we removed from .prettierignore, since they > don't exist any more. *Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2022-02-01.* ### [`v13.0.0`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#​1300) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v12.0.1...v13.0.0) - [`cf3d6c0c`](https://togithub.com/sinonjs/sinon/commit/cf3d6c0cd9689c0ee673b3daa8bf9abd70304392) Upgrade packages ([#​2431](https://togithub.com/sinonjs/sinon/issues/2431)) (Carl-Erik Kopseng) > - Update all @​sinonjs/ packages > > - Upgrade to fake-timers 9 > > - chore: ensure always using latest LTS release - [`41710467`](https://togithub.com/sinonjs/sinon/commit/417104670d575e96a1b645ea40ce763afa76fb1b) Adjust deploy scripts to archive old releases in a separate branch, move existing releases out of master ([#​2426](https://togithub.com/sinonjs/sinon/issues/2426)) (Joel Bradshaw) > Co-authored-by: Carl-Erik Kopseng - [`c80a7266`](https://togithub.com/sinonjs/sinon/commit/c80a72660e89d88b08275eff1028ecb9e26fd8e9) Bump node-fetch from 2.6.1 to 2.6.7 ([#​2430](https://togithub.com/sinonjs/sinon/issues/2430)) (dependabot\[bot]) > Co-authored-by: dependabot\[bot] <49699333+dependabot\[bot][@​users](https://togithub.com/users).noreply.github.com> - [`a00f14a9`](https://togithub.com/sinonjs/sinon/commit/a00f14a97dbe8c65afa89674e16ad73fc7d2fdc0) Add explicit export for `./*` ([#​2413](https://togithub.com/sinonjs/sinon/issues/2413)) (なつき) - [`b82ca7ad`](https://togithub.com/sinonjs/sinon/commit/b82ca7ad9b1add59007771f65a18ee34415de8ca) Bump cached-path-relative from 1.0.2 to 1.1.0 ([#​2428](https://togithub.com/sinonjs/sinon/issues/2428)) (dependabot\[bot]) - [`a9ea1427`](https://togithub.com/sinonjs/sinon/commit/a9ea142716c094ef3c432ecc4089f8207b8dd8b6) Add documentation for assert.calledOnceWithMatch ([#​2424](https://togithub.com/sinonjs/sinon/issues/2424)) (Mathias Schreck) - [`1d5ab86b`](https://togithub.com/sinonjs/sinon/commit/1d5ab86ba60e50dd69593ffed2bffd4b8faa0d38) Be more general in stripping off stack frames to fix Firefox tests ([#​2425](https://togithub.com/sinonjs/sinon/issues/2425)) (Joel Bradshaw) - [`56b06129`](https://togithub.com/sinonjs/sinon/commit/56b06129e223eae690265c37b1113067e2b31bdc) Check call count type ([#​2410](https://togithub.com/sinonjs/sinon/issues/2410)) (Joel Bradshaw) - [`7863e2df`](https://togithub.com/sinonjs/sinon/commit/7863e2dfdbda79e0a32e42af09e6539fc2f2b80f) Fix [#​2414](https://togithub.com/sinonjs/sinon/issues/2414): make Sinon available on homepage (Carl-Erik Kopseng) - [`fabaabdd`](https://togithub.com/sinonjs/sinon/commit/fabaabdda82f39a7f5b75b55bd56cf77b1cd4a8f) Bump nokogiri from 1.11.4 to 1.13.1 ([#​2423](https://togithub.com/sinonjs/sinon/issues/2423)) (dependabot\[bot]) - [`dbc0fbd2`](https://togithub.com/sinonjs/sinon/commit/dbc0fbd263c8419fa47f9c3b20cf47890a242d21) Bump shelljs from 0.8.4 to 0.8.5 ([#​2422](https://togithub.com/sinonjs/sinon/issues/2422)) (dependabot\[bot]) - [`fb8b3d72`](https://togithub.com/sinonjs/sinon/commit/fb8b3d72a85dc8fb0547f859baf3f03a22a039f7) Run Prettier (Carl-Erik Kopseng) - [`12a45939`](https://togithub.com/sinonjs/sinon/commit/12a45939e9b047b6d3663fe55f2eb383ec63c4e1) Fix 2377: Throw error when trying to stub non-configurable or non-writable properties ([#​2417](https://togithub.com/sinonjs/sinon/issues/2417)) (Stuart Dotson) > Fixes issue [#​2377](https://togithub.com/sinonjs/sinon/issues/2377) by throwing an error when trying to stub non-configurable or non-writable properties *Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2022-01-28.*
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index c6b7e946391..c222427aa99 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -42,7 +42,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^12.0.0", + "sinon": "^13.0.0", "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From 03f9e1d815a3c6d1be5d9a3217845d507449be14 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 18 Feb 2022 02:00:48 +0000 Subject: [PATCH 140/169] docs(samples): include metadata file, add exclusions for samples to handwritten libraries (#212) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 429395631 Source-Link: https://github.com/googleapis/googleapis/commit/84594b35af0c38efcd6967e8179d801702ad96ff Source-Link: https://github.com/googleapis/googleapis-gen/commit/ed74f970fd82914874e6b27b04763cfa66bafe9b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWQ3NGY5NzBmZDgyOTE0ODc0ZTZiMjdiMDQ3NjNjZmE2NmJhZmU5YiJ9 --- .../cloud_billing.create_billing_account.js | 9 +- .../v1/cloud_billing.get_billing_account.js | 9 +- .../v1/cloud_billing.get_iam_policy.js | 9 +- .../cloud_billing.get_project_billing_info.js | 9 +- .../v1/cloud_billing.list_billing_accounts.js | 9 +- ...cloud_billing.list_project_billing_info.js | 9 +- .../v1/cloud_billing.set_iam_policy.js | 9 +- .../v1/cloud_billing.test_iam_permissions.js | 9 +- .../cloud_billing.update_billing_account.js | 9 +- ...oud_billing.update_project_billing_info.js | 9 +- .../v1/cloud_catalog.list_services.js | 9 +- .../generated/v1/cloud_catalog.list_skus.js | 9 +- ...ppet_metadata.google.cloud.billing.v1.json | 559 ++++++++++++++++++ .../src/v1/cloud_billing_client.ts | 5 +- .../src/v1/cloud_catalog_client.ts | 5 +- .../test/gapic_cloud_billing_v1.ts | 151 ++++- .../test/gapic_cloud_catalog_v1.ts | 19 +- 17 files changed, 813 insertions(+), 34 deletions(-) create mode 100644 packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js index fecf344b33a..219d3230931 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js index 1cb29dbb4ac..fc835c34e12 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js index 0d2608c7c07..595d4926b7b 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js index 7a516838b10..b8a9fcb4c41 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js index 9d514b78e96..24238125419 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js index 480a899f493..e7b16d3c863 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js index d5310890b6b..d6eb9135d90 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js index de6b0f58cea..f3c3ea34f11 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js index a014b620888..8b24c9f78ca 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js index 5f40a9fd252..69fe0a80ace 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js index 4213e914632..2a27e9dc98a 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js index 7d39ef17514..3dd60ebae66 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json new file mode 100644 index 00000000000..f60caa6e326 --- /dev/null +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -0,0 +1,559 @@ +{ + "clientLibrary": { + "name": "nodejs-billing", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.billing.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async", + "title": "CloudBilling getBillingAccount Sample", + "origin": "API_DEFINITION", + "description": " Gets information about a billing account. The current authenticated user must be a [viewer of the billing account](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.get_billing_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.GetBillingAccount", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.BillingAccount", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "GetBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.GetBillingAccount", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_ListBillingAccounts_async", + "title": "CloudBilling listBillingAccounts Sample", + "origin": "API_DEFINITION", + "description": " Lists the billing accounts that the current authenticated user has permission to [view](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.list_billing_accounts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBillingAccounts", + "fullName": "google.cloud.billing.v1.CloudBilling.ListBillingAccounts", + "async": true, + "parameters": [ + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ListBillingAccountsResponse", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "ListBillingAccounts", + "fullName": "google.cloud.billing.v1.CloudBilling.ListBillingAccounts", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_UpdateBillingAccount_async", + "title": "CloudBilling updateBillingAccount Sample", + "origin": "API_DEFINITION", + "description": " Updates a billing account's fields. Currently the only field that can be edited is `display_name`. The current authenticated user must have the `billing.accounts.update` IAM permission, which is typically given to the [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing account.", + "canonical": true, + "file": "cloud_billing.update_billing_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.UpdateBillingAccount", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "account", + "type": ".google.cloud.billing.v1.BillingAccount" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.billing.v1.BillingAccount", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "UpdateBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.UpdateBillingAccount", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async", + "title": "CloudBilling createBillingAccount Sample", + "origin": "API_DEFINITION", + "description": " Creates a billing account. This method can only be used to create [billing subaccounts](https://cloud.google.com/billing/docs/concepts) by GCP resellers. When creating a subaccount, the current authenticated user must have the `billing.accounts.update` IAM permission on the master account, which is typically given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will return an error if the master account has not been provisioned as a reseller account.", + "canonical": true, + "file": "cloud_billing.create_billing_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.CreateBillingAccount", + "async": true, + "parameters": [ + { + "name": "billing_account", + "type": ".google.cloud.billing.v1.BillingAccount" + } + ], + "resultType": ".google.cloud.billing.v1.BillingAccount", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "CreateBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.CreateBillingAccount", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_ListProjectBillingInfo_async", + "title": "CloudBilling listProjectBillingInfo Sample", + "origin": "API_DEFINITION", + "description": " Lists the projects associated with a billing account. The current authenticated user must have the `billing.resourceAssociations.list` IAM permission, which is often given to billing account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.list_project_billing_info.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.ListProjectBillingInfo", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ListProjectBillingInfoResponse", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "ListProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.ListProjectBillingInfo", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_GetProjectBillingInfo_async", + "title": "CloudBilling getProjectBillingInfo Sample", + "origin": "API_DEFINITION", + "description": " Gets the billing information for a project. The current authenticated user must have [permission to view the project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ).", + "canonical": true, + "file": "cloud_billing.get_project_billing_info.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.GetProjectBillingInfo", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ProjectBillingInfo", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "GetProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.GetProjectBillingInfo", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_UpdateProjectBillingInfo_async", + "title": "CloudBilling updateProjectBillingInfo Sample", + "origin": "API_DEFINITION", + "description": " Sets or updates the billing account associated with a project. You specify the new billing account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges. *Note:* Incurred charges that have not yet been reported in the transaction history of the GCP Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project. The current authenticated user must have ownership privileges for both the [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing account](https://cloud.google.com/billing/docs/how-to/billing-access). You can disable billing on the project by setting the `billing_account_name` field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project. Note that associating a project with a *closed* billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an *open* billing account.", + "canonical": true, + "file": "cloud_billing.update_project_billing_info.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfo", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_billing_info", + "type": ".google.cloud.billing.v1.ProjectBillingInfo" + } + ], + "resultType": ".google.cloud.billing.v1.ProjectBillingInfo", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "UpdateProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfo", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async", + "title": "CloudBilling getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for a billing account. The caller must have the `billing.accounts.getIamPolicy` permission on the account, which is often given to billing account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.billing.v1.CloudBilling.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.billing.v1.CloudBilling.GetIamPolicy", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_SetIamPolicy_async", + "title": "CloudBilling setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the `billing.accounts.setIamPolicy` permission on the account, which is often given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.billing.v1.CloudBilling.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.billing.v1.CloudBilling.SetIamPolicy", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudBilling_TestIamPermissions_async", + "title": "CloudBilling testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.", + "canonical": true, + "file": "cloud_billing.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.billing.v1.CloudBilling.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.billing.v1.CloudBilling.TestIamPermissions", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudCatalog_ListServices_async", + "title": "CloudBilling listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists all public cloud services.", + "canonical": true, + "file": "cloud_catalog.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.cloud.billing.v1.CloudCatalog.ListServices", + "async": true, + "parameters": [ + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ListServicesResponse", + "client": { + "shortName": "CloudCatalogClient", + "fullName": "google.cloud.billing.v1.CloudCatalogClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.cloud.billing.v1.CloudCatalog.ListServices", + "service": { + "shortName": "CloudCatalog", + "fullName": "google.cloud.billing.v1.CloudCatalog" + } + } + } + }, + { + "regionTag": "cloudbilling_v1_generated_CloudCatalog_ListSkus_async", + "title": "CloudBilling listSkus Sample", + "origin": "API_DEFINITION", + "description": " Lists all publicly available SKUs for a given cloud service.", + "canonical": true, + "file": "cloud_catalog.list_skus.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSkus", + "fullName": "google.cloud.billing.v1.CloudCatalog.ListSkus", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "end_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "currency_code", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ListSkusResponse", + "client": { + "shortName": "CloudCatalogClient", + "fullName": "google.cloud.billing.v1.CloudCatalogClient" + }, + "method": { + "shortName": "ListSkus", + "fullName": "google.cloud.billing.v1.CloudCatalog.ListSkus", + "service": { + "shortName": "CloudCatalog", + "fullName": "google.cloud.billing.v1.CloudCatalog" + } + } + } + } + ] +} diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index d1a8d61071e..be3f6e6a095 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -1638,9 +1638,8 @@ export class CloudBillingClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.cloudBillingStub!.then(stub => { + if (this.cloudBillingStub && !this._terminated) { + return this.cloudBillingStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 5abede40784..bb04f02c75d 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -807,9 +807,8 @@ export class CloudCatalogClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.cloudCatalogStub!.then(stub => { + if (this.cloudCatalogStub && !this._terminated) { + return this.cloudCatalogStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 5b38c019802..355734d0c4f 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -151,12 +151,27 @@ describe('v1.CloudBillingClient', () => { assert(client.cloudBillingStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new cloudbillingModule.v1.CloudBillingClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.cloudBillingStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBillingStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -302,6 +317,22 @@ describe('v1.CloudBillingClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getBillingAccount with closed client', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getBillingAccount(request), expectedError); + }); }); describe('updateBillingAccount', () => { @@ -414,6 +445,22 @@ describe('v1.CloudBillingClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateBillingAccount with closed client', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateBillingAccount(request), expectedError); + }); }); describe('createBillingAccount', () => { @@ -502,6 +549,20 @@ describe('v1.CloudBillingClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createBillingAccount with closed client', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.CreateBillingAccountRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createBillingAccount(request), expectedError); + }); }); describe('getProjectBillingInfo', () => { @@ -617,6 +678,25 @@ describe('v1.CloudBillingClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getProjectBillingInfo with closed client', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getProjectBillingInfo(request), + expectedError + ); + }); }); describe('updateProjectBillingInfo', () => { @@ -732,6 +812,25 @@ describe('v1.CloudBillingClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateProjectBillingInfo with closed client', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateProjectBillingInfo(request), + expectedError + ); + }); }); describe('getIamPolicy', () => { @@ -843,6 +942,22 @@ describe('v1.CloudBillingClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); }); describe('setIamPolicy', () => { @@ -954,6 +1069,22 @@ describe('v1.CloudBillingClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); }); describe('testIamPermissions', () => { @@ -1066,6 +1197,22 @@ describe('v1.CloudBillingClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); }); describe('listBillingAccounts', () => { diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index 03870cd4b9e..87c81aedd95 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -151,12 +151,27 @@ describe('v1.CloudCatalogClient', () => { assert(client.cloudCatalogStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new cloudcatalogModule.v1.CloudCatalogClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.cloudCatalogStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudCatalogStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { From 86e2a2bfb75df69b32346556dc5bb55afc68b5d1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 15 Mar 2022 21:17:37 -0700 Subject: [PATCH 141/169] chore: update v2.14.2 gapic-generator-typescript (#216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update v2.14.2 gapic-generator-typescript Committer: @summer-ji-eng PiperOrigin-RevId: 434859890 Source-Link: https://github.com/googleapis/googleapis/commit/bc2432d50cba657e95212122e3fa112591b5bec2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/930b673103e92523f8cfed38decd7d3afae8ebe7 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMwYjY3MzEwM2U5MjUyM2Y4Y2ZlZDM4ZGVjZDdkM2FmYWU4ZWJlNyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../google-cloud-billing/test/gapic_cloud_billing_v1.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 355734d0c4f..eeb6d8940da 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -328,7 +328,6 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getBillingAccount(request), expectedError); @@ -456,7 +455,6 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateBillingAccount(request), expectedError); @@ -689,7 +687,6 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -823,7 +820,6 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); request.name = ''; - const expectedHeaderRequestParams = 'name='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -953,7 +949,6 @@ describe('v1.CloudBillingClient', () => { new protos.google.iam.v1.GetIamPolicyRequest() ); request.resource = ''; - const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getIamPolicy(request), expectedError); @@ -1080,7 +1075,6 @@ describe('v1.CloudBillingClient', () => { new protos.google.iam.v1.SetIamPolicyRequest() ); request.resource = ''; - const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setIamPolicy(request), expectedError); @@ -1208,7 +1202,6 @@ describe('v1.CloudBillingClient', () => { new protos.google.iam.v1.TestIamPermissionsRequest() ); request.resource = ''; - const expectedHeaderRequestParams = 'resource='; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.testIamPermissions(request), expectedError); From 2d632c289f5745ec21a647ddd5f9856bb656b846 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 5 Apr 2022 17:34:20 +0000 Subject: [PATCH 142/169] feat: AuditConfig for IAM v1 (#218) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 439356405 Source-Link: https://github.com/googleapis/googleapis/commit/afa2ba156bd5c83ad8168030ab801a8ca84ac819 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3e40c17e1510c95fab58fc2143ccb61cceca5989 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2U0MGMxN2UxNTEwYzk1ZmFiNThmYzIxNDNjY2I2MWNjZWNhNTk4OSJ9 --- .../samples/generated/v1/cloud_billing.get_iam_policy.js | 2 +- .../samples/generated/v1/cloud_billing.set_iam_policy.js | 7 +++++++ .../v1/snippet_metadata.google.cloud.billing.v1.json | 6 +++++- .../google-cloud-billing/src/v1/cloud_billing_client.ts | 8 +++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js index 595d4926b7b..23aee0ca567 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js @@ -32,7 +32,7 @@ function main(resource) { // const resource = 'abc123' /** * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. + * `GetIamPolicy`. */ // const options = {} diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js index d6eb9135d90..600bf2d26bc 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js @@ -37,6 +37,13 @@ function main(resource, policy) { * might reject them. */ // const policy = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} // Imports the Billing library const {CloudBillingClient} = require('@google-cloud/billing').v1; diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json index f60caa6e326..d26ab7e7476 100644 --- a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -374,7 +374,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 66, "type": "FULL" } ], @@ -390,6 +390,10 @@ { "name": "policy", "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" } ], "resultType": ".google.iam.v1.Policy", diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index be3f6e6a095..7a2e26947d7 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -870,7 +870,7 @@ export class CloudBillingClient { * See the operation documentation for the appropriate value for this field. * @param {google.iam.v1.GetPolicyOptions} request.options * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. + * `GetIamPolicy`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -964,6 +964,12 @@ export class CloudBillingClient { * 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. From ec51d0aa895b83a304719cc1eeaf4fcfffda57ff Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 16:52:59 -0400 Subject: [PATCH 143/169] chore(main): release 2.4.0 (#219) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Benjamin E. Coe --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index a6eb3fdef87..84467f77df6 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [2.4.0](https://github.com/googleapis/nodejs-billing/compare/v2.3.0...v2.4.0) (2022-04-06) + + +### Features + +* AuditConfig for IAM v1 ([#218](https://github.com/googleapis/nodejs-billing/issues/218)) ([88e6535](https://github.com/googleapis/nodejs-billing/commit/88e6535e6c356534884c09f7d781a53f330bfef3)) + ## [2.3.0](https://www.github.com/googleapis/nodejs-billing/compare/v2.2.7...v2.3.0) (2021-08-23) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index c222427aa99..1a3e1a8bc1a 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.3.0", + "version": "2.4.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 6cc6d8ca3a7..268a288e86e 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.3.0" + "@google-cloud/billing": "^2.4.0" }, "devDependencies": { "c8": "^7.1.0", From 46d2c37dde6f0a22f80c19d5f7d85352d9838adf Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 18:18:22 +0000 Subject: [PATCH 144/169] build(node): update client library version in samples metadata (#1356) (#225) * build(node): add feat in node post-processor to add client library version number in snippet metadata Co-authored-by: Benjamin E. Coe Source-Link: https://github.com/googleapis/synthtool/commit/d337b88dd1494365183718a2de0b7b4056b6fdfe Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:d106724ad2a96daa1b8d88de101ba50bdb30b8df62ffa0aa2b451d93b4556641 --- ...ppet_metadata.google.cloud.billing.v1.json | 1076 ++++++++--------- 1 file changed, 538 insertions(+), 538 deletions(-) diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json index d26ab7e7476..cf8147ef9ff 100644 --- a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -1,563 +1,563 @@ { - "clientLibrary": { - "name": "nodejs-billing", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.billing.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async", - "title": "CloudBilling getBillingAccount Sample", - "origin": "API_DEFINITION", - "description": " Gets information about a billing account. The current authenticated user must be a [viewer of the billing account](https://cloud.google.com/billing/docs/how-to/billing-access).", - "canonical": true, - "file": "cloud_billing.get_billing_account.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBillingAccount", - "fullName": "google.cloud.billing.v1.CloudBilling.GetBillingAccount", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.billing.v1.BillingAccount", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" - }, - "method": { - "shortName": "GetBillingAccount", - "fullName": "google.cloud.billing.v1.CloudBilling.GetBillingAccount", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } + "clientLibrary": { + "name": "nodejs-billing", + "version": "2.4.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.billing.v1", + "version": "v1" + } + ] }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_ListBillingAccounts_async", - "title": "CloudBilling listBillingAccounts Sample", - "origin": "API_DEFINITION", - "description": " Lists the billing accounts that the current authenticated user has permission to [view](https://cloud.google.com/billing/docs/how-to/billing-access).", - "canonical": true, - "file": "cloud_billing.list_billing_accounts.js", - "language": "JAVASCRIPT", - "segments": [ + "snippets": [ { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBillingAccounts", - "fullName": "google.cloud.billing.v1.CloudBilling.ListBillingAccounts", - "async": true, - "parameters": [ - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.billing.v1.ListBillingAccountsResponse", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async", + "title": "CloudBilling getBillingAccount Sample", + "origin": "API_DEFINITION", + "description": " Gets information about a billing account. The current authenticated user must be a [viewer of the billing account](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.get_billing_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.GetBillingAccount", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.BillingAccount", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "GetBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.GetBillingAccount", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "ListBillingAccounts", - "fullName": "google.cloud.billing.v1.CloudBilling.ListBillingAccounts", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_UpdateBillingAccount_async", - "title": "CloudBilling updateBillingAccount Sample", - "origin": "API_DEFINITION", - "description": " Updates a billing account's fields. Currently the only field that can be edited is `display_name`. The current authenticated user must have the `billing.accounts.update` IAM permission, which is typically given to the [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing account.", - "canonical": true, - "file": "cloud_billing.update_billing_account.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBillingAccount", - "fullName": "google.cloud.billing.v1.CloudBilling.UpdateBillingAccount", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "account", - "type": ".google.cloud.billing.v1.BillingAccount" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.billing.v1.BillingAccount", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_ListBillingAccounts_async", + "title": "CloudBilling listBillingAccounts Sample", + "origin": "API_DEFINITION", + "description": " Lists the billing accounts that the current authenticated user has permission to [view](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.list_billing_accounts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBillingAccounts", + "fullName": "google.cloud.billing.v1.CloudBilling.ListBillingAccounts", + "async": true, + "parameters": [ + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ListBillingAccountsResponse", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "ListBillingAccounts", + "fullName": "google.cloud.billing.v1.CloudBilling.ListBillingAccounts", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "UpdateBillingAccount", - "fullName": "google.cloud.billing.v1.CloudBilling.UpdateBillingAccount", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async", - "title": "CloudBilling createBillingAccount Sample", - "origin": "API_DEFINITION", - "description": " Creates a billing account. This method can only be used to create [billing subaccounts](https://cloud.google.com/billing/docs/concepts) by GCP resellers. When creating a subaccount, the current authenticated user must have the `billing.accounts.update` IAM permission on the master account, which is typically given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will return an error if the master account has not been provisioned as a reseller account.", - "canonical": true, - "file": "cloud_billing.create_billing_account.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBillingAccount", - "fullName": "google.cloud.billing.v1.CloudBilling.CreateBillingAccount", - "async": true, - "parameters": [ - { - "name": "billing_account", - "type": ".google.cloud.billing.v1.BillingAccount" - } - ], - "resultType": ".google.cloud.billing.v1.BillingAccount", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_UpdateBillingAccount_async", + "title": "CloudBilling updateBillingAccount Sample", + "origin": "API_DEFINITION", + "description": " Updates a billing account's fields. Currently the only field that can be edited is `display_name`. The current authenticated user must have the `billing.accounts.update` IAM permission, which is typically given to the [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing account.", + "canonical": true, + "file": "cloud_billing.update_billing_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.UpdateBillingAccount", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "account", + "type": ".google.cloud.billing.v1.BillingAccount" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.billing.v1.BillingAccount", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "UpdateBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.UpdateBillingAccount", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "CreateBillingAccount", - "fullName": "google.cloud.billing.v1.CloudBilling.CreateBillingAccount", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_ListProjectBillingInfo_async", - "title": "CloudBilling listProjectBillingInfo Sample", - "origin": "API_DEFINITION", - "description": " Lists the projects associated with a billing account. The current authenticated user must have the `billing.resourceAssociations.list` IAM permission, which is often given to billing account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).", - "canonical": true, - "file": "cloud_billing.list_project_billing_info.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProjectBillingInfo", - "fullName": "google.cloud.billing.v1.CloudBilling.ListProjectBillingInfo", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.billing.v1.ListProjectBillingInfoResponse", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async", + "title": "CloudBilling createBillingAccount Sample", + "origin": "API_DEFINITION", + "description": " Creates a billing account. This method can only be used to create [billing subaccounts](https://cloud.google.com/billing/docs/concepts) by GCP resellers. When creating a subaccount, the current authenticated user must have the `billing.accounts.update` IAM permission on the master account, which is typically given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will return an error if the master account has not been provisioned as a reseller account.", + "canonical": true, + "file": "cloud_billing.create_billing_account.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.CreateBillingAccount", + "async": true, + "parameters": [ + { + "name": "billing_account", + "type": ".google.cloud.billing.v1.BillingAccount" + } + ], + "resultType": ".google.cloud.billing.v1.BillingAccount", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "CreateBillingAccount", + "fullName": "google.cloud.billing.v1.CloudBilling.CreateBillingAccount", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "ListProjectBillingInfo", - "fullName": "google.cloud.billing.v1.CloudBilling.ListProjectBillingInfo", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_GetProjectBillingInfo_async", - "title": "CloudBilling getProjectBillingInfo Sample", - "origin": "API_DEFINITION", - "description": " Gets the billing information for a project. The current authenticated user must have [permission to view the project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ).", - "canonical": true, - "file": "cloud_billing.get_project_billing_info.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProjectBillingInfo", - "fullName": "google.cloud.billing.v1.CloudBilling.GetProjectBillingInfo", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.billing.v1.ProjectBillingInfo", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_ListProjectBillingInfo_async", + "title": "CloudBilling listProjectBillingInfo Sample", + "origin": "API_DEFINITION", + "description": " Lists the projects associated with a billing account. The current authenticated user must have the `billing.resourceAssociations.list` IAM permission, which is often given to billing account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.list_project_billing_info.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.ListProjectBillingInfo", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ListProjectBillingInfoResponse", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "ListProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.ListProjectBillingInfo", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "GetProjectBillingInfo", - "fullName": "google.cloud.billing.v1.CloudBilling.GetProjectBillingInfo", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_UpdateProjectBillingInfo_async", - "title": "CloudBilling updateProjectBillingInfo Sample", - "origin": "API_DEFINITION", - "description": " Sets or updates the billing account associated with a project. You specify the new billing account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges. *Note:* Incurred charges that have not yet been reported in the transaction history of the GCP Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project. The current authenticated user must have ownership privileges for both the [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing account](https://cloud.google.com/billing/docs/how-to/billing-access). You can disable billing on the project by setting the `billing_account_name` field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project. Note that associating a project with a *closed* billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an *open* billing account.", - "canonical": true, - "file": "cloud_billing.update_project_billing_info.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProjectBillingInfo", - "fullName": "google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfo", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project_billing_info", - "type": ".google.cloud.billing.v1.ProjectBillingInfo" - } - ], - "resultType": ".google.cloud.billing.v1.ProjectBillingInfo", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_GetProjectBillingInfo_async", + "title": "CloudBilling getProjectBillingInfo Sample", + "origin": "API_DEFINITION", + "description": " Gets the billing information for a project. The current authenticated user must have [permission to view the project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ).", + "canonical": true, + "file": "cloud_billing.get_project_billing_info.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.GetProjectBillingInfo", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ProjectBillingInfo", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "GetProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.GetProjectBillingInfo", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "UpdateProjectBillingInfo", - "fullName": "google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfo", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async", - "title": "CloudBilling getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for a billing account. The caller must have the `billing.accounts.getIamPolicy` permission on the account, which is often given to billing account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).", - "canonical": true, - "file": "cloud_billing.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.billing.v1.CloudBilling.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_UpdateProjectBillingInfo_async", + "title": "CloudBilling updateProjectBillingInfo Sample", + "origin": "API_DEFINITION", + "description": " Sets or updates the billing account associated with a project. You specify the new billing account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges. *Note:* Incurred charges that have not yet been reported in the transaction history of the GCP Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project. The current authenticated user must have ownership privileges for both the [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing account](https://cloud.google.com/billing/docs/how-to/billing-access). You can disable billing on the project by setting the `billing_account_name` field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project. Note that associating a project with a *closed* billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an *open* billing account.", + "canonical": true, + "file": "cloud_billing.update_project_billing_info.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfo", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project_billing_info", + "type": ".google.cloud.billing.v1.ProjectBillingInfo" + } + ], + "resultType": ".google.cloud.billing.v1.ProjectBillingInfo", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "UpdateProjectBillingInfo", + "fullName": "google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfo", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.billing.v1.CloudBilling.GetIamPolicy", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_SetIamPolicy_async", - "title": "CloudBilling setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the `billing.accounts.setIamPolicy` permission on the account, which is often given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).", - "canonical": true, - "file": "cloud_billing.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.billing.v1.CloudBilling.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": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async", + "title": "CloudBilling getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for a billing account. The caller must have the `billing.accounts.getIamPolicy` permission on the account, which is often given to billing account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.billing.v1.CloudBilling.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.billing.v1.CloudBilling.GetIamPolicy", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.billing.v1.CloudBilling.SetIamPolicy", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudBilling_TestIamPermissions_async", - "title": "CloudBilling testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.", - "canonical": true, - "file": "cloud_billing.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.billing.v1.CloudBilling.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "CloudBillingClient", - "fullName": "google.cloud.billing.v1.CloudBillingClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_SetIamPolicy_async", + "title": "CloudBilling setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the `billing.accounts.setIamPolicy` permission on the account, which is often given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).", + "canonical": true, + "file": "cloud_billing.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.billing.v1.CloudBilling.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": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.billing.v1.CloudBilling.SetIamPolicy", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.billing.v1.CloudBilling.TestIamPermissions", - "service": { - "shortName": "CloudBilling", - "fullName": "google.cloud.billing.v1.CloudBilling" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudCatalog_ListServices_async", - "title": "CloudBilling listServices Sample", - "origin": "API_DEFINITION", - "description": " Lists all public cloud services.", - "canonical": true, - "file": "cloud_catalog.list_services.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.cloud.billing.v1.CloudCatalog.ListServices", - "async": true, - "parameters": [ - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.billing.v1.ListServicesResponse", - "client": { - "shortName": "CloudCatalogClient", - "fullName": "google.cloud.billing.v1.CloudCatalogClient" + "regionTag": "cloudbilling_v1_generated_CloudBilling_TestIamPermissions_async", + "title": "CloudBilling testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.", + "canonical": true, + "file": "cloud_billing.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.billing.v1.CloudBilling.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "CloudBillingClient", + "fullName": "google.cloud.billing.v1.CloudBillingClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.billing.v1.CloudBilling.TestIamPermissions", + "service": { + "shortName": "CloudBilling", + "fullName": "google.cloud.billing.v1.CloudBilling" + } + } + } }, - "method": { - "shortName": "ListServices", - "fullName": "google.cloud.billing.v1.CloudCatalog.ListServices", - "service": { - "shortName": "CloudCatalog", - "fullName": "google.cloud.billing.v1.CloudCatalog" - } - } - } - }, - { - "regionTag": "cloudbilling_v1_generated_CloudCatalog_ListSkus_async", - "title": "CloudBilling listSkus Sample", - "origin": "API_DEFINITION", - "description": " Lists all publicly available SKUs for a given cloud service.", - "canonical": true, - "file": "cloud_catalog.list_skus.js", - "language": "JAVASCRIPT", - "segments": [ { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSkus", - "fullName": "google.cloud.billing.v1.CloudCatalog.ListSkus", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "start_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "end_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "currency_code", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.billing.v1.ListSkusResponse", - "client": { - "shortName": "CloudCatalogClient", - "fullName": "google.cloud.billing.v1.CloudCatalogClient" + "regionTag": "cloudbilling_v1_generated_CloudCatalog_ListServices_async", + "title": "CloudBilling listServices Sample", + "origin": "API_DEFINITION", + "description": " Lists all public cloud services.", + "canonical": true, + "file": "cloud_catalog.list_services.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServices", + "fullName": "google.cloud.billing.v1.CloudCatalog.ListServices", + "async": true, + "parameters": [ + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ListServicesResponse", + "client": { + "shortName": "CloudCatalogClient", + "fullName": "google.cloud.billing.v1.CloudCatalogClient" + }, + "method": { + "shortName": "ListServices", + "fullName": "google.cloud.billing.v1.CloudCatalog.ListServices", + "service": { + "shortName": "CloudCatalog", + "fullName": "google.cloud.billing.v1.CloudCatalog" + } + } + } }, - "method": { - "shortName": "ListSkus", - "fullName": "google.cloud.billing.v1.CloudCatalog.ListSkus", - "service": { - "shortName": "CloudCatalog", - "fullName": "google.cloud.billing.v1.CloudCatalog" - } + { + "regionTag": "cloudbilling_v1_generated_CloudCatalog_ListSkus_async", + "title": "CloudBilling listSkus Sample", + "origin": "API_DEFINITION", + "description": " Lists all publicly available SKUs for a given cloud service.", + "canonical": true, + "file": "cloud_catalog.list_skus.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSkus", + "fullName": "google.cloud.billing.v1.CloudCatalog.ListSkus", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "start_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "end_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "currency_code", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.billing.v1.ListSkusResponse", + "client": { + "shortName": "CloudCatalogClient", + "fullName": "google.cloud.billing.v1.CloudCatalogClient" + }, + "method": { + "shortName": "ListSkus", + "fullName": "google.cloud.billing.v1.CloudCatalog.ListSkus", + "service": { + "shortName": "CloudCatalog", + "fullName": "google.cloud.billing.v1.CloudCatalog" + } + } + } } - } - } - ] -} + ] +} \ No newline at end of file From c98b6cc460329163349ef6fc7c91e2a5de3d70c7 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 3 May 2022 02:24:33 +0200 Subject: [PATCH 145/169] chore(deps): update dependency @types/mocha to v9 (#226) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/8.2.3/9.1.1) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/compatibility-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/confidence-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 1a3e1a8bc1a..cee470d02d8 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -30,7 +30,7 @@ "google-gax": "^2.24.1" }, "devDependencies": { - "@types/mocha": "^8.0.0", + "@types/mocha": "^9.0.0", "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.0.0", From 1147029671b8f39c3324ea04a473a8f4f294a29c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 9 May 2022 17:38:31 +0200 Subject: [PATCH 146/169] chore(deps): update dependency sinon to v14 (#229) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^13.0.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/sinon/13.0.2/14.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/compatibility-slim/13.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/14.0.0/confidence-slim/13.0.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
sinonjs/sinon ### [`v14.0.0`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#​1400) [Compare Source](https://togithub.com/sinonjs/sinon/compare/v13.0.2...v14.0.0) - [`c2bbd826`](https://togithub.com/sinonjs/sinon/commit/c2bbd82641444eb5b32822489ae40f185afbbf00) Drop node 12 (Morgan Roderick) > And embrace Node 18 > > See https://nodejs.org/en/about/releases/ *Released by Morgan Roderick on 2022-05-07.*
--- ### Configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index cee470d02d8..40f2cbef74f 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -42,7 +42,7 @@ "mocha": "^8.0.0", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", + "sinon": "^14.0.0", "ts-loader": "^9.0.0", "typescript": "^3.8.3", "webpack": "^5.0.0", From 10e5efb69501bacfd2e218022c8667033ac9881f Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Wed, 18 May 2022 11:57:31 -0700 Subject: [PATCH 147/169] build!: update library to use Node 12 (#230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build!: Update library to use Node 12 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update gts Co-authored-by: Owl Bot --- packages/google-cloud-billing/package.json | 10 +++++----- packages/google-cloud-billing/samples/package.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 40f2cbef74f..94e612bc0b0 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -27,28 +27,28 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^2.24.1" + "google-gax": "^3.0.0" }, "devDependencies": { "@types/mocha": "^9.0.0", "@types/node": "^16.0.0", "@types/sinon": "^10.0.0", "c8": "^7.0.0", - "gts": "^2.0.0", + "gts": "^3.1.0", "jsdoc": "^3.5.5", "jsdoc-fresh": "^1.0.1", "jsdoc-region-tag": "^1.0.2", "linkinator": "^2.0.0", - "mocha": "^8.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": "^3.8.3", + "typescript": "^4.6.4", "webpack": "^5.0.0", "webpack-cli": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=12.0.0" } } diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 268a288e86e..40c34bc3106 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=10" + "node": ">=12.0.0" }, "files": [ "*.js" @@ -20,4 +20,4 @@ "chai": "^4.2.0", "mocha": "^8.0.0" } -} +} \ No newline at end of file From 35e70359d41616ff6938b3205db7b9e065b03c62 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 11:54:53 -0400 Subject: [PATCH 148/169] chore(main): release 3.0.0 (#232) See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-billing/CHANGELOG.md | 11 +++++++++++ packages/google-cloud-billing/package.json | 2 +- .../v1/snippet_metadata.google.cloud.billing.v1.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 84467f77df6..5afca16c809 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [3.0.0](https://github.com/googleapis/nodejs-billing/compare/v2.4.0...v3.0.0) (2022-05-20) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#230) + +### Build System + +* update library to use Node 12 ([#230](https://github.com/googleapis/nodejs-billing/issues/230)) ([9521ea0](https://github.com/googleapis/nodejs-billing/commit/9521ea0ab1916f493da9430800b0dd64bd2f3113)) + ## [2.4.0](https://github.com/googleapis/nodejs-billing/compare/v2.3.0...v2.4.0) (2022-04-06) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 94e612bc0b0..c849b60f24d 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "2.4.0", + "version": "3.0.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json index cf8147ef9ff..5ad759beeb7 100644 --- a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-billing", - "version": "2.4.0", + "version": "3.0.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 40c34bc3106..f12b30df3e0 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^2.4.0" + "@google-cloud/billing": "^3.0.0" }, "devDependencies": { "c8": "^7.1.0", From 36e260b5a217e75cdb28683e1195601247a9a069 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 10 Jun 2022 17:00:33 +0200 Subject: [PATCH 149/169] chore(deps): update dependency jsdoc-fresh to v2 (#235) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc-fresh](https://togithub.com/googleapis/jsdoc-fresh) | [`^1.0.1` -> `^2.0.0`](https://renovatebot.com/diffs/npm/jsdoc-fresh/1.1.1/2.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/compatibility-slim/1.1.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/confidence-slim/1.1.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/jsdoc-fresh ### [`v2.0.0`](https://togithub.com/googleapis/jsdoc-fresh/blob/HEAD/CHANGELOG.md#​200-httpsgithubcomgoogleapisjsdoc-freshcomparev111v200-2022-05-18) [Compare Source](https://togithub.com/googleapis/jsdoc-fresh/compare/v1.1.1...v2.0.0) ##### ⚠ BREAKING CHANGES - update library to use Node 12 ([#​108](https://togithub.com/googleapis/jsdoc-fresh/issues/108)) ##### Build System - update library to use Node 12 ([#​108](https://togithub.com/googleapis/jsdoc-fresh/issues/108)) ([e61c223](https://togithub.com/googleapis/jsdoc-fresh/commit/e61c2238db8900e339e5fe7fb8aea09642290182)) ##### [1.1.1](https://www.github.com/googleapis/jsdoc-fresh/compare/v1.1.0...v1.1.1) (2021-08-11) ##### Bug Fixes - **build:** migrate to using main branch ([#​83](https://www.togithub.com/googleapis/jsdoc-fresh/issues/83)) ([9474adb](https://www.github.com/googleapis/jsdoc-fresh/commit/9474adbf0d559d319ff207397ba2be6b557999ac))
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index c849b60f24d..4e554713c4b 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -36,7 +36,7 @@ "c8": "^7.0.0", "gts": "^3.1.0", "jsdoc": "^3.5.5", - "jsdoc-fresh": "^1.0.1", + "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^1.0.2", "linkinator": "^2.0.0", "mocha": "^9.2.2", From 8e98ae55fc5ac77746c59a2768d63dd9ea7cd254 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 10 Jun 2022 17:24:44 +0200 Subject: [PATCH 150/169] chore(deps): update dependency jsdoc-region-tag to v2 (#236) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc-region-tag](https://togithub.com/googleapis/jsdoc-region-tag) | [`^1.0.2` -> `^2.0.0`](https://renovatebot.com/diffs/npm/jsdoc-region-tag/1.3.1/2.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/compatibility-slim/1.3.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc-region-tag/2.0.0/confidence-slim/1.3.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/jsdoc-region-tag ### [`v2.0.0`](https://togithub.com/googleapis/jsdoc-region-tag/blob/HEAD/CHANGELOG.md#​200-httpsgithubcomgoogleapisjsdoc-region-tagcomparev131v200-2022-05-20) [Compare Source](https://togithub.com/googleapis/jsdoc-region-tag/compare/v1.3.1...v2.0.0) ##### ⚠ BREAKING CHANGES - update library to use Node 12 ([#​107](https://togithub.com/googleapis/jsdoc-region-tag/issues/107)) ##### Build System - update library to use Node 12 ([#​107](https://togithub.com/googleapis/jsdoc-region-tag/issues/107)) ([5b51796](https://togithub.com/googleapis/jsdoc-region-tag/commit/5b51796771984cf8b978990025f14faa03c19923)) ##### [1.3.1](https://www.github.com/googleapis/jsdoc-region-tag/compare/v1.3.0...v1.3.1) (2021-08-11) ##### Bug Fixes - **build:** migrate to using main branch ([#​79](https://www.togithub.com/googleapis/jsdoc-region-tag/issues/79)) ([5050615](https://www.github.com/googleapis/jsdoc-region-tag/commit/50506150b7758592df5e389c6a5c3d82b3b20881))
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 4e554713c4b..af1f3a8829b 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -37,7 +37,7 @@ "gts": "^3.1.0", "jsdoc": "^3.5.5", "jsdoc-fresh": "^2.0.0", - "jsdoc-region-tag": "^1.0.2", + "jsdoc-region-tag": "^2.0.0", "linkinator": "^2.0.0", "mocha": "^9.2.2", "null-loader": "^4.0.0", From 041684ee6c1be672bdef376be7a4696046102e10 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 4 Jul 2022 14:55:08 -0400 Subject: [PATCH 151/169] feat: support regapic LRO PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 Source-Link: https://github.com/googleapis/googleapis/commit/ae65014049c6eb195741d7efbd0b10bee3f83d4f Source-Link: https://github.com/googleapis/googleapis-gen/commit/b09ede435cce110446d4ab9f62a081b571d37e3f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjA5ZWRlNDM1Y2NlMTEwNDQ2ZDRhYjlmNjJhMDgxYjU3MWQzN2UzZiJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../src/v1/cloud_billing_client.ts | 11 +++++------ .../src/v1/cloud_catalog_client.ts | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 7a2e26947d7..b4af8e72f2c 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -70,7 +70,7 @@ export class CloudBillingClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -93,11 +93,10 @@ export class CloudBillingClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index bb04f02c75d..ba0dba957e2 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -72,7 +72,7 @@ export class CloudCatalogClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -95,11 +95,10 @@ export class CloudCatalogClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. From 0674a5e7bfefbec77d4e45712f37c71373608bee Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 4 Jul 2022 15:05:45 -0400 Subject: [PATCH 152/169] chore(main): release 3.1.0 (#238) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 3.1.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-billing/CHANGELOG.md | 7 +++++++ packages/google-cloud-billing/package.json | 2 +- .../v1/snippet_metadata.google.cloud.billing.v1.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 5afca16c809..1ee3debe606 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [3.1.0](https://github.com/googleapis/nodejs-billing/compare/v3.0.0...v3.1.0) (2022-07-04) + + +### Features + +* support regapic LRO ([caf329e](https://github.com/googleapis/nodejs-billing/commit/caf329e7a9661a35a3b0600cc7bc0bdb983aa115)) + ## [3.0.0](https://github.com/googleapis/nodejs-billing/compare/v2.4.0...v3.0.0) (2022-05-20) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index af1f3a8829b..682e526e41b 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "3.0.0", + "version": "3.1.0", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json index 5ad759beeb7..5f8f76a5a38 100644 --- a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-billing", - "version": "3.0.0", + "version": "3.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index f12b30df3e0..1948c4b6b12 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^3.0.0" + "@google-cloud/billing": "^3.1.0" }, "devDependencies": { "c8": "^7.1.0", From 7b2b670b4c9d78bc582be31dd400b1a3bee41bde Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 8 Jul 2022 22:58:24 +0200 Subject: [PATCH 153/169] chore(deps): update dependency linkinator to v4 (#239) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [linkinator](https://togithub.com/JustinBeckwith/linkinator) | [`^2.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/linkinator/2.16.2/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/compatibility-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/confidence-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
JustinBeckwith/linkinator ### [`v4.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v4.0.0) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.1.0...v4.0.0) ##### Features - create new release with notes ([#​508](https://togithub.com/JustinBeckwith/linkinator/issues/508)) ([2cab633](https://togithub.com/JustinBeckwith/linkinator/commit/2cab633c9659eb10794a4bac06f8b0acdc3e2c0c)) ##### BREAKING CHANGES - The commits in [#​507](https://togithub.com/JustinBeckwith/linkinator/issues/507) and [#​506](https://togithub.com/JustinBeckwith/linkinator/issues/506) both had breaking changes. They included dropping support for Node.js 12.x and updating the CSV export to be streaming, and to use a new way of writing the CSV file. This is an empty to commit using the `BREAKING CHANGE` format in the commit message to ensure a release is triggered. ### [`v3.1.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.1.0) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.6...v3.1.0) ##### Features - allow --skip to be defined multiple times ([#​399](https://togithub.com/JustinBeckwith/linkinator/issues/399)) ([5ca5a46](https://togithub.com/JustinBeckwith/linkinator/commit/5ca5a461508e688de12e5ae6b4cfb6565f832ebf)) ### [`v3.0.6`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.6) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.5...v3.0.6) ##### Bug Fixes - **deps:** upgrade node-glob to v8 ([#​397](https://togithub.com/JustinBeckwith/linkinator/issues/397)) ([d334dc6](https://togithub.com/JustinBeckwith/linkinator/commit/d334dc6734cd7c2b73d7ed3dea0550a6c3072ad5)) ### [`v3.0.5`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.5) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.4...v3.0.5) ##### Bug Fixes - **deps:** upgrade to htmlparser2 v8.0.1 ([#​396](https://togithub.com/JustinBeckwith/linkinator/issues/396)) ([ba3b9a8](https://togithub.com/JustinBeckwith/linkinator/commit/ba3b9a8a9b19d39af6ed91790135e833b80c1eb6)) ### [`v3.0.4`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.4) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.3...v3.0.4) ##### Bug Fixes - **deps:** update dependency gaxios to v5 ([#​391](https://togithub.com/JustinBeckwith/linkinator/issues/391)) ([48af50e](https://togithub.com/JustinBeckwith/linkinator/commit/48af50e787731204aeb7eff41325c62291311e45)) ### [`v3.0.3`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.3) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.2...v3.0.3) ##### Bug Fixes - export getConfig from index ([#​371](https://togithub.com/JustinBeckwith/linkinator/issues/371)) ([0bc0355](https://togithub.com/JustinBeckwith/linkinator/commit/0bc0355c7e2ea457f247e6b52d1577b8c4ecb3a1)) ### [`v3.0.2`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.2) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.1...v3.0.2) ##### Bug Fixes - allow server root with trailing slash ([#​370](https://togithub.com/JustinBeckwith/linkinator/issues/370)) ([8adf6b0](https://togithub.com/JustinBeckwith/linkinator/commit/8adf6b025fda250e38461f1cdad40fe08c3b3b7c)) ### [`v3.0.1`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.1) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.0...v3.0.1) ##### Bug Fixes - decode path parts in local web server ([#​369](https://togithub.com/JustinBeckwith/linkinator/issues/369)) ([4696a0c](https://togithub.com/JustinBeckwith/linkinator/commit/4696a0c38c341b178ed815f47371fca955979feb)) ### [`v3.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.0) [Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v2.16.2...v3.0.0) ##### Bug Fixes - **deps:** update dependency chalk to v5 ([#​362](https://togithub.com/JustinBeckwith/linkinator/issues/362)) ([4b17a8d](https://togithub.com/JustinBeckwith/linkinator/commit/4b17a8d87b649eaf813428f8ee6955e1d21dae4f)) - feat!: convert to es modules, drop node 10 ([#​359](https://togithub.com/JustinBeckwith/linkinator/issues/359)) ([efee299](https://togithub.com/JustinBeckwith/linkinator/commit/efee299ab8a805accef751eecf8538915a4e7783)), closes [#​359](https://togithub.com/JustinBeckwith/linkinator/issues/359) ##### BREAKING CHANGES - this module now requires node.js 12 and above, and has moved to es modules by default.
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 682e526e41b..061cd907d7a 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -38,7 +38,7 @@ "jsdoc": "^3.5.5", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", - "linkinator": "^2.0.0", + "linkinator": "^4.0.0", "mocha": "^9.2.2", "null-loader": "^4.0.0", "pack-n-play": "^1.0.0-2", From 0a16b902a673184e132f3e358d6cd0eb23a2e8d7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 00:04:24 +0000 Subject: [PATCH 154/169] fix: better support for fallback mode (#240) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 468790263 Source-Link: https://github.com/googleapis/googleapis/commit/873ab456273d105245df0fb82a6c17a814553b80 Source-Link: https://github.com/googleapis/googleapis-gen/commit/cb6f37aeff2a3472e40a7bbace8c67d75e24bee5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I2ZjM3YWVmZjJhMzQ3MmU0MGE3YmJhY2U4YzY3ZDc1ZTI0YmVlNSJ9 --- .../cloud_billing.create_billing_account.js | 3 + .../v1/cloud_billing.get_billing_account.js | 3 + .../v1/cloud_billing.get_iam_policy.js | 3 + .../cloud_billing.get_project_billing_info.js | 3 + .../v1/cloud_billing.list_billing_accounts.js | 3 + ...cloud_billing.list_project_billing_info.js | 3 + .../v1/cloud_billing.set_iam_policy.js | 3 + .../v1/cloud_billing.test_iam_permissions.js | 3 + .../cloud_billing.update_billing_account.js | 3 + ...oud_billing.update_project_billing_info.js | 3 + .../v1/cloud_catalog.list_services.js | 3 + .../generated/v1/cloud_catalog.list_skus.js | 3 + ...ppet_metadata.google.cloud.billing.v1.json | 24 +-- .../src/v1/cloud_billing_client.ts | 12 +- .../src/v1/cloud_catalog_client.ts | 12 +- .../test/gapic_cloud_billing_v1.ts | 156 +++++++++--------- .../test/gapic_cloud_catalog_v1.ts | 156 +++++++++--------- 17 files changed, 218 insertions(+), 178 deletions(-) diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js index 219d3230931..5924f24b633 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js @@ -23,6 +23,9 @@ function main(billingAccount) { // [START cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js index fc835c34e12..8d420a0e1a5 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js index 23aee0ca567..df9f6c0a259 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js @@ -23,6 +23,9 @@ function main(resource) { // [START cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js index b8a9fcb4c41..1b9bd0c1604 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudbilling_v1_generated_CloudBilling_GetProjectBillingInfo_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js index 24238125419..916633c0352 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js @@ -23,6 +23,9 @@ function main() { // [START cloudbilling_v1_generated_CloudBilling_ListBillingAccounts_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js index e7b16d3c863..3ab054e3f1d 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudbilling_v1_generated_CloudBilling_ListProjectBillingInfo_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js index 600bf2d26bc..41fa9a179ef 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js @@ -23,6 +23,9 @@ function main(resource, policy) { // [START cloudbilling_v1_generated_CloudBilling_SetIamPolicy_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js index f3c3ea34f11..b1ffbd536e5 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js @@ -23,6 +23,9 @@ function main(resource, permissions) { // [START cloudbilling_v1_generated_CloudBilling_TestIamPermissions_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js index 8b24c9f78ca..c487c7c3d5c 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js @@ -23,6 +23,9 @@ function main(name, account) { // [START cloudbilling_v1_generated_CloudBilling_UpdateBillingAccount_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js index 69fe0a80ace..0168c7c8daa 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js @@ -23,6 +23,9 @@ function main(name) { // [START cloudbilling_v1_generated_CloudBilling_UpdateProjectBillingInfo_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js index 2a27e9dc98a..c21a6be3aeb 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js @@ -23,6 +23,9 @@ function main() { // [START cloudbilling_v1_generated_CloudCatalog_ListServices_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js index 3dd60ebae66..71decc1085d 100644 --- a/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js +++ b/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js @@ -23,6 +23,9 @@ function main(parent) { // [START cloudbilling_v1_generated_CloudCatalog_ListSkus_async] /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. * TODO(developer): Uncomment these variables before running the sample. */ /** diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json index 5f8f76a5a38..a48ac3486c3 100644 --- a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -62,7 +62,7 @@ "segments": [ { "start": 25, - "end": 67, + "end": 70, "type": "FULL" } ], @@ -110,7 +110,7 @@ "segments": [ { "start": 25, - "end": 60, + "end": 63, "type": "FULL" } ], @@ -158,7 +158,7 @@ "segments": [ { "start": 25, - "end": 53, + "end": 56, "type": "FULL" } ], @@ -198,7 +198,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 67, "type": "FULL" } ], @@ -246,7 +246,7 @@ "segments": [ { "start": 25, - "end": 51, + "end": 54, "type": "FULL" } ], @@ -286,7 +286,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -330,7 +330,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 59, "type": "FULL" } ], @@ -374,7 +374,7 @@ "segments": [ { "start": 25, - "end": 66, + "end": 69, "type": "FULL" } ], @@ -422,7 +422,7 @@ "segments": [ { "start": 25, - "end": 59, + "end": 62, "type": "FULL" } ], @@ -466,7 +466,7 @@ "segments": [ { "start": 25, - "end": 57, + "end": 60, "type": "FULL" } ], @@ -510,7 +510,7 @@ "segments": [ { "start": 25, - "end": 87, + "end": 90, "type": "FULL" } ], diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index b4af8e72f2c..e276adfb92b 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -28,7 +28,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -270,7 +269,8 @@ export class CloudBillingClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -1284,7 +1284,7 @@ export class CloudBillingClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listBillingAccounts.createStream( - this.innerApiCalls.listBillingAccounts as gax.GaxCall, + this.innerApiCalls.listBillingAccounts as GaxCall, request, callSettings ); @@ -1336,7 +1336,7 @@ export class CloudBillingClient { this.initialize(); return this.descriptors.page.listBillingAccounts.asyncIterate( this.innerApiCalls['listBillingAccounts'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -1492,7 +1492,7 @@ export class CloudBillingClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listProjectBillingInfo.createStream( - this.innerApiCalls.listProjectBillingInfo as gax.GaxCall, + this.innerApiCalls.listProjectBillingInfo as GaxCall, request, callSettings ); @@ -1544,7 +1544,7 @@ export class CloudBillingClient { this.initialize(); return this.descriptors.page.listProjectBillingInfo.asyncIterate( this.innerApiCalls['listProjectBillingInfo'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index ba0dba957e2..37ed0d8988e 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -28,7 +28,6 @@ import { } from 'google-gax'; import {Transform} from 'stream'; -import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -258,7 +257,8 @@ export class CloudCatalogClient { const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], - descriptor + descriptor, + this._opts.fallback ); this.innerApiCalls[methodName] = apiCall; @@ -444,7 +444,7 @@ export class CloudCatalogClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as gax.GaxCall, + this.innerApiCalls.listServices as GaxCall, request, callSettings ); @@ -488,7 +488,7 @@ export class CloudCatalogClient { this.initialize(); return this.descriptors.page.listServices.asyncIterate( this.innerApiCalls['listServices'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } @@ -663,7 +663,7 @@ export class CloudCatalogClient { const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listSkus.createStream( - this.innerApiCalls.listSkus as gax.GaxCall, + this.innerApiCalls.listSkus as GaxCall, request, callSettings ); @@ -732,7 +732,7 @@ export class CloudCatalogClient { this.initialize(); return this.descriptors.page.listSkus.asyncIterate( this.innerApiCalls['listSkus'] as GaxCall, - request as unknown as RequestType, + request as {}, callSettings ) as AsyncIterable; } diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index eeb6d8940da..0f5f17a6512 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -113,99 +113,101 @@ function stubAsyncIterationCall( } describe('v1.CloudBillingClient', () => { - it('has servicePath', () => { - const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudbillingModule.v1.CloudBillingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudbillingModule.v1.CloudBillingClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = cloudbillingModule.v1.CloudBillingClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = cloudbillingModule.v1.CloudBillingClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = cloudbillingModule.v1.CloudBillingClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.cloudBillingStub, undefined); - await client.initialize(); - assert(client.cloudBillingStub); - }); - it('has close method for the initialized client', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new cloudbillingModule.v1.CloudBillingClient(); + assert(client); }); - client.initialize(); - assert(client.cloudBillingStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBillingStub, undefined); + await client.initialize(); + assert(client.cloudBillingStub); }); - assert.strictEqual(client.cloudBillingStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudBillingStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudBillingStub, undefined); + client.close().then(() => { + done(); + }); }); - 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 cloudbillingModule.v1.CloudBillingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudbillingModule.v1.CloudBillingClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('getBillingAccount', () => { diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index 87c81aedd95..6ec421e4c31 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -113,99 +113,101 @@ function stubAsyncIterationCall( } describe('v1.CloudCatalogClient', () => { - it('has servicePath', () => { - const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = cloudcatalogModule.v1.CloudCatalogClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient(); - assert(client); - }); + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = cloudcatalogModule.v1.CloudCatalogClient.servicePath; + assert(servicePath); + }); - it('should create a client with gRPC fallback', () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - fallback: true, + it('has apiEndpoint', () => { + const apiEndpoint = cloudcatalogModule.v1.CloudCatalogClient.apiEndpoint; + assert(apiEndpoint); }); - assert(client); - }); - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has port', () => { + const port = cloudcatalogModule.v1.CloudCatalogClient.port; + assert(port); + assert(typeof port === 'number'); }); - assert.strictEqual(client.cloudCatalogStub, undefined); - await client.initialize(); - assert(client.cloudCatalogStub); - }); - it('has close method for the initialized client', done => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('should create a client with no option', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient(); + assert(client); }); - client.initialize(); - assert(client.cloudCatalogStub); - client.close().then(() => { - done(); + + it('should create a client with gRPC fallback', () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + fallback: true, + }); + assert(client); }); - }); - it('has close method for the non-initialized client', done => { - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudCatalogStub, undefined); + await client.initialize(); + assert(client.cloudCatalogStub); }); - assert.strictEqual(client.cloudCatalogStub, undefined); - client.close().then(() => { - done(); + + it('has close method for the initialized client', done => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.cloudCatalogStub); + client.close().then(() => { + done(); + }); }); - }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has close method for the non-initialized client', done => { + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudCatalogStub, undefined); + client.close().then(() => { + done(); + }); }); - 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 cloudcatalogModule.v1.CloudCatalogClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudcatalogModule.v1.CloudCatalogClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); }); describe('listServices', () => { From 97104f91c612b56399147d7e5bb063a59fa9be12 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 23 Aug 2022 07:40:33 +0000 Subject: [PATCH 155/169] fix: change import long to require (#241) Source-Link: https://github.com/googleapis/synthtool/commit/d229a1258999f599a90a9b674a1c5541e00db588 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:74ab2b3c71ef27e6d8b69b1d0a0c9d31447777b79ac3cd4be82c265b45f37e5e --- .../google-cloud-billing/protos/protos.d.ts | 765 +++- .../google-cloud-billing/protos/protos.js | 4006 ++++++++++++----- .../google-cloud-billing/protos/protos.json | 69 + 3 files changed, 3815 insertions(+), 1025 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index dd12d50db3f..691850a7677 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import * as Long from "long"; +import Long = require("long"); import {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { @@ -190,70 +190,70 @@ export namespace google { namespace CloudBilling { /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getBillingAccount}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|getBillingAccount}. * @param error Error, if any * @param [response] BillingAccount */ type GetBillingAccountCallback = (error: (Error|null), response?: google.cloud.billing.v1.BillingAccount) => void; /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#listBillingAccounts}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|listBillingAccounts}. * @param error Error, if any * @param [response] ListBillingAccountsResponse */ type ListBillingAccountsCallback = (error: (Error|null), response?: google.cloud.billing.v1.ListBillingAccountsResponse) => void; /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#updateBillingAccount}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|updateBillingAccount}. * @param error Error, if any * @param [response] BillingAccount */ type UpdateBillingAccountCallback = (error: (Error|null), response?: google.cloud.billing.v1.BillingAccount) => void; /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#createBillingAccount}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|createBillingAccount}. * @param error Error, if any * @param [response] BillingAccount */ type CreateBillingAccountCallback = (error: (Error|null), response?: google.cloud.billing.v1.BillingAccount) => void; /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#listProjectBillingInfo}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|listProjectBillingInfo}. * @param error Error, if any * @param [response] ListProjectBillingInfoResponse */ type ListProjectBillingInfoCallback = (error: (Error|null), response?: google.cloud.billing.v1.ListProjectBillingInfoResponse) => void; /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getProjectBillingInfo}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|getProjectBillingInfo}. * @param error Error, if any * @param [response] ProjectBillingInfo */ type GetProjectBillingInfoCallback = (error: (Error|null), response?: google.cloud.billing.v1.ProjectBillingInfo) => void; /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#updateProjectBillingInfo}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|updateProjectBillingInfo}. * @param error Error, if any * @param [response] ProjectBillingInfo */ type UpdateProjectBillingInfoCallback = (error: (Error|null), response?: google.cloud.billing.v1.ProjectBillingInfo) => void; /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getIamPolicy}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|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.billing.v1.CloudBilling#setIamPolicy}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|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.billing.v1.CloudBilling#testIamPermissions}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|testIamPermissions}. * @param error Error, if any * @param [response] TestIamPermissionsResponse */ @@ -366,6 +366,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BillingAccount + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ProjectBillingInfo. */ @@ -474,6 +481,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ProjectBillingInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetBillingAccountRequest. */ @@ -564,6 +578,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetBillingAccountRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListBillingAccountsRequest. */ @@ -666,6 +687,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBillingAccountsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListBillingAccountsResponse. */ @@ -762,6 +790,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBillingAccountsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CreateBillingAccountRequest. */ @@ -852,6 +887,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateBillingAccountRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateBillingAccountRequest. */ @@ -954,6 +996,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateBillingAccountRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProjectBillingInfoRequest. */ @@ -1056,6 +1105,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProjectBillingInfoRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListProjectBillingInfoResponse. */ @@ -1152,6 +1208,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListProjectBillingInfoResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetProjectBillingInfoRequest. */ @@ -1242,6 +1305,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetProjectBillingInfoRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an UpdateProjectBillingInfoRequest. */ @@ -1338,6 +1408,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateProjectBillingInfoRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Represents a CloudCatalog */ @@ -1392,14 +1469,14 @@ export namespace google { namespace CloudCatalog { /** - * Callback as used by {@link google.cloud.billing.v1.CloudCatalog#listServices}. + * Callback as used by {@link google.cloud.billing.v1.CloudCatalog|listServices}. * @param error Error, if any * @param [response] ListServicesResponse */ type ListServicesCallback = (error: (Error|null), response?: google.cloud.billing.v1.ListServicesResponse) => void; /** - * Callback as used by {@link google.cloud.billing.v1.CloudCatalog#listSkus}. + * Callback as used by {@link google.cloud.billing.v1.CloudCatalog|listSkus}. * @param error Error, if any * @param [response] ListSkusResponse */ @@ -1512,6 +1589,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Service + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Sku. */ @@ -1638,6 +1722,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Sku + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Category. */ @@ -1746,6 +1837,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Category + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PricingInfo. */ @@ -1860,6 +1958,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PricingInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a PricingExpression. */ @@ -1986,6 +2091,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PricingExpression + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace PricingExpression { @@ -2084,6 +2196,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TierRate + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -2187,6 +2306,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AggregationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace AggregationInfo { @@ -2300,6 +2426,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListServicesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListServicesResponse. */ @@ -2396,6 +2529,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListServicesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListSkusRequest. */ @@ -2516,6 +2656,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSkusRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ListSkusResponse. */ @@ -2612,6 +2759,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSkusResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } } @@ -2714,6 +2868,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Http + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a HttpRule. */ @@ -2861,6 +3022,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a CustomHttpPattern. */ @@ -2957,6 +3125,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomHttpPattern + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** FieldBehavior enum. */ @@ -3095,6 +3270,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace ResourceDescriptor { @@ -3207,6 +3389,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -3301,6 +3490,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FileDescriptorProto. */ @@ -3341,6 +3537,9 @@ export namespace google { /** FileDescriptorProto syntax */ syntax?: (string|null); + + /** FileDescriptorProto edition */ + edition?: (string|null); } /** Represents a FileDescriptorProto. */ @@ -3388,6 +3587,9 @@ export namespace google { /** FileDescriptorProto syntax. */ public syntax: string; + /** FileDescriptorProto edition. */ + public edition: string; + /** * Creates a new FileDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -3457,6 +3659,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a DescriptorProto. */ @@ -3601,6 +3810,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace DescriptorProto { @@ -3705,6 +3921,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ReservedRange. */ @@ -3801,6 +4024,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -3892,6 +4122,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FieldDescriptorProto. */ @@ -4042,6 +4279,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FieldDescriptorProto { @@ -4170,6 +4414,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumDescriptorProto. */ @@ -4284,6 +4535,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace EnumDescriptorProto { @@ -4382,6 +4640,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -4485,6 +4750,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceDescriptorProto. */ @@ -4587,6 +4859,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MethodDescriptorProto. */ @@ -4707,6 +4986,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FileOptions. */ @@ -4920,6 +5206,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FileOptions { @@ -5047,6 +5340,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a FieldOptions. */ @@ -5064,6 +5364,9 @@ export namespace google { /** FieldOptions lazy */ lazy?: (boolean|null); + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + /** FieldOptions deprecated */ deprecated?: (boolean|null); @@ -5101,6 +5404,9 @@ export namespace google { /** FieldOptions lazy. */ public lazy: boolean; + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + /** FieldOptions deprecated. */ public deprecated: boolean; @@ -5179,6 +5485,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace FieldOptions { @@ -5286,6 +5599,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumOptions. */ @@ -5388,6 +5708,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of an EnumValueOptions. */ @@ -5484,6 +5811,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a ServiceOptions. */ @@ -5586,6 +5920,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a MethodOptions. */ @@ -5694,6 +6035,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace MethodOptions { @@ -5830,6 +6178,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UninterpretedOption + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace UninterpretedOption { @@ -5928,6 +6283,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NamePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -6019,6 +6381,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace SourceCodeInfo { @@ -6135,6 +6504,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Location + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -6226,6 +6602,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace GeneratedCodeInfo { @@ -6244,6 +6627,9 @@ export namespace google { /** Annotation end */ end?: (number|null); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); } /** Represents an Annotation. */ @@ -6267,6 +6653,9 @@ export namespace google { /** Annotation end. */ public end: number; + /** Annotation semantic. */ + public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); + /** * Creates a new Annotation instance using the specified properties. * @param [properties] Properties to set @@ -6336,6 +6725,23 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Annotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Annotation { + + /** Semantic enum. */ + enum Semantic { + NONE = 0, + SET = 1, + ALIAS = 2 + } } } @@ -6427,6 +6833,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Timestamp. */ @@ -6523,6 +6936,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Timestamp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } @@ -6598,21 +7018,21 @@ export namespace google { namespace IAMPolicy { /** - * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|setIamPolicy}. * @param error Error, if any * @param [response] Policy */ type SetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|getIamPolicy}. * @param error Error, if any * @param [response] Policy */ type GetIamPolicyCallback = (error: (Error|null), response?: google.iam.v1.Policy) => void; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * Callback as used by {@link google.iam.v1.IAMPolicy|testIamPermissions}. * @param error Error, if any * @param [response] TestIamPermissionsResponse */ @@ -6627,6 +7047,9 @@ export namespace google { /** SetIamPolicyRequest policy */ policy?: (google.iam.v1.IPolicy|null); + + /** SetIamPolicyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); } /** Represents a SetIamPolicyRequest. */ @@ -6644,6 +7067,9 @@ export namespace google { /** SetIamPolicyRequest policy. */ public policy?: (google.iam.v1.IPolicy|null); + /** SetIamPolicyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + /** * Creates a new SetIamPolicyRequest instance using the specified properties. * @param [properties] Properties to set @@ -6713,6 +7139,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetIamPolicyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetIamPolicyRequest. */ @@ -6809,6 +7242,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetIamPolicyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TestIamPermissionsRequest. */ @@ -6905,6 +7345,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TestIamPermissionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a TestIamPermissionsResponse. */ @@ -6995,6 +7442,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TestIamPermissionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a GetPolicyOptions. */ @@ -7085,6 +7539,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetPolicyOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Policy. */ @@ -7096,6 +7557,9 @@ export namespace google { /** Policy bindings */ bindings?: (google.iam.v1.IBinding[]|null); + /** Policy auditConfigs */ + auditConfigs?: (google.iam.v1.IAuditConfig[]|null); + /** Policy etag */ etag?: (Uint8Array|string|null); } @@ -7115,6 +7579,9 @@ export namespace google { /** Policy bindings. */ public bindings: google.iam.v1.IBinding[]; + /** Policy auditConfigs. */ + public auditConfigs: google.iam.v1.IAuditConfig[]; + /** Policy etag. */ public etag: (Uint8Array|string); @@ -7187,6 +7654,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Policy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Binding. */ @@ -7289,6 +7763,230 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Binding + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AuditConfig. */ + interface IAuditConfig { + + /** AuditConfig service */ + service?: (string|null); + + /** AuditConfig auditLogConfigs */ + auditLogConfigs?: (google.iam.v1.IAuditLogConfig[]|null); + } + + /** Represents an AuditConfig. */ + class AuditConfig implements IAuditConfig { + + /** + * Constructs a new AuditConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IAuditConfig); + + /** AuditConfig service. */ + public service: string; + + /** AuditConfig auditLogConfigs. */ + public auditLogConfigs: google.iam.v1.IAuditLogConfig[]; + + /** + * Creates a new AuditConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AuditConfig instance + */ + public static create(properties?: google.iam.v1.IAuditConfig): google.iam.v1.AuditConfig; + + /** + * Encodes the specified AuditConfig message. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @param message AuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AuditConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. + * @param message AuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AuditConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.AuditConfig; + + /** + * Decodes an AuditConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.AuditConfig; + + /** + * Verifies an AuditConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AuditConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AuditConfig + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.AuditConfig; + + /** + * Creates a plain object from an AuditConfig message. Also converts values to other types if specified. + * @param message AuditConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.AuditConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AuditConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AuditConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AuditLogConfig. */ + interface IAuditLogConfig { + + /** AuditLogConfig logType */ + logType?: (google.iam.v1.AuditLogConfig.LogType|keyof typeof google.iam.v1.AuditLogConfig.LogType|null); + + /** AuditLogConfig exemptedMembers */ + exemptedMembers?: (string[]|null); + } + + /** Represents an AuditLogConfig. */ + class AuditLogConfig implements IAuditLogConfig { + + /** + * Constructs a new AuditLogConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.iam.v1.IAuditLogConfig); + + /** AuditLogConfig logType. */ + public logType: (google.iam.v1.AuditLogConfig.LogType|keyof typeof google.iam.v1.AuditLogConfig.LogType); + + /** AuditLogConfig exemptedMembers. */ + public exemptedMembers: string[]; + + /** + * Creates a new AuditLogConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AuditLogConfig instance + */ + public static create(properties?: google.iam.v1.IAuditLogConfig): google.iam.v1.AuditLogConfig; + + /** + * Encodes the specified AuditLogConfig message. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @param message AuditLogConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.iam.v1.IAuditLogConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AuditLogConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @param message AuditLogConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.iam.v1.IAuditLogConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.iam.v1.AuditLogConfig; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.iam.v1.AuditLogConfig; + + /** + * Verifies an AuditLogConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AuditLogConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AuditLogConfig + */ + public static fromObject(object: { [k: string]: any }): google.iam.v1.AuditLogConfig; + + /** + * Creates a plain object from an AuditLogConfig message. Also converts values to other types if specified. + * @param message AuditLogConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.iam.v1.AuditLogConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AuditLogConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AuditLogConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AuditLogConfig { + + /** LogType enum. */ + enum LogType { + LOG_TYPE_UNSPECIFIED = 0, + ADMIN_READ = 1, + DATA_WRITE = 2, + DATA_READ = 3 + } } /** Properties of a PolicyDelta. */ @@ -7385,6 +8083,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PolicyDelta + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a BindingDelta. */ @@ -7493,6 +8198,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BindingDelta + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace BindingDelta { @@ -7611,6 +8323,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AuditConfigDelta + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } namespace AuditConfigDelta { @@ -7734,6 +8453,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Expr + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } /** Properties of a Money. */ @@ -7836,6 +8562,13 @@ export namespace google { * @returns JSON object */ public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Money + * @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-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index f8475ef12ab..89103e8759f 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -99,7 +99,7 @@ }; /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getBillingAccount}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|getBillingAccount}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef GetBillingAccountCallback * @type {function} @@ -132,7 +132,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#listBillingAccounts}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|listBillingAccounts}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef ListBillingAccountsCallback * @type {function} @@ -165,7 +165,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#updateBillingAccount}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|updateBillingAccount}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef UpdateBillingAccountCallback * @type {function} @@ -198,7 +198,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#createBillingAccount}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|createBillingAccount}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef CreateBillingAccountCallback * @type {function} @@ -231,7 +231,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#listProjectBillingInfo}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|listProjectBillingInfo}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef ListProjectBillingInfoCallback * @type {function} @@ -264,7 +264,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getProjectBillingInfo}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|getProjectBillingInfo}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef GetProjectBillingInfoCallback * @type {function} @@ -297,7 +297,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#updateProjectBillingInfo}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|updateProjectBillingInfo}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef UpdateProjectBillingInfoCallback * @type {function} @@ -330,7 +330,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#getIamPolicy}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|getIamPolicy}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef GetIamPolicyCallback * @type {function} @@ -363,7 +363,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#setIamPolicy}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|setIamPolicy}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef SetIamPolicyCallback * @type {function} @@ -396,7 +396,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudBilling#testIamPermissions}. + * Callback as used by {@link google.cloud.billing.v1.CloudBilling|testIamPermissions}. * @memberof google.cloud.billing.v1.CloudBilling * @typedef TestIamPermissionsCallback * @type {function} @@ -556,18 +556,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.open = reader.bool(); - break; - case 3: - message.displayName = reader.string(); - break; - case 4: - message.masterBillingAccount = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.open = reader.bool(); + break; + } + case 3: { + message.displayName = reader.string(); + break; + } + case 4: { + message.masterBillingAccount = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -682,6 +686,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BillingAccount + * @function getTypeUrl + * @memberof google.cloud.billing.v1.BillingAccount + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BillingAccount.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.BillingAccount"; + }; + return BillingAccount; })(); @@ -810,18 +829,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.projectId = reader.string(); - break; - case 3: - message.billingAccountName = reader.string(); - break; - case 4: - message.billingEnabled = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.projectId = reader.string(); + break; + } + case 3: { + message.billingAccountName = reader.string(); + break; + } + case 4: { + message.billingEnabled = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -936,6 +959,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ProjectBillingInfo + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ProjectBillingInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ProjectBillingInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ProjectBillingInfo"; + }; + return ProjectBillingInfo; })(); @@ -1031,9 +1069,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -1123,6 +1162,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetBillingAccountRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.GetBillingAccountRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetBillingAccountRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.GetBillingAccountRequest"; + }; + return GetBillingAccountRequest; })(); @@ -1240,15 +1294,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageSize = reader.int32(); - break; - case 2: - message.pageToken = reader.string(); - break; - case 3: - message.filter = reader.string(); - break; + case 1: { + message.pageSize = reader.int32(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } + case 3: { + message.filter = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -1355,6 +1412,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListBillingAccountsRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ListBillingAccountsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBillingAccountsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ListBillingAccountsRequest"; + }; + return ListBillingAccountsRequest; })(); @@ -1463,14 +1535,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.billingAccounts && message.billingAccounts.length)) - message.billingAccounts = []; - message.billingAccounts.push($root.google.cloud.billing.v1.BillingAccount.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.billingAccounts && message.billingAccounts.length)) + message.billingAccounts = []; + message.billingAccounts.push($root.google.cloud.billing.v1.BillingAccount.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -1586,6 +1660,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListBillingAccountsResponse + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ListBillingAccountsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBillingAccountsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ListBillingAccountsResponse"; + }; + return ListBillingAccountsResponse; })(); @@ -1681,9 +1770,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.billingAccount = $root.google.cloud.billing.v1.BillingAccount.decode(reader, reader.uint32()); - break; + case 1: { + message.billingAccount = $root.google.cloud.billing.v1.BillingAccount.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -1778,6 +1868,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CreateBillingAccountRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.CreateBillingAccountRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateBillingAccountRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.CreateBillingAccountRequest"; + }; + return CreateBillingAccountRequest; })(); @@ -1895,15 +2000,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.account = $root.google.cloud.billing.v1.BillingAccount.decode(reader, reader.uint32()); - break; - case 3: - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.account = $root.google.cloud.billing.v1.BillingAccount.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -2020,6 +2128,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateBillingAccountRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.UpdateBillingAccountRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateBillingAccountRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.UpdateBillingAccountRequest"; + }; + return UpdateBillingAccountRequest; })(); @@ -2137,15 +2260,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - case 3: - message.pageToken = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -2252,6 +2378,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProjectBillingInfoRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ListProjectBillingInfoRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProjectBillingInfoRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ListProjectBillingInfoRequest"; + }; + return ListProjectBillingInfoRequest; })(); @@ -2360,14 +2501,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.projectBillingInfo && message.projectBillingInfo.length)) - message.projectBillingInfo = []; - message.projectBillingInfo.push($root.google.cloud.billing.v1.ProjectBillingInfo.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.projectBillingInfo && message.projectBillingInfo.length)) + message.projectBillingInfo = []; + message.projectBillingInfo.push($root.google.cloud.billing.v1.ProjectBillingInfo.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -2483,6 +2626,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListProjectBillingInfoResponse + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ListProjectBillingInfoResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListProjectBillingInfoResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ListProjectBillingInfoResponse"; + }; + return ListProjectBillingInfoResponse; })(); @@ -2578,9 +2736,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -2670,6 +2829,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetProjectBillingInfoRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.GetProjectBillingInfoRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetProjectBillingInfoRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.GetProjectBillingInfoRequest"; + }; + return GetProjectBillingInfoRequest; })(); @@ -2776,12 +2950,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.projectBillingInfo = $root.google.cloud.billing.v1.ProjectBillingInfo.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.projectBillingInfo = $root.google.cloud.billing.v1.ProjectBillingInfo.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -2885,6 +3061,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UpdateProjectBillingInfoRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.UpdateProjectBillingInfoRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateProjectBillingInfoRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.UpdateProjectBillingInfoRequest"; + }; + return UpdateProjectBillingInfoRequest; })(); @@ -2921,7 +3112,7 @@ }; /** - * Callback as used by {@link google.cloud.billing.v1.CloudCatalog#listServices}. + * Callback as used by {@link google.cloud.billing.v1.CloudCatalog|listServices}. * @memberof google.cloud.billing.v1.CloudCatalog * @typedef ListServicesCallback * @type {function} @@ -2954,7 +3145,7 @@ */ /** - * Callback as used by {@link google.cloud.billing.v1.CloudCatalog#listSkus}. + * Callback as used by {@link google.cloud.billing.v1.CloudCatalog|listSkus}. * @memberof google.cloud.billing.v1.CloudCatalog * @typedef ListSkusCallback * @type {function} @@ -3114,18 +3305,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.serviceId = reader.string(); - break; - case 3: - message.displayName = reader.string(); - break; - case 4: - message.businessEntityName = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.serviceId = reader.string(); + break; + } + case 3: { + message.displayName = reader.string(); + break; + } + case 4: { + message.businessEntityName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -3240,6 +3435,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Service + * @function getTypeUrl + * @memberof google.cloud.billing.v1.Service + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Service.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.Service"; + }; + return Service; })(); @@ -3405,31 +3615,38 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.skuId = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.category = $root.google.cloud.billing.v1.Category.decode(reader, reader.uint32()); - break; - case 5: - if (!(message.serviceRegions && message.serviceRegions.length)) - message.serviceRegions = []; - message.serviceRegions.push(reader.string()); - break; - case 6: - if (!(message.pricingInfo && message.pricingInfo.length)) - message.pricingInfo = []; - message.pricingInfo.push($root.google.cloud.billing.v1.PricingInfo.decode(reader, reader.uint32())); - break; - case 7: - message.serviceProviderName = reader.string(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.skuId = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.category = $root.google.cloud.billing.v1.Category.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.serviceRegions && message.serviceRegions.length)) + message.serviceRegions = []; + message.serviceRegions.push(reader.string()); + break; + } + case 6: { + if (!(message.pricingInfo && message.pricingInfo.length)) + message.pricingInfo = []; + message.pricingInfo.push($root.google.cloud.billing.v1.PricingInfo.decode(reader, reader.uint32())); + break; + } + case 7: { + message.serviceProviderName = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -3604,6 +3821,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Sku + * @function getTypeUrl + * @memberof google.cloud.billing.v1.Sku + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Sku.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.Sku"; + }; + return Sku; })(); @@ -3732,18 +3964,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.serviceDisplayName = reader.string(); - break; - case 2: - message.resourceFamily = reader.string(); - break; - case 3: - message.resourceGroup = reader.string(); - break; - case 4: - message.usageType = reader.string(); - break; + case 1: { + message.serviceDisplayName = reader.string(); + break; + } + case 2: { + message.resourceFamily = reader.string(); + break; + } + case 3: { + message.resourceGroup = reader.string(); + break; + } + case 4: { + message.usageType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -3858,6 +4094,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Category + * @function getTypeUrl + * @memberof google.cloud.billing.v1.Category + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Category.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.Category"; + }; + return Category; })(); @@ -3997,23 +4248,28 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.effectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 2: - message.summary = reader.string(); - break; - case 3: - message.pricingExpression = $root.google.cloud.billing.v1.PricingExpression.decode(reader, reader.uint32()); - break; - case 4: - message.aggregationInfo = $root.google.cloud.billing.v1.AggregationInfo.decode(reader, reader.uint32()); - break; - case 5: - message.currencyConversionRate = reader.double(); - break; - default: - reader.skipType(tag & 7); + case 1: { + message.effectiveTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.summary = reader.string(); + break; + } + case 3: { + message.pricingExpression = $root.google.cloud.billing.v1.PricingExpression.decode(reader, reader.uint32()); + break; + } + case 4: { + message.aggregationInfo = $root.google.cloud.billing.v1.AggregationInfo.decode(reader, reader.uint32()); + break; + } + case 5: { + message.currencyConversionRate = reader.double(); + break; + } + default: + reader.skipType(tag & 7); break; } } @@ -4149,6 +4405,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PricingInfo + * @function getTypeUrl + * @memberof google.cloud.billing.v1.PricingInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PricingInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.PricingInfo"; + }; + return PricingInfo; })(); @@ -4312,29 +4583,36 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.usageUnit = reader.string(); - break; - case 4: - message.usageUnitDescription = reader.string(); - break; - case 5: - message.baseUnit = reader.string(); - break; - case 6: - message.baseUnitDescription = reader.string(); - break; - case 7: - message.baseUnitConversionFactor = reader.double(); - break; - case 2: - message.displayQuantity = reader.double(); - break; - case 3: - if (!(message.tieredRates && message.tieredRates.length)) - message.tieredRates = []; - message.tieredRates.push($root.google.cloud.billing.v1.PricingExpression.TierRate.decode(reader, reader.uint32())); - break; + case 1: { + message.usageUnit = reader.string(); + break; + } + case 4: { + message.usageUnitDescription = reader.string(); + break; + } + case 5: { + message.baseUnit = reader.string(); + break; + } + case 6: { + message.baseUnitDescription = reader.string(); + break; + } + case 7: { + message.baseUnitConversionFactor = reader.double(); + break; + } + case 2: { + message.displayQuantity = reader.double(); + break; + } + case 3: { + if (!(message.tieredRates && message.tieredRates.length)) + message.tieredRates = []; + message.tieredRates.push($root.google.cloud.billing.v1.PricingExpression.TierRate.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -4491,6 +4769,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PricingExpression + * @function getTypeUrl + * @memberof google.cloud.billing.v1.PricingExpression + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PricingExpression.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.PricingExpression"; + }; + PricingExpression.TierRate = (function() { /** @@ -4594,12 +4887,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.startUsageAmount = reader.double(); - break; - case 2: - message.unitPrice = $root.google.type.Money.decode(reader, reader.uint32()); - break; + case 1: { + message.startUsageAmount = reader.double(); + break; + } + case 2: { + message.unitPrice = $root.google.type.Money.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -4703,6 +4998,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TierRate + * @function getTypeUrl + * @memberof google.cloud.billing.v1.PricingExpression.TierRate + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TierRate.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.PricingExpression.TierRate"; + }; + return TierRate; })(); @@ -4823,15 +5133,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.aggregationLevel = reader.int32(); - break; - case 2: - message.aggregationInterval = reader.int32(); - break; - case 3: - message.aggregationCount = reader.int32(); - break; + case 1: { + message.aggregationLevel = reader.int32(); + break; + } + case 2: { + message.aggregationInterval = reader.int32(); + break; + } + case 3: { + message.aggregationCount = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -4974,6 +5287,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AggregationInfo + * @function getTypeUrl + * @memberof google.cloud.billing.v1.AggregationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AggregationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.AggregationInfo"; + }; + /** * AggregationLevel enum. * @name google.cloud.billing.v1.AggregationInfo.AggregationLevel @@ -5112,12 +5440,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.pageSize = reader.int32(); - break; - case 2: - message.pageToken = reader.string(); - break; + case 1: { + message.pageSize = reader.int32(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -5216,6 +5546,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListServicesRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ListServicesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServicesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ListServicesRequest"; + }; + return ListServicesRequest; })(); @@ -5324,14 +5669,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.services && message.services.length)) - message.services = []; - message.services.push($root.google.cloud.billing.v1.Service.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.services && message.services.length)) + message.services = []; + message.services.push($root.google.cloud.billing.v1.Service.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -5447,6 +5794,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListServicesResponse + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ListServicesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServicesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ListServicesResponse"; + }; + return ListServicesResponse; })(); @@ -5597,24 +5959,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.parent = reader.string(); - break; - case 2: - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 3: - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 4: - message.currencyCode = reader.string(); - break; - case 5: - message.pageSize = reader.int32(); - break; - case 6: - message.pageToken = reader.string(); - break; + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.currencyCode = reader.string(); + break; + } + case 5: { + message.pageSize = reader.int32(); + break; + } + case 6: { + message.pageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -5755,6 +6123,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListSkusRequest + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ListSkusRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSkusRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ListSkusRequest"; + }; + return ListSkusRequest; })(); @@ -5863,14 +6246,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.skus && message.skus.length)) - message.skus = []; - message.skus.push($root.google.cloud.billing.v1.Sku.decode(reader, reader.uint32())); - break; - case 2: - message.nextPageToken = reader.string(); - break; + case 1: { + if (!(message.skus && message.skus.length)) + message.skus = []; + message.skus.push($root.google.cloud.billing.v1.Sku.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -5986,6 +6371,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ListSkusResponse + * @function getTypeUrl + * @memberof google.cloud.billing.v1.ListSkusResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSkusResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.billing.v1.ListSkusResponse"; + }; + return ListSkusResponse; })(); @@ -6112,14 +6512,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - case 2: - message.fullyDecodeReservedExpansion = reader.bool(); - break; + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -6235,6 +6637,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Http + * @function getTypeUrl + * @memberof google.api.Http + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Http"; + }; + return Http; })(); @@ -6445,38 +6862,48 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.selector = reader.string(); - break; - case 2: - message.get = reader.string(); - break; - case 3: - message.put = reader.string(); - break; - case 4: - message.post = reader.string(); - break; - case 5: - message["delete"] = reader.string(); - break; - case 6: - message.patch = reader.string(); - break; - case 8: - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - case 7: - message.body = reader.string(); - break; - case 12: - message.responseBody = reader.string(); - break; - case 11: - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -6698,6 +7125,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HttpRule + * @function getTypeUrl + * @memberof google.api.HttpRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpRule"; + }; + return HttpRule; })(); @@ -6804,12 +7246,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.kind = reader.string(); - break; - case 2: - message.path = reader.string(); - break; + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -6908,6 +7352,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CustomHttpPattern"; + }; + return CustomHttpPattern; })(); @@ -7102,37 +7561,44 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - if (!(message.pattern && message.pattern.length)) - message.pattern = []; - message.pattern.push(reader.string()); - break; - case 3: - message.nameField = reader.string(); - break; - case 4: - message.history = reader.int32(); - break; - case 5: - message.plural = reader.string(); - break; - case 6: - message.singular = reader.string(); - break; - case 10: - if (!(message.style && message.style.length)) - message.style = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else message.style.push(reader.int32()); - } else - message.style.push(reader.int32()); - break; - default: + break; + } + default: reader.skipType(tag & 7); break; } @@ -7329,6 +7795,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + /** * History enum. * @name google.api.ResourceDescriptor.History @@ -7465,12 +7946,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.type = reader.string(); - break; - case 2: - message.childType = reader.string(); - break; + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -7569,6 +8052,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + return ResourceReference; })(); @@ -7678,11 +8176,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.file && message.file.length)) - message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -7789,6 +8288,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + return FileDescriptorSet; })(); @@ -7810,6 +8324,7 @@ * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {string|null} [edition] FileDescriptorProto edition */ /** @@ -7930,6 +8445,14 @@ */ FileDescriptorProto.prototype.syntax = ""; + /** + * FileDescriptorProto edition. + * @member {string} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = ""; + /** * Creates a new FileDescriptorProto instance using the specified properties. * @function create @@ -7985,6 +8508,8 @@ writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); return writer; }; @@ -8019,66 +8544,82 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message["package"] = reader.string(); - break; - case 3: - if (!(message.dependency && message.dependency.length)) - message.dependency = []; - message.dependency.push(reader.string()); - break; - case 10: - if (!(message.publicDependency && message.publicDependency.length)) - message.publicDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else message.publicDependency.push(reader.int32()); - } else - message.publicDependency.push(reader.int32()); - break; - case 11: - if (!(message.weakDependency && message.weakDependency.length)) - message.weakDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else message.weakDependency.push(reader.int32()); - } else - message.weakDependency.push(reader.int32()); - break; - case 4: - if (!(message.messageType && message.messageType.length)) - message.messageType = []; - message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.service && message.service.length)) - message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); - break; - case 7: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 8: - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); - break; - case 9: - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); - break; - case 12: - message.syntax = reader.string(); - break; + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 13: { + message.edition = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -8190,6 +8731,9 @@ if (message.syntax != null && message.hasOwnProperty("syntax")) if (!$util.isString(message.syntax)) return "syntax: string expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + if (!$util.isString(message.edition)) + return "edition: string expected"; return null; }; @@ -8282,6 +8826,8 @@ } if (object.syntax != null) message.syntax = String(object.syntax); + if (object.edition != null) + message.edition = String(object.edition); return message; }; @@ -8313,6 +8859,7 @@ object.options = null; object.sourceCodeInfo = null; object.syntax = ""; + object.edition = ""; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -8359,6 +8906,8 @@ } if (message.syntax != null && message.hasOwnProperty("syntax")) object.syntax = message.syntax; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = message.edition; return object; }; @@ -8373,6 +8922,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + return FileDescriptorProto; })(); @@ -8583,52 +9147,62 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.field && message.field.length)) - message.field = []; - message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.nestedType && message.nestedType.length)) - message.nestedType = []; - message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.extensionRange && message.extensionRange.length)) - message.extensionRange = []; - message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); - break; - case 8: - if (!(message.oneofDecl && message.oneofDecl.length)) - message.oneofDecl = []; - message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); - break; - case 7: - message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); - break; - case 9: - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); - break; - case 10: - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -8929,6 +9503,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + DescriptorProto.ExtensionRange = (function() { /** @@ -9043,15 +9632,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; - case 3: - message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -9163,6 +9755,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + return ExtensionRange; })(); @@ -9269,12 +9876,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -9373,6 +9982,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + return ReservedRange; })(); @@ -9473,11 +10097,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -9584,6 +10209,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + return ExtensionRangeOptions; })(); @@ -9789,39 +10429,50 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 3: - message.number = reader.int32(); - break; - case 4: - message.label = reader.int32(); - break; - case 5: - message.type = reader.int32(); - break; - case 6: - message.typeName = reader.string(); - break; - case 2: - message.extendee = reader.string(); - break; - case 7: - message.defaultValue = reader.string(); - break; - case 9: - message.oneofIndex = reader.int32(); - break; - case 10: - message.jsonName = reader.string(); - break; - case 8: - message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); - break; - case 17: - message.proto3Optional = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -10108,6 +10759,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + /** * Type enum. * @name google.protobuf.FieldDescriptorProto.Type @@ -10276,12 +10942,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -10385,6 +11053,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + return OneofDescriptorProto; })(); @@ -10530,27 +11213,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.value && message.value.length)) - message.value = []; - message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -10726,6 +11414,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + EnumDescriptorProto.EnumReservedRange = (function() { /** @@ -10829,12 +11532,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.start = reader.int32(); - break; - case 2: - message.end = reader.int32(); - break; + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -10933,6 +11638,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + return EnumReservedRange; })(); @@ -11053,15 +11773,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.number = reader.int32(); - break; - case 3: - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -11173,6 +11896,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + return EnumValueDescriptorProto; })(); @@ -11292,17 +12030,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - if (!(message.method && message.method.length)) - message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); - break; - case 3: - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -11432,6 +12173,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + return ServiceDescriptorProto; })(); @@ -11582,24 +12338,30 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.inputType = reader.string(); - break; - case 3: - message.outputType = reader.string(); - break; - case 4: - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); - break; - case 5: - message.clientStreaming = reader.bool(); - break; - case 6: - message.serverStreaming = reader.bool(); - break; + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -11735,6 +12497,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + return MethodDescriptorProto; })(); @@ -12065,76 +12842,98 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.javaPackage = reader.string(); - break; - case 8: - message.javaOuterClassname = reader.string(); - break; - case 10: - message.javaMultipleFiles = reader.bool(); - break; - case 20: - message.javaGenerateEqualsAndHash = reader.bool(); - break; - case 27: - message.javaStringCheckUtf8 = reader.bool(); - break; - case 9: - message.optimizeFor = reader.int32(); - break; - case 11: - message.goPackage = reader.string(); - break; - case 16: - message.ccGenericServices = reader.bool(); - break; - case 17: - message.javaGenericServices = reader.bool(); - break; - case 18: - message.pyGenericServices = reader.bool(); - break; - case 42: - message.phpGenericServices = reader.bool(); - break; - case 23: - message.deprecated = reader.bool(); - break; - case 31: - message.ccEnableArenas = reader.bool(); - break; - case 36: - message.objcClassPrefix = reader.string(); - break; - case 37: - message.csharpNamespace = reader.string(); - break; - case 39: - message.swiftPrefix = reader.string(); - break; - case 40: - message.phpClassPrefix = reader.string(); - break; - case 41: - message.phpNamespace = reader.string(); - break; - case 44: - message.phpMetadataNamespace = reader.string(); - break; - case 45: - message.rubyPackage = reader.string(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1053: - if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) - message[".google.api.resourceDefinition"] = []; - message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); - break; + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 42: { + message.phpGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -12447,6 +13246,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; + /** * OptimizeMode enum. * @name google.protobuf.FileOptions.OptimizeMode @@ -12615,26 +13429,32 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.messageSetWireFormat = reader.bool(); - break; - case 2: - message.noStandardDescriptorAccessor = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 7: - message.mapEntry = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1053: - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); - break; + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12788,6 +13608,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + return MessageOptions; })(); @@ -12801,6 +13636,7 @@ * @property {boolean|null} [packed] FieldOptions packed * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy * @property {boolean|null} [deprecated] FieldOptions deprecated * @property {boolean|null} [weak] FieldOptions weak * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption @@ -12857,6 +13693,14 @@ */ FieldOptions.prototype.lazy = false; + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + /** * FieldOptions deprecated. * @member {boolean} deprecated @@ -12933,6 +13777,8 @@ writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -12978,49 +13824,62 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ctype = reader.int32(); - break; - case 2: - message.packed = reader.bool(); - break; - case 6: - message.jstype = reader.int32(); - break; - case 5: - message.lazy = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 10: - message.weak = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1052: - if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) - message[".google.api.fieldBehavior"] = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message[".google.api.fieldBehavior"].push(reader.int32()); - } else - message[".google.api.fieldBehavior"].push(reader.int32()); - break; - case 1055: - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + 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. @@ -13073,6 +13932,9 @@ if (message.lazy != null && message.hasOwnProperty("lazy")) if (typeof message.lazy !== "boolean") return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; if (message.deprecated != null && message.hasOwnProperty("deprecated")) if (typeof message.deprecated !== "boolean") return "deprecated: boolean expected"; @@ -13158,6 +14020,8 @@ } if (object.lazy != null) message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); if (object.weak != null) @@ -13245,6 +14109,7 @@ object.lazy = false; object.jstype = options.enums === String ? "JS_NORMAL" : 0; object.weak = false; + object.unverifiedLazy = false; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -13259,6 +14124,8 @@ object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; if (message.weak != null && message.hasOwnProperty("weak")) object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -13285,6 +14152,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for FieldOptions + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions"; + }; + /** * CType enum. * @name google.protobuf.FieldOptions.CType @@ -13414,11 +14296,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -13525,6 +14408,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + return OneofOptions; })(); @@ -13644,17 +14542,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.allowAlias = reader.bool(); - break; - case 3: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -13779,6 +14680,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumOptions"; + }; + return EnumOptions; })(); @@ -13887,14 +14803,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; + case 1: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -14010,6 +14928,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for EnumValueOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + }; + return EnumValueOptions; })(); @@ -14140,20 +15073,24 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 33: - message.deprecated = reader.bool(); - break; - case 999: - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - case 1049: - message[".google.api.defaultHost"] = reader.string(); - break; - case 1050: - message[".google.api.oauthScopes"] = reader.string(); - break; + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -14286,6 +15223,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for ServiceOptions + * @function getTypeUrl + * @memberof google.protobuf.ServiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; + }; + return ServiceOptions; })(); @@ -14429,25 +15381,30 @@ 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 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; + } default: reader.skipType(tag & 7); break; @@ -14624,6 +15581,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for MethodOptions + * @function getTypeUrl + * @memberof google.protobuf.MethodOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodOptions"; + }; + /** * IdempotencyLevel enum. * @name google.protobuf.MethodOptions.IdempotencyLevel @@ -14803,29 +15775,36 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - if (!(message.name && message.name.length)) - message.name = []; - message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); - break; - case 3: - message.identifierValue = reader.string(); - break; - case 4: - message.positiveIntValue = reader.uint64(); - break; - case 5: - message.negativeIntValue = reader.int64(); - break; - case 6: - message.doubleValue = reader.double(); - break; - case 7: - message.stringValue = reader.bytes(); - break; - case 8: - message.aggregateValue = reader.string(); - break; + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + } + case 3: { + message.identifierValue = reader.string(); + break; + } + case 4: { + message.positiveIntValue = reader.uint64(); + break; + } + case 5: { + message.negativeIntValue = reader.int64(); + break; + } + case 6: { + message.doubleValue = reader.double(); + break; + } + case 7: { + message.stringValue = reader.bytes(); + break; + } + case 8: { + message.aggregateValue = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -14938,7 +15917,7 @@ if (object.stringValue != null) if (typeof object.stringValue === "string") $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); - else if (object.stringValue.length) + else if (object.stringValue.length >= 0) message.stringValue = object.stringValue; if (object.aggregateValue != null) message.aggregateValue = String(object.aggregateValue); @@ -15019,6 +15998,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for UninterpretedOption + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + }; + UninterpretedOption.NamePart = (function() { /** @@ -15120,12 +16114,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.namePart = reader.string(); - break; - case 2: - message.isExtension = reader.bool(); - break; + case 1: { + message.namePart = reader.string(); + break; + } + case 2: { + message.isExtension = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -15226,6 +16222,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for NamePart + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; + }; + return NamePart; })(); @@ -15326,11 +16337,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.location && message.location.length)) - message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -15437,6 +16449,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SourceCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; + }; + SourceCodeInfo.Location = (function() { /** @@ -15585,37 +16612,42 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - case 2: - if (!(message.span && message.span.length)) - message.span = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else message.span.push(reader.int32()); - } else - message.span.push(reader.int32()); - break; - case 3: - message.leadingComments = reader.string(); - break; - case 4: - message.trailingComments = reader.string(); - break; - case 6: - if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) - message.leadingDetachedComments = []; - message.leadingDetachedComments.push(reader.string()); - break; + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -15776,6 +16808,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Location + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; + }; + return Location; })(); @@ -15876,11 +16923,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.annotation && message.annotation.length)) - message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -15987,6 +17035,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GeneratedCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; + }; + GeneratedCodeInfo.Annotation = (function() { /** @@ -15997,6 +17060,7 @@ * @property {string|null} [sourceFile] Annotation sourceFile * @property {number|null} [begin] Annotation begin * @property {number|null} [end] Annotation end + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic */ /** @@ -16047,6 +17111,14 @@ */ Annotation.prototype.end = 0; + /** + * Annotation semantic. + * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.semantic = 0; + /** * Creates a new Annotation instance using the specified properties. * @function create @@ -16083,6 +17155,8 @@ writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); if (message.end != null && Object.hasOwnProperty.call(message, "end")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); return writer; }; @@ -16117,25 +17191,33 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - case 2: - message.sourceFile = reader.string(); - break; - case 3: - message.begin = reader.int32(); - break; - case 4: - message.end = reader.int32(); - break; + break; + } + case 2: { + message.sourceFile = reader.string(); + break; + } + case 3: { + message.begin = reader.int32(); + break; + } + case 4: { + message.end = reader.int32(); + break; + } + case 5: { + message.semantic = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -16187,6 +17269,15 @@ if (message.end != null && message.hasOwnProperty("end")) if (!$util.isInteger(message.end)) return "end: integer expected"; + if (message.semantic != null && message.hasOwnProperty("semantic")) + switch (message.semantic) { + default: + return "semantic: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -16215,6 +17306,20 @@ message.begin = object.begin | 0; if (object.end != null) message.end = object.end | 0; + switch (object.semantic) { + case "NONE": + case 0: + message.semantic = 0; + break; + case "SET": + case 1: + message.semantic = 1; + break; + case "ALIAS": + case 2: + message.semantic = 2; + break; + } return message; }; @@ -16237,6 +17342,7 @@ object.sourceFile = ""; object.begin = 0; object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; } if (message.path && message.path.length) { object.path = []; @@ -16249,6 +17355,8 @@ object.begin = message.begin; if (message.end != null && message.hasOwnProperty("end")) object.end = message.end; + if (message.semantic != null && message.hasOwnProperty("semantic")) + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; return object; }; @@ -16263,6 +17371,37 @@ 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; })(); @@ -16363,11 +17502,12 @@ 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; + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -16469,6 +17609,21 @@ 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; })(); @@ -16575,12 +17730,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.seconds = reader.int64(); - break; - case 2: - message.nanos = reader.int32(); - break; + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -16693,6 +17850,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Timestamp + * @function getTypeUrl + * @memberof google.protobuf.Timestamp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Timestamp"; + }; + return Timestamp; })(); @@ -16750,7 +17922,7 @@ }; /** - * Callback as used by {@link google.iam.v1.IAMPolicy#setIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|setIamPolicy}. * @memberof google.iam.v1.IAMPolicy * @typedef SetIamPolicyCallback * @type {function} @@ -16783,7 +17955,7 @@ */ /** - * Callback as used by {@link google.iam.v1.IAMPolicy#getIamPolicy}. + * Callback as used by {@link google.iam.v1.IAMPolicy|getIamPolicy}. * @memberof google.iam.v1.IAMPolicy * @typedef GetIamPolicyCallback * @type {function} @@ -16816,7 +17988,7 @@ */ /** - * Callback as used by {@link google.iam.v1.IAMPolicy#testIamPermissions}. + * Callback as used by {@link google.iam.v1.IAMPolicy|testIamPermissions}. * @memberof google.iam.v1.IAMPolicy * @typedef TestIamPermissionsCallback * @type {function} @@ -16859,6 +18031,7 @@ * @interface ISetIamPolicyRequest * @property {string|null} [resource] SetIamPolicyRequest resource * @property {google.iam.v1.IPolicy|null} [policy] SetIamPolicyRequest policy + * @property {google.protobuf.IFieldMask|null} [updateMask] SetIamPolicyRequest updateMask */ /** @@ -16892,6 +18065,14 @@ */ SetIamPolicyRequest.prototype.policy = null; + /** + * SetIamPolicyRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.iam.v1.SetIamPolicyRequest + * @instance + */ + SetIamPolicyRequest.prototype.updateMask = null; + /** * Creates a new SetIamPolicyRequest instance using the specified properties. * @function create @@ -16920,6 +18101,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.resource); if (message.policy != null && Object.hasOwnProperty.call(message, "policy")) $root.google.iam.v1.Policy.encode(message.policy, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -16954,12 +18137,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resource = reader.string(); - break; - case 2: - message.policy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); - break; + case 1: { + message.resource = reader.string(); + break; + } + case 2: { + message.policy = $root.google.iam.v1.Policy.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -17003,6 +18192,11 @@ if (error) return "policy." + error; } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } return null; }; @@ -17025,6 +18219,11 @@ throw TypeError(".google.iam.v1.SetIamPolicyRequest.policy: object expected"); message.policy = $root.google.iam.v1.Policy.fromObject(object.policy); } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.iam.v1.SetIamPolicyRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } return message; }; @@ -17044,11 +18243,14 @@ if (options.defaults) { object.resource = ""; object.policy = null; + object.updateMask = null; } if (message.resource != null && message.hasOwnProperty("resource")) object.resource = message.resource; if (message.policy != null && message.hasOwnProperty("policy")) object.policy = $root.google.iam.v1.Policy.toObject(message.policy, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; }; @@ -17063,6 +18265,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for SetIamPolicyRequest + * @function getTypeUrl + * @memberof google.iam.v1.SetIamPolicyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetIamPolicyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.SetIamPolicyRequest"; + }; + return SetIamPolicyRequest; })(); @@ -17169,12 +18386,14 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resource = reader.string(); - break; - case 2: - message.options = $root.google.iam.v1.GetPolicyOptions.decode(reader, reader.uint32()); - break; + case 1: { + message.resource = reader.string(); + break; + } + case 2: { + message.options = $root.google.iam.v1.GetPolicyOptions.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -17278,6 +18497,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetIamPolicyRequest + * @function getTypeUrl + * @memberof google.iam.v1.GetIamPolicyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetIamPolicyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.GetIamPolicyRequest"; + }; + return GetIamPolicyRequest; })(); @@ -17386,14 +18620,16 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.resource = reader.string(); - break; - case 2: - if (!(message.permissions && message.permissions.length)) - message.permissions = []; - message.permissions.push(reader.string()); - break; + case 1: { + message.resource = reader.string(); + break; + } + case 2: { + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -17504,6 +18740,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TestIamPermissionsRequest + * @function getTypeUrl + * @memberof google.iam.v1.TestIamPermissionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TestIamPermissionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.TestIamPermissionsRequest"; + }; + return TestIamPermissionsRequest; })(); @@ -17601,11 +18852,12 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.permissions && message.permissions.length)) - message.permissions = []; - message.permissions.push(reader.string()); - break; + case 1: { + if (!(message.permissions && message.permissions.length)) + message.permissions = []; + message.permissions.push(reader.string()); + break; + } default: reader.skipType(tag & 7); break; @@ -17707,6 +18959,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for TestIamPermissionsResponse + * @function getTypeUrl + * @memberof google.iam.v1.TestIamPermissionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TestIamPermissionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.TestIamPermissionsResponse"; + }; + return TestIamPermissionsResponse; })(); @@ -17802,9 +19069,10 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.requestedPolicyVersion = reader.int32(); - break; + case 1: { + message.requestedPolicyVersion = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -17894,6 +19162,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for GetPolicyOptions + * @function getTypeUrl + * @memberof google.iam.v1.GetPolicyOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetPolicyOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.GetPolicyOptions"; + }; + return GetPolicyOptions; })(); @@ -17905,6 +19188,7 @@ * @interface IPolicy * @property {number|null} [version] Policy version * @property {Array.|null} [bindings] Policy bindings + * @property {Array.|null} [auditConfigs] Policy auditConfigs * @property {Uint8Array|null} [etag] Policy etag */ @@ -17918,6 +19202,7 @@ */ function Policy(properties) { this.bindings = []; + this.auditConfigs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17940,6 +19225,14 @@ */ Policy.prototype.bindings = $util.emptyArray; + /** + * Policy auditConfigs. + * @member {Array.} auditConfigs + * @memberof google.iam.v1.Policy + * @instance + */ + Policy.prototype.auditConfigs = $util.emptyArray; + /** * Policy etag. * @member {Uint8Array} etag @@ -17979,6 +19272,9 @@ if (message.bindings != null && message.bindings.length) for (var i = 0; i < message.bindings.length; ++i) $root.google.iam.v1.Binding.encode(message.bindings[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.auditConfigs != null && message.auditConfigs.length) + for (var i = 0; i < message.auditConfigs.length; ++i) + $root.google.iam.v1.AuditConfig.encode(message.auditConfigs[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -18013,17 +19309,26 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.version = reader.int32(); - break; - case 4: - if (!(message.bindings && message.bindings.length)) - message.bindings = []; - message.bindings.push($root.google.iam.v1.Binding.decode(reader, reader.uint32())); - break; - case 3: - message.etag = reader.bytes(); - break; + case 1: { + message.version = reader.int32(); + break; + } + case 4: { + if (!(message.bindings && message.bindings.length)) + message.bindings = []; + message.bindings.push($root.google.iam.v1.Binding.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.auditConfigs && message.auditConfigs.length)) + message.auditConfigs = []; + message.auditConfigs.push($root.google.iam.v1.AuditConfig.decode(reader, reader.uint32())); + break; + } + case 3: { + message.etag = reader.bytes(); + break; + } default: reader.skipType(tag & 7); break; @@ -18071,6 +19376,15 @@ return "bindings." + error; } } + if (message.auditConfigs != null && message.hasOwnProperty("auditConfigs")) { + if (!Array.isArray(message.auditConfigs)) + return "auditConfigs: array expected"; + for (var i = 0; i < message.auditConfigs.length; ++i) { + var error = $root.google.iam.v1.AuditConfig.verify(message.auditConfigs[i]); + if (error) + return "auditConfigs." + error; + } + } if (message.etag != null && message.hasOwnProperty("etag")) if (!(message.etag && typeof message.etag.length === "number" || $util.isString(message.etag))) return "etag: buffer expected"; @@ -18101,10 +19415,20 @@ message.bindings[i] = $root.google.iam.v1.Binding.fromObject(object.bindings[i]); } } + if (object.auditConfigs) { + if (!Array.isArray(object.auditConfigs)) + throw TypeError(".google.iam.v1.Policy.auditConfigs: array expected"); + message.auditConfigs = []; + for (var i = 0; i < object.auditConfigs.length; ++i) { + if (typeof object.auditConfigs[i] !== "object") + throw TypeError(".google.iam.v1.Policy.auditConfigs: object expected"); + message.auditConfigs[i] = $root.google.iam.v1.AuditConfig.fromObject(object.auditConfigs[i]); + } + } if (object.etag != null) if (typeof object.etag === "string") $util.base64.decode(object.etag, message.etag = $util.newBuffer($util.base64.length(object.etag)), 0); - else if (object.etag.length) + else if (object.etag.length >= 0) message.etag = object.etag; return message; }; @@ -18122,8 +19446,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.bindings = []; + object.auditConfigs = []; + } if (options.defaults) { object.version = 0; if (options.bytes === String) @@ -18143,6 +19469,11 @@ for (var j = 0; j < message.bindings.length; ++j) object.bindings[j] = $root.google.iam.v1.Binding.toObject(message.bindings[j], options); } + if (message.auditConfigs && message.auditConfigs.length) { + object.auditConfigs = []; + for (var j = 0; j < message.auditConfigs.length; ++j) + object.auditConfigs[j] = $root.google.iam.v1.AuditConfig.toObject(message.auditConfigs[j], options); + } return object; }; @@ -18157,6 +19488,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Policy + * @function getTypeUrl + * @memberof google.iam.v1.Policy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Policy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.Policy"; + }; + return Policy; })(); @@ -18276,17 +19622,20 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.role = reader.string(); - break; - case 2: - if (!(message.members && message.members.length)) - message.members = []; - message.members.push(reader.string()); - break; - case 3: - message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); - break; + case 1: { + message.role = reader.string(); + break; + } + case 2: { + if (!(message.members && message.members.length)) + message.members = []; + message.members.push(reader.string()); + break; + } + case 3: { + message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -18411,30 +19760,44 @@ 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.PolicyDelta = (function() { + v1.AuditConfig = (function() { /** - * Properties of a PolicyDelta. + * Properties of an AuditConfig. * @memberof google.iam.v1 - * @interface IPolicyDelta - * @property {Array.|null} [bindingDeltas] PolicyDelta bindingDeltas - * @property {Array.|null} [auditConfigDeltas] PolicyDelta auditConfigDeltas + * @interface IAuditConfig + * @property {string|null} [service] AuditConfig service + * @property {Array.|null} [auditLogConfigs] AuditConfig auditLogConfigs */ /** - * Constructs a new PolicyDelta. + * Constructs a new AuditConfig. * @memberof google.iam.v1 - * @classdesc Represents a PolicyDelta. - * @implements IPolicyDelta + * @classdesc Represents an AuditConfig. + * @implements IAuditConfig * @constructor - * @param {google.iam.v1.IPolicyDelta=} [properties] Properties to set + * @param {google.iam.v1.IAuditConfig=} [properties] Properties to set */ - function PolicyDelta(properties) { - this.bindingDeltas = []; - this.auditConfigDeltas = []; + function AuditConfig(properties) { + this.auditLogConfigs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18442,95 +19805,94 @@ } /** - * PolicyDelta bindingDeltas. - * @member {Array.} bindingDeltas - * @memberof google.iam.v1.PolicyDelta + * AuditConfig service. + * @member {string} service + * @memberof google.iam.v1.AuditConfig * @instance */ - PolicyDelta.prototype.bindingDeltas = $util.emptyArray; + AuditConfig.prototype.service = ""; /** - * PolicyDelta auditConfigDeltas. - * @member {Array.} auditConfigDeltas - * @memberof google.iam.v1.PolicyDelta + * AuditConfig auditLogConfigs. + * @member {Array.} auditLogConfigs + * @memberof google.iam.v1.AuditConfig * @instance */ - PolicyDelta.prototype.auditConfigDeltas = $util.emptyArray; + AuditConfig.prototype.auditLogConfigs = $util.emptyArray; /** - * Creates a new PolicyDelta instance using the specified properties. + * Creates a new AuditConfig instance using the specified properties. * @function create - * @memberof google.iam.v1.PolicyDelta + * @memberof google.iam.v1.AuditConfig * @static - * @param {google.iam.v1.IPolicyDelta=} [properties] Properties to set - * @returns {google.iam.v1.PolicyDelta} PolicyDelta instance + * @param {google.iam.v1.IAuditConfig=} [properties] Properties to set + * @returns {google.iam.v1.AuditConfig} AuditConfig instance */ - PolicyDelta.create = function create(properties) { - return new PolicyDelta(properties); + AuditConfig.create = function create(properties) { + return new AuditConfig(properties); }; /** - * Encodes the specified PolicyDelta message. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * Encodes the specified AuditConfig message. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. * @function encode - * @memberof google.iam.v1.PolicyDelta + * @memberof google.iam.v1.AuditConfig * @static - * @param {google.iam.v1.IPolicyDelta} message PolicyDelta message or plain object to encode + * @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 */ - PolicyDelta.encode = function encode(message, writer) { + AuditConfig.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(); + 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 PolicyDelta message, length delimited. Does not implicitly {@link google.iam.v1.PolicyDelta.verify|verify} messages. + * Encodes the specified AuditConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.iam.v1.PolicyDelta + * @memberof google.iam.v1.AuditConfig * @static - * @param {google.iam.v1.IPolicyDelta} message PolicyDelta message or plain object to encode + * @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 */ - PolicyDelta.encodeDelimited = function encodeDelimited(message, writer) { + AuditConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PolicyDelta message from the specified reader or buffer. + * Decodes an AuditConfig message from the specified reader or buffer. * @function decode - * @memberof google.iam.v1.PolicyDelta + * @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.PolicyDelta} PolicyDelta + * @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 */ - PolicyDelta.decode = function decode(reader, length) { + 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.PolicyDelta(); + 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: - if (!(message.bindingDeltas && message.bindingDeltas.length)) - message.bindingDeltas = []; - message.bindingDeltas.push($root.google.iam.v1.BindingDelta.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.auditConfigDeltas && message.auditConfigDeltas.length)) - message.auditConfigDeltas = []; - message.auditConfigDeltas.push($root.google.iam.v1.AuditConfigDelta.decode(reader, reader.uint32())); - break; + case 1: { + 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; @@ -18540,39 +19902,575 @@ }; /** - * Decodes a PolicyDelta message from the specified reader or buffer, length delimited. + * Decodes an AuditConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.iam.v1.PolicyDelta + * @memberof google.iam.v1.AuditConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.iam.v1.PolicyDelta} PolicyDelta + * @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 */ - PolicyDelta.decodeDelimited = function decodeDelimited(reader) { + AuditConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PolicyDelta message. + * Verifies an AuditConfig message. * @function verify - * @memberof google.iam.v1.PolicyDelta + * @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 */ - PolicyDelta.verify = function verify(message) { + AuditConfig.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 (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 "bindingDeltas." + error; + return "auditLogConfigs." + error; + } + } + return null; + }; + + /** + * Creates an AuditConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.AuditConfig + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.AuditConfig} AuditConfig + */ + AuditConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.AuditConfig) + return object; + var message = new $root.google.iam.v1.AuditConfig(); + if (object.service != null) + message.service = String(object.service); + if (object.auditLogConfigs) { + if (!Array.isArray(object.auditLogConfigs)) + throw TypeError(".google.iam.v1.AuditConfig.auditLogConfigs: array expected"); + message.auditLogConfigs = []; + for (var i = 0; i < object.auditLogConfigs.length; ++i) { + if (typeof object.auditLogConfigs[i] !== "object") + throw TypeError(".google.iam.v1.AuditConfig.auditLogConfigs: object expected"); + message.auditLogConfigs[i] = $root.google.iam.v1.AuditLogConfig.fromObject(object.auditLogConfigs[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an AuditConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.AuditConfig + * @static + * @param {google.iam.v1.AuditConfig} message AuditConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuditConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.auditLogConfigs = []; + if (options.defaults) + object.service = ""; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + if (message.auditLogConfigs && message.auditLogConfigs.length) { + object.auditLogConfigs = []; + for (var j = 0; j < message.auditLogConfigs.length; ++j) + object.auditLogConfigs[j] = $root.google.iam.v1.AuditLogConfig.toObject(message.auditLogConfigs[j], options); + } + return object; + }; + + /** + * Converts this AuditConfig to JSON. + * @function toJSON + * @memberof google.iam.v1.AuditConfig + * @instance + * @returns {Object.} JSON object + */ + AuditConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AuditConfig + * @function getTypeUrl + * @memberof google.iam.v1.AuditConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AuditConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.AuditConfig"; + }; + + return AuditConfig; + })(); + + v1.AuditLogConfig = (function() { + + /** + * Properties of an AuditLogConfig. + * @memberof google.iam.v1 + * @interface IAuditLogConfig + * @property {google.iam.v1.AuditLogConfig.LogType|null} [logType] AuditLogConfig logType + * @property {Array.|null} [exemptedMembers] AuditLogConfig exemptedMembers + */ + + /** + * Constructs a new AuditLogConfig. + * @memberof google.iam.v1 + * @classdesc Represents an AuditLogConfig. + * @implements IAuditLogConfig + * @constructor + * @param {google.iam.v1.IAuditLogConfig=} [properties] Properties to set + */ + function AuditLogConfig(properties) { + this.exemptedMembers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AuditLogConfig logType. + * @member {google.iam.v1.AuditLogConfig.LogType} logType + * @memberof google.iam.v1.AuditLogConfig + * @instance + */ + AuditLogConfig.prototype.logType = 0; + + /** + * AuditLogConfig exemptedMembers. + * @member {Array.} exemptedMembers + * @memberof google.iam.v1.AuditLogConfig + * @instance + */ + AuditLogConfig.prototype.exemptedMembers = $util.emptyArray; + + /** + * Creates a new AuditLogConfig instance using the specified properties. + * @function create + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig=} [properties] Properties to set + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig instance + */ + AuditLogConfig.create = function create(properties) { + return new AuditLogConfig(properties); + }; + + /** + * Encodes the specified AuditLogConfig message. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @function encode + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig} message AuditLogConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditLogConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.logType); + if (message.exemptedMembers != null && message.exemptedMembers.length) + for (var i = 0; i < message.exemptedMembers.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.exemptedMembers[i]); + return writer; + }; + + /** + * Encodes the specified AuditLogConfig message, length delimited. Does not implicitly {@link google.iam.v1.AuditLogConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.IAuditLogConfig} message AuditLogConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AuditLogConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer. + * @function decode + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditLogConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.iam.v1.AuditLogConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.logType = reader.int32(); + break; + } + case 2: { + if (!(message.exemptedMembers && message.exemptedMembers.length)) + message.exemptedMembers = []; + message.exemptedMembers.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AuditLogConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AuditLogConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AuditLogConfig message. + * @function verify + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AuditLogConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logType != null && message.hasOwnProperty("logType")) + switch (message.logType) { + default: + return "logType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.exemptedMembers != null && message.hasOwnProperty("exemptedMembers")) { + if (!Array.isArray(message.exemptedMembers)) + return "exemptedMembers: array expected"; + for (var i = 0; i < message.exemptedMembers.length; ++i) + if (!$util.isString(message.exemptedMembers[i])) + return "exemptedMembers: string[] expected"; + } + return null; + }; + + /** + * Creates an AuditLogConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {Object.} object Plain object + * @returns {google.iam.v1.AuditLogConfig} AuditLogConfig + */ + AuditLogConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.iam.v1.AuditLogConfig) + return object; + var message = new $root.google.iam.v1.AuditLogConfig(); + switch (object.logType) { + case "LOG_TYPE_UNSPECIFIED": + case 0: + message.logType = 0; + break; + case "ADMIN_READ": + case 1: + message.logType = 1; + break; + case "DATA_WRITE": + case 2: + message.logType = 2; + break; + case "DATA_READ": + case 3: + message.logType = 3; + break; + } + if (object.exemptedMembers) { + if (!Array.isArray(object.exemptedMembers)) + throw TypeError(".google.iam.v1.AuditLogConfig.exemptedMembers: array expected"); + message.exemptedMembers = []; + for (var i = 0; i < object.exemptedMembers.length; ++i) + message.exemptedMembers[i] = String(object.exemptedMembers[i]); + } + return message; + }; + + /** + * Creates a plain object from an AuditLogConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {google.iam.v1.AuditLogConfig} message AuditLogConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AuditLogConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.exemptedMembers = []; + if (options.defaults) + object.logType = options.enums === String ? "LOG_TYPE_UNSPECIFIED" : 0; + if (message.logType != null && message.hasOwnProperty("logType")) + object.logType = options.enums === String ? $root.google.iam.v1.AuditLogConfig.LogType[message.logType] : message.logType; + if (message.exemptedMembers && message.exemptedMembers.length) { + object.exemptedMembers = []; + for (var j = 0; j < message.exemptedMembers.length; ++j) + object.exemptedMembers[j] = message.exemptedMembers[j]; + } + return object; + }; + + /** + * Converts this AuditLogConfig to JSON. + * @function toJSON + * @memberof google.iam.v1.AuditLogConfig + * @instance + * @returns {Object.} JSON object + */ + AuditLogConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AuditLogConfig + * @function getTypeUrl + * @memberof google.iam.v1.AuditLogConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AuditLogConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.AuditLogConfig"; + }; + + /** + * LogType enum. + * @name google.iam.v1.AuditLogConfig.LogType + * @enum {number} + * @property {number} LOG_TYPE_UNSPECIFIED=0 LOG_TYPE_UNSPECIFIED value + * @property {number} ADMIN_READ=1 ADMIN_READ value + * @property {number} DATA_WRITE=2 DATA_WRITE value + * @property {number} DATA_READ=3 DATA_READ value + */ + AuditLogConfig.LogType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LOG_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ADMIN_READ"] = 1; + values[valuesById[2] = "DATA_WRITE"] = 2; + values[valuesById[3] = "DATA_READ"] = 3; + return values; + })(); + + return AuditLogConfig; + })(); + + v1.PolicyDelta = (function() { + + /** + * 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")) { @@ -18663,6 +20561,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for PolicyDelta + * @function getTypeUrl + * @memberof google.iam.v1.PolicyDelta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PolicyDelta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.PolicyDelta"; + }; + return PolicyDelta; })(); @@ -18791,18 +20704,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.action = reader.int32(); - break; - case 2: - message.role = reader.string(); - break; - case 3: - message.member = reader.string(); - break; - case 4: - message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); - break; + case 1: { + message.action = reader.int32(); + break; + } + case 2: { + message.role = reader.string(); + break; + } + case 3: { + message.member = reader.string(); + break; + } + case 4: { + message.condition = $root.google.type.Expr.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -18940,6 +20857,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BindingDelta + * @function getTypeUrl + * @memberof google.iam.v1.BindingDelta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BindingDelta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.BindingDelta"; + }; + /** * Action enum. * @name google.iam.v1.BindingDelta.Action @@ -19084,18 +21016,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.action = reader.int32(); - break; - case 2: - message.service = reader.string(); - break; - case 3: - message.exemptedMember = reader.string(); - break; - case 4: - message.logType = reader.string(); - break; + case 1: { + message.action = reader.int32(); + break; + } + case 2: { + message.service = reader.string(); + break; + } + case 3: { + message.exemptedMember = reader.string(); + break; + } + case 4: { + message.logType = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -19228,6 +21164,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for AuditConfigDelta + * @function getTypeUrl + * @memberof google.iam.v1.AuditConfigDelta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AuditConfigDelta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.iam.v1.AuditConfigDelta"; + }; + /** * Action enum. * @name google.iam.v1.AuditConfigDelta.Action @@ -19387,18 +21338,22 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.expression = reader.string(); - break; - case 2: - message.title = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.location = reader.string(); - break; + case 1: { + message.expression = reader.string(); + break; + } + case 2: { + message.title = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.location = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -19513,6 +21468,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Expr + * @function getTypeUrl + * @memberof google.type.Expr + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Expr.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Expr"; + }; + return Expr; })(); @@ -19630,15 +21600,18 @@ while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.currencyCode = reader.string(); - break; - case 2: - message.units = reader.int64(); - break; - case 3: - message.nanos = reader.int32(); - break; + case 1: { + message.currencyCode = reader.string(); + break; + } + case 2: { + message.units = reader.int64(); + break; + } + case 3: { + message.nanos = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -19759,6 +21732,21 @@ return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Money + * @function getTypeUrl + * @memberof google.type.Money + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Money.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Money"; + }; + return Money; })(); diff --git a/packages/google-cloud-billing/protos/protos.json b/packages/google-cloud-billing/protos/protos.json index 03d4d38df43..c1e48b8313d 100644 --- a/packages/google-cloud-billing/protos/protos.json +++ b/packages/google-cloud-billing/protos/protos.json @@ -991,6 +991,10 @@ "syntax": { "type": "string", "id": 12 + }, + "edition": { + "type": "string", + "id": 13 } } }, @@ -1519,6 +1523,13 @@ "default": false } }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, "deprecated": { "type": "bool", "id": 3, @@ -1811,6 +1822,19 @@ "end": { "type": "int32", "id": 4 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } } } } @@ -1923,6 +1947,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 } } }, @@ -1990,6 +2018,11 @@ "type": "Binding", "id": 4 }, + "auditConfigs": { + "rule": "repeated", + "type": "AuditConfig", + "id": 6 + }, "etag": { "type": "bytes", "id": 3 @@ -2013,6 +2046,42 @@ } } }, + "AuditConfig": { + "fields": { + "service": { + "type": "string", + "id": 1 + }, + "auditLogConfigs": { + "rule": "repeated", + "type": "AuditLogConfig", + "id": 3 + } + } + }, + "AuditLogConfig": { + "fields": { + "logType": { + "type": "LogType", + "id": 1 + }, + "exemptedMembers": { + "rule": "repeated", + "type": "string", + "id": 2 + } + }, + "nested": { + "LogType": { + "values": { + "LOG_TYPE_UNSPECIFIED": 0, + "ADMIN_READ": 1, + "DATA_WRITE": 2, + "DATA_READ": 3 + } + } + } + }, "PolicyDelta": { "fields": { "bindingDeltas": { From d80cb9d2bb1dd5d705d196b03db5f7418bd6e79c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 24 Aug 2022 10:13:28 -0700 Subject: [PATCH 156/169] chore(main): release 3.1.1 (#242) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 3.1.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-billing/CHANGELOG.md | 9 +++++++++ packages/google-cloud-billing/package.json | 2 +- .../v1/snippet_metadata.google.cloud.billing.v1.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 1ee3debe606..b787d33624b 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [3.1.1](https://github.com/googleapis/nodejs-billing/compare/v3.1.0...v3.1.1) (2022-08-23) + + +### Bug Fixes + +* better support for fallback mode ([#240](https://github.com/googleapis/nodejs-billing/issues/240)) ([b56bc7d](https://github.com/googleapis/nodejs-billing/commit/b56bc7d793cc28edc272a257f0477c240653c4bb)) +* change import long to require ([#241](https://github.com/googleapis/nodejs-billing/issues/241)) ([b9a1546](https://github.com/googleapis/nodejs-billing/commit/b9a15460a5075c4f1cbf9686f33f1117b82b1134)) +* remove pip install statements ([#1546](https://github.com/googleapis/nodejs-billing/issues/1546)) ([#243](https://github.com/googleapis/nodejs-billing/issues/243)) ([64c462c](https://github.com/googleapis/nodejs-billing/commit/64c462caa3db15dd193a3043111e33453a5b8bab)) + ## [3.1.0](https://github.com/googleapis/nodejs-billing/compare/v3.0.0...v3.1.0) (2022-07-04) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 061cd907d7a..4b84bce085c 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "3.1.0", + "version": "3.1.1", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json index a48ac3486c3..df668d11b10 100644 --- a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-billing", - "version": "3.1.0", + "version": "3.1.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 1948c4b6b12..35cf2f6dc18 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^3.1.0" + "@google-cloud/billing": "^3.1.1" }, "devDependencies": { "c8": "^7.1.0", From ebc4697e8f840822b9dab41f5e46d17349c55ba4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 27 Aug 2022 05:00:22 +0000 Subject: [PATCH 157/169] fix: do not import the whole google-gax from proto JS (#1553) (#244) fix: use google-gax v3.3.0 Source-Link: https://github.com/googleapis/synthtool/commit/c73d112a11a1f1a93efa67c50495c19aa3a88910 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:b15a6f06cc06dcffa11e1bebdf1a74b6775a134aac24a0f86f51ddf728eb373e --- packages/google-cloud-billing/package.json | 2 +- packages/google-cloud-billing/protos/protos.d.ts | 2 +- packages/google-cloud-billing/protos/protos.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 4b84bce085c..e8ad35f4062 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^3.0.0" + "google-gax": "^3.3.0" }, "devDependencies": { "@types/mocha": "^9.0.0", diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index 691850a7677..2b6bf3e69e7 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -13,7 +13,7 @@ // limitations under the License. import Long = require("long"); -import {protobuf as $protobuf} from "google-gax"; +import type {protobuf as $protobuf} from "google-gax"; /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index 89103e8759f..ef31f67c9ac 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -19,7 +19,7 @@ define(["protobufjs/minimal"], factory); /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("google-gax").protobufMinimal); + module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); })(this, function($protobuf) { "use strict"; From 69f4ea01468978f96bb28a9aa222cc741ef870c4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 20:56:15 +0000 Subject: [PATCH 158/169] fix: allow passing gax instance to client constructor (#245) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 470911839 Source-Link: https://github.com/googleapis/googleapis/commit/352756699ebc5b2144c252867c265ea44448712e Source-Link: https://github.com/googleapis/googleapis-gen/commit/f16a1d224f00a630ea43d6a9a1a31f566f45cdea Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjE2YTFkMjI0ZjAwYTYzMGVhNDNkNmE5YTFhMzFmNTY2ZjQ1Y2RlYSJ9 feat: accept google-gax instance as a parameter Please see the documentation of the client constructor for details. PiperOrigin-RevId: 470332808 Source-Link: https://github.com/googleapis/googleapis/commit/d4a23675457cd8f0b44080e0594ec72de1291b89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e97a1ac204ead4fe7341f91e72db7c6ac6016341 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTk3YTFhYzIwNGVhZDRmZTczNDFmOTFlNzJkYjdjNmFjNjAxNjM0MSJ9 --- .../src/v1/cloud_billing_client.ts | 47 ++++++++++++------- .../src/v1/cloud_catalog_client.ts | 33 +++++++++---- 2 files changed, 53 insertions(+), 27 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index e276adfb92b..93824d5a582 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -26,7 +26,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -36,7 +35,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './cloud_billing_client_config.json'; - const version = require('../../../package.json').version; /** @@ -96,8 +94,18 @@ export class CloudBillingClient { * 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 CloudBillingClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CloudBillingClient; const servicePath = @@ -117,8 +125,13 @@ export class CloudBillingClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -203,7 +216,7 @@ export class CloudBillingClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -420,7 +433,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -521,7 +534,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -715,7 +728,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -846,7 +859,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -940,7 +953,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ resource: request.resource || '', }); this.initialize(); @@ -1039,7 +1052,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ resource: request.resource || '', }); this.initialize(); @@ -1130,7 +1143,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ resource: request.resource || '', }); this.initialize(); @@ -1439,7 +1452,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); this.initialize(); @@ -1485,7 +1498,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); const defaultCallSettings = this._defaults['listProjectBillingInfo']; @@ -1536,7 +1549,7 @@ export class CloudBillingClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ name: request.name || '', }); const defaultCallSettings = this._defaults['listProjectBillingInfo']; diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 37ed0d8988e..271cd514a0e 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -17,8 +17,8 @@ // ** All changes to this file may be overwritten. ** /* global window */ -import * as gax from 'google-gax'; -import { +import type * as gax from 'google-gax'; +import type { Callback, CallOptions, Descriptors, @@ -26,7 +26,6 @@ import { PaginationCallback, GaxCall, } from 'google-gax'; - import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); @@ -36,7 +35,6 @@ import jsonProtos = require('../../protos/protos.json'); * This file defines retry strategy and timeouts for all API methods in this library. */ import * as gapicConfig from './cloud_catalog_client_config.json'; - const version = require('../../../package.json').version; /** @@ -98,8 +96,18 @@ export class CloudCatalogClient { * 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 CloudCatalogClient({fallback: 'rest'}, gax); + * ``` */ - constructor(opts?: ClientOptions) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof CloudCatalogClient; const servicePath = @@ -119,8 +127,13 @@ export class CloudCatalogClient { opts['scopes'] = staticMembers.scopes; } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); @@ -202,7 +215,7 @@ export class CloudCatalogClient { this.innerApiCalls = {}; // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; + this.warn = this._gaxModule.warn; } /** @@ -597,7 +610,7 @@ export class CloudCatalogClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); this.initialize(); @@ -656,7 +669,7 @@ export class CloudCatalogClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listSkus']; @@ -724,7 +737,7 @@ export class CloudCatalogClient { options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = - gax.routingHeader.fromParams({ + this._gaxModule.routingHeader.fromParams({ parent: request.parent || '', }); const defaultCallSettings = this._defaults['listSkus']; From ed53bd446ed0727502e4f3e6a03fd9b1e5a59881 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 7 Sep 2022 17:58:12 -0400 Subject: [PATCH 159/169] chore(main): release 3.1.2 (#246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 3.1.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-billing/CHANGELOG.md | 8 ++++++++ packages/google-cloud-billing/package.json | 2 +- .../v1/snippet_metadata.google.cloud.billing.v1.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index b787d33624b..95de26daff6 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [3.1.2](https://github.com/googleapis/nodejs-billing/compare/v3.1.1...v3.1.2) (2022-09-01) + + +### Bug Fixes + +* Allow passing gax instance to client constructor ([#245](https://github.com/googleapis/nodejs-billing/issues/245)) ([68bb343](https://github.com/googleapis/nodejs-billing/commit/68bb3435033a105250d20f60ef68e0849ddeecba)) +* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-billing/issues/1553)) ([#244](https://github.com/googleapis/nodejs-billing/issues/244)) ([eaa9bee](https://github.com/googleapis/nodejs-billing/commit/eaa9bee03df0efe9ed741281c8d927d922574aba)) + ## [3.1.1](https://github.com/googleapis/nodejs-billing/compare/v3.1.0...v3.1.1) (2022-08-23) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index e8ad35f4062..e1de5f8ee08 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "3.1.1", + "version": "3.1.2", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json index df668d11b10..d42ec7f62bc 100644 --- a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-billing", - "version": "3.1.1", + "version": "3.1.2", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 35cf2f6dc18..22a224db1e1 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^3.1.1" + "@google-cloud/billing": "^3.1.2" }, "devDependencies": { "c8": "^7.1.0", From a325a8268e4e58f30317ac3a29080cded8d6ab14 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 14 Sep 2022 22:36:28 +0000 Subject: [PATCH 160/169] fix: preserve default values in x-goog-request-params header (#247) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 474338479 Source-Link: https://github.com/googleapis/googleapis/commit/d5d35e0353b59719e8917103b1bc7df2782bf6ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/efcd3f93962a103f68f003e2a1eecde6fa216a27 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9 --- .../src/v1/cloud_billing_client.ts | 20 +- .../src/v1/cloud_catalog_client.ts | 6 +- .../test/gapic_cloud_billing_v1.ts | 813 +++++++++--------- .../test/gapic_cloud_catalog_v1.ts | 168 ++-- 4 files changed, 511 insertions(+), 496 deletions(-) diff --git a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts index 93824d5a582..54c42f18eb4 100644 --- a/packages/google-cloud-billing/src/v1/cloud_billing_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_billing_client.ts @@ -434,7 +434,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getBillingAccount(request, options, callback); @@ -535,7 +535,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.updateBillingAccount(request, options, callback); @@ -729,7 +729,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.getProjectBillingInfo(request, options, callback); @@ -860,7 +860,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.updateProjectBillingInfo( @@ -954,7 +954,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - resource: request.resource || '', + resource: request.resource ?? '', }); this.initialize(); return this.innerApiCalls.getIamPolicy(request, options, callback); @@ -1053,7 +1053,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - resource: request.resource || '', + resource: request.resource ?? '', }); this.initialize(); return this.innerApiCalls.setIamPolicy(request, options, callback); @@ -1144,7 +1144,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - resource: request.resource || '', + resource: request.resource ?? '', }); this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); @@ -1453,7 +1453,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); this.initialize(); return this.innerApiCalls.listProjectBillingInfo( @@ -1499,7 +1499,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); const defaultCallSettings = this._defaults['listProjectBillingInfo']; const callSettings = defaultCallSettings.merge(options); @@ -1550,7 +1550,7 @@ export class CloudBillingClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - name: request.name || '', + name: request.name ?? '', }); const defaultCallSettings = this._defaults['listProjectBillingInfo']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts index 271cd514a0e..d000f8e8bc6 100644 --- a/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts +++ b/packages/google-cloud-billing/src/v1/cloud_catalog_client.ts @@ -611,7 +611,7 @@ export class CloudCatalogClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); this.initialize(); return this.innerApiCalls.listSkus(request, options, callback); @@ -670,7 +670,7 @@ export class CloudCatalogClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listSkus']; const callSettings = defaultCallSettings.merge(options); @@ -738,7 +738,7 @@ export class CloudCatalogClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({ - parent: request.parent || '', + parent: request.parent ?? '', }); const defaultCallSettings = this._defaults['listSkus']; const callSettings = defaultCallSettings.merge(options); diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index 0f5f17a6512..e10ff3ec265 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -220,26 +235,25 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetBillingAccountRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); client.innerApiCalls.getBillingAccount = stubSimpleCall(expectedResponse); const [response] = await client.getBillingAccount(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getBillingAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBillingAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getBillingAccount without error using callback', async () => { @@ -251,15 +265,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetBillingAccountRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); @@ -282,11 +292,14 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getBillingAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBillingAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getBillingAccount with error', async () => { @@ -298,26 +311,25 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetBillingAccountRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getBillingAccount = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getBillingAccount(request), expectedError); - assert( - (client.innerApiCalls.getBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getBillingAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBillingAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getBillingAccount with closed client', async () => { @@ -329,7 +341,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('GetBillingAccountRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getBillingAccount(request), expectedError); @@ -346,15 +361,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('UpdateBillingAccountRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); @@ -362,11 +373,14 @@ describe('v1.CloudBillingClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateBillingAccount(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateBillingAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBillingAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateBillingAccount without error using callback', async () => { @@ -378,15 +392,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('UpdateBillingAccountRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); @@ -409,11 +419,14 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateBillingAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBillingAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateBillingAccount with error', async () => { @@ -425,26 +438,25 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('UpdateBillingAccountRequest', [ + 'name', + ]); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateBillingAccount = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.updateBillingAccount(request), expectedError); - assert( - (client.innerApiCalls.updateBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateBillingAccount as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBillingAccount as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateBillingAccount with closed client', async () => { @@ -456,7 +468,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue('UpdateBillingAccountRequest', [ + 'name', + ]); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.updateBillingAccount(request), expectedError); @@ -473,7 +488,6 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.CreateBillingAccountRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); @@ -481,11 +495,6 @@ describe('v1.CloudBillingClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.createBillingAccount(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes createBillingAccount without error using callback', async () => { @@ -497,7 +506,6 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.CreateBillingAccountRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() ); @@ -520,11 +528,6 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); }); it('invokes createBillingAccount with error', async () => { @@ -536,18 +539,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.CreateBillingAccountRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.createBillingAccount = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.createBillingAccount(request), expectedError); - assert( - (client.innerApiCalls.createBillingAccount as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes createBillingAccount with closed client', async () => { @@ -575,15 +572,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'GetProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() ); @@ -591,11 +585,14 @@ describe('v1.CloudBillingClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.getProjectBillingInfo(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProjectBillingInfo without error using callback', async () => { @@ -607,15 +604,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'GetProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() ); @@ -638,11 +632,14 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProjectBillingInfo with error', async () => { @@ -654,15 +651,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'GetProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getProjectBillingInfo = stubSimpleCall( undefined, @@ -672,11 +666,14 @@ describe('v1.CloudBillingClient', () => { client.getProjectBillingInfo(request), expectedError ); - assert( - (client.innerApiCalls.getProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getProjectBillingInfo with closed client', async () => { @@ -688,7 +685,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + 'GetProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -708,15 +709,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'UpdateProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() ); @@ -724,11 +722,14 @@ describe('v1.CloudBillingClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.updateProjectBillingInfo(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProjectBillingInfo without error using callback', async () => { @@ -740,15 +741,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'UpdateProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() ); @@ -771,11 +769,14 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.updateProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProjectBillingInfo with error', async () => { @@ -787,15 +788,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'UpdateProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.updateProjectBillingInfo = stubSimpleCall( undefined, @@ -805,11 +803,14 @@ describe('v1.CloudBillingClient', () => { client.updateProjectBillingInfo(request), expectedError ); - assert( - (client.innerApiCalls.updateProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.updateProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes updateProjectBillingInfo with closed client', async () => { @@ -821,7 +822,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); - request.name = ''; + const defaultValue1 = getTypeDefaultValue( + 'UpdateProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects( @@ -841,26 +846,25 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetIamPolicyRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); const [response] = await client.getIamPolicy(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getIamPolicy without error using callback', async () => { @@ -872,15 +876,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetIamPolicyRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); @@ -903,11 +903,14 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getIamPolicy with error', async () => { @@ -919,26 +922,25 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('GetIamPolicyRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.getIamPolicy = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.getIamPolicy(request), expectedError); - assert( - (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes getIamPolicy with closed client', async () => { @@ -950,7 +952,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - request.resource = ''; + const defaultValue1 = getTypeDefaultValue('GetIamPolicyRequest', [ + 'resource', + ]); + request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.getIamPolicy(request), expectedError); @@ -967,26 +972,25 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetIamPolicyRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); const [response] = await client.setIamPolicy(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setIamPolicy without error using callback', async () => { @@ -998,15 +1002,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetIamPolicyRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.Policy() ); @@ -1029,11 +1029,14 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setIamPolicy with error', async () => { @@ -1045,26 +1048,25 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('SetIamPolicyRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.setIamPolicy = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.setIamPolicy(request), expectedError); - assert( - (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setIamPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes setIamPolicy with closed client', async () => { @@ -1076,7 +1078,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - request.resource = ''; + const defaultValue1 = getTypeDefaultValue('SetIamPolicyRequest', [ + 'resource', + ]); + request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.setIamPolicy(request), expectedError); @@ -1093,15 +1098,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TestIamPermissionsRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsResponse() ); @@ -1109,11 +1110,14 @@ describe('v1.CloudBillingClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.testIamPermissions(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes testIamPermissions without error using callback', async () => { @@ -1125,15 +1129,11 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TestIamPermissionsRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsResponse() ); @@ -1156,11 +1156,14 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes testIamPermissions with error', async () => { @@ -1172,26 +1175,25 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('TestIamPermissionsRequest', [ + 'resource', + ]); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.testIamPermissions = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.testIamPermissions(request), expectedError); - assert( - (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.testIamPermissions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes testIamPermissions with closed client', async () => { @@ -1203,7 +1205,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - request.resource = ''; + const defaultValue1 = getTypeDefaultValue('TestIamPermissionsRequest', [ + 'resource', + ]); + request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); await assert.rejects(client.testIamPermissions(request), expectedError); @@ -1220,7 +1225,6 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListBillingAccountsRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() @@ -1236,11 +1240,6 @@ describe('v1.CloudBillingClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listBillingAccounts(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes listBillingAccounts without error using callback', async () => { @@ -1252,7 +1251,6 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListBillingAccountsRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.billing.v1.BillingAccount() @@ -1283,11 +1281,6 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); }); it('invokes listBillingAccounts with error', async () => { @@ -1299,18 +1292,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListBillingAccountsRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.listBillingAccounts = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listBillingAccounts(request), expectedError); - assert( - (client.innerApiCalls.listBillingAccounts as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes listBillingAccountsStream without error', async () => { @@ -1470,15 +1457,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ListProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() @@ -1494,11 +1478,14 @@ describe('v1.CloudBillingClient', () => { stubSimpleCall(expectedResponse); const [response] = await client.listProjectBillingInfo(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProjectBillingInfo without error using callback', async () => { @@ -1510,15 +1497,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ListProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() @@ -1549,11 +1533,14 @@ describe('v1.CloudBillingClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProjectBillingInfo with error', async () => { @@ -1565,15 +1552,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue( + 'ListProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listProjectBillingInfo = stubSimpleCall( undefined, @@ -1583,11 +1567,14 @@ describe('v1.CloudBillingClient', () => { client.listProjectBillingInfo(request), expectedError ); - assert( - (client.innerApiCalls.listProjectBillingInfo as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listProjectBillingInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProjectBillingInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listProjectBillingInfoStream without error', async () => { @@ -1599,8 +1586,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue( + 'ListProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() @@ -1641,12 +1632,15 @@ describe('v1.CloudBillingClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProjectBillingInfo, request) ); - assert.strictEqual( + assert( ( client.descriptors.page.listProjectBillingInfo .createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1659,8 +1653,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue( + 'ListProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProjectBillingInfo.createStream = stubPageStreamingCall(undefined, expectedError); @@ -1690,12 +1688,15 @@ describe('v1.CloudBillingClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listProjectBillingInfo, request) ); - assert.strictEqual( + assert( ( client.descriptors.page.listProjectBillingInfo .createStream as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1708,8 +1709,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue( + 'ListProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( new protos.google.cloud.billing.v1.ProjectBillingInfo() @@ -1737,12 +1742,15 @@ describe('v1.CloudBillingClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.descriptors.page.listProjectBillingInfo .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -1755,8 +1763,12 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + const defaultValue1 = getTypeDefaultValue( + 'ListProjectBillingInfoRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listProjectBillingInfo.asyncIterate = stubAsyncIterationCall(undefined, expectedError); @@ -1775,12 +1787,15 @@ describe('v1.CloudBillingClient', () => { ).getCall(0).args[1], request ); - assert.strictEqual( + assert( ( client.descriptors.page.listProjectBillingInfo .asyncIterate as SinonStub - ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index 6ec421e4c31..cb3f85f029a 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -27,6 +27,21 @@ import {PassThrough} from 'stream'; import {protobuf} from 'google-gax'; +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + function generateSampleMessage(instance: T) { const filledObject = ( instance.constructor as typeof protobuf.Message @@ -220,7 +235,6 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListServicesRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.billing.v1.Service()), generateSampleMessage(new protos.google.cloud.billing.v1.Service()), @@ -229,11 +243,6 @@ describe('v1.CloudCatalogClient', () => { client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); const [response] = await client.listServices(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServices as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes listServices without error using callback', async () => { @@ -245,7 +254,6 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListServicesRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.billing.v1.Service()), generateSampleMessage(new protos.google.cloud.billing.v1.Service()), @@ -270,11 +278,6 @@ describe('v1.CloudCatalogClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listServices as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); }); it('invokes listServices with error', async () => { @@ -286,18 +289,12 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListServicesRequest() ); - const expectedOptions = {otherArgs: {headers: {}}}; const expectedError = new Error('expected'); client.innerApiCalls.listServices = stubSimpleCall( undefined, expectedError ); await assert.rejects(client.listServices(request), expectedError); - assert( - (client.innerApiCalls.listServices as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); }); it('invokes listServicesStream without error', async () => { @@ -447,15 +444,9 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), @@ -464,11 +455,14 @@ describe('v1.CloudCatalogClient', () => { client.innerApiCalls.listSkus = stubSimpleCall(expectedResponse); const [response] = await client.listSkus(request); assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listSkus as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listSkus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSkus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listSkus without error using callback', async () => { @@ -480,15 +474,9 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), @@ -513,11 +501,14 @@ describe('v1.CloudCatalogClient', () => { }); const response = await promise; assert.deepStrictEqual(response, expectedResponse); - assert( - (client.innerApiCalls.listSkus as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions /*, callback defined above */) - ); + const actualRequest = ( + client.innerApiCalls.listSkus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSkus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listSkus with error', async () => { @@ -529,23 +520,20 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; + const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.innerApiCalls.listSkus = stubSimpleCall(undefined, expectedError); await assert.rejects(client.listSkus(request), expectedError); - assert( - (client.innerApiCalls.listSkus as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined) - ); + const actualRequest = ( + client.innerApiCalls.listSkus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSkus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); it('invokes listSkusStream without error', async () => { @@ -557,8 +545,9 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), @@ -586,10 +575,12 @@ describe('v1.CloudCatalogClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listSkus, request) ); - assert.strictEqual( - (client.descriptors.page.listSkus.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listSkus.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -602,8 +593,9 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listSkus.createStream = stubPageStreamingCall( undefined, @@ -628,10 +620,12 @@ describe('v1.CloudCatalogClient', () => { .getCall(0) .calledWith(client.innerApiCalls.listSkus, request) ); - assert.strictEqual( - (client.descriptors.page.listSkus.createStream as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listSkus.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -644,8 +638,9 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), generateSampleMessage(new protos.google.cloud.billing.v1.Sku()), @@ -664,10 +659,12 @@ describe('v1.CloudCatalogClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listSkus.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); @@ -680,8 +677,9 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - request.parent = ''; - const expectedHeaderRequestParams = 'parent='; + const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); client.descriptors.page.listSkus.asyncIterate = stubAsyncIterationCall( undefined, @@ -699,10 +697,12 @@ describe('v1.CloudCatalogClient', () => { .args[1], request ); - assert.strictEqual( - (client.descriptors.page.listSkus.asyncIterate as SinonStub).getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams + assert( + (client.descriptors.page.listSkus.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) ); }); }); From cdf2ca213a33240fddd0e7f29d5a37779b907213 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 22 Sep 2022 14:23:02 -0700 Subject: [PATCH 161/169] build: use fully qualified request type name in tests (#251) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: use fully qualified request type name in tests PiperOrigin-RevId: 475685359 Source-Link: https://github.com/googleapis/googleapis/commit/7a129736313ceb1f277c3b7f7e16d2e04cc901dd Source-Link: https://github.com/googleapis/googleapis-gen/commit/370c729e2ba062a167449c27882ba5f379c5c34d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../test/gapic_cloud_billing_v1.ts | 170 ++++++++++-------- .../test/gapic_cloud_catalog_v1.ts | 35 +++- 2 files changed, 123 insertions(+), 82 deletions(-) diff --git a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts index e10ff3ec265..a2d9f7879f8 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_billing_v1.ts @@ -235,9 +235,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); - const defaultValue1 = getTypeDefaultValue('GetBillingAccountRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.GetBillingAccountRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -265,9 +266,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); - const defaultValue1 = getTypeDefaultValue('GetBillingAccountRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.GetBillingAccountRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -311,9 +313,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); - const defaultValue1 = getTypeDefaultValue('GetBillingAccountRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.GetBillingAccountRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -341,9 +344,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.GetBillingAccountRequest() ); - const defaultValue1 = getTypeDefaultValue('GetBillingAccountRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.GetBillingAccountRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -361,9 +365,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); - const defaultValue1 = getTypeDefaultValue('UpdateBillingAccountRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.UpdateBillingAccountRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -392,9 +397,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); - const defaultValue1 = getTypeDefaultValue('UpdateBillingAccountRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.UpdateBillingAccountRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -438,9 +444,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); - const defaultValue1 = getTypeDefaultValue('UpdateBillingAccountRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.UpdateBillingAccountRequest', + ['name'] + ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); @@ -468,9 +475,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.UpdateBillingAccountRequest() ); - const defaultValue1 = getTypeDefaultValue('UpdateBillingAccountRequest', [ - 'name', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.UpdateBillingAccountRequest', + ['name'] + ); request.name = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -573,7 +581,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'GetProjectBillingInfoRequest', + '.google.cloud.billing.v1.GetProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -605,7 +613,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'GetProjectBillingInfoRequest', + '.google.cloud.billing.v1.GetProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -652,7 +660,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'GetProjectBillingInfoRequest', + '.google.cloud.billing.v1.GetProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -686,7 +694,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.GetProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'GetProjectBillingInfoRequest', + '.google.cloud.billing.v1.GetProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -710,7 +718,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'UpdateProjectBillingInfoRequest', + '.google.cloud.billing.v1.UpdateProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -742,7 +750,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'UpdateProjectBillingInfoRequest', + '.google.cloud.billing.v1.UpdateProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -789,7 +797,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'UpdateProjectBillingInfoRequest', + '.google.cloud.billing.v1.UpdateProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -823,7 +831,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.UpdateProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'UpdateProjectBillingInfoRequest', + '.google.cloud.billing.v1.UpdateProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -846,9 +854,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - const defaultValue1 = getTypeDefaultValue('GetIamPolicyRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -876,9 +885,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - const defaultValue1 = getTypeDefaultValue('GetIamPolicyRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -922,9 +932,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - const defaultValue1 = getTypeDefaultValue('GetIamPolicyRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedError = new Error('expected'); @@ -952,9 +963,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.GetIamPolicyRequest() ); - const defaultValue1 = getTypeDefaultValue('GetIamPolicyRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.GetIamPolicyRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -972,9 +984,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - const defaultValue1 = getTypeDefaultValue('SetIamPolicyRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1002,9 +1015,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - const defaultValue1 = getTypeDefaultValue('SetIamPolicyRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1048,9 +1062,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - const defaultValue1 = getTypeDefaultValue('SetIamPolicyRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1078,9 +1093,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.SetIamPolicyRequest() ); - const defaultValue1 = getTypeDefaultValue('SetIamPolicyRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.SetIamPolicyRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1098,9 +1114,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - const defaultValue1 = getTypeDefaultValue('TestIamPermissionsRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1129,9 +1146,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - const defaultValue1 = getTypeDefaultValue('TestIamPermissionsRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedResponse = generateSampleMessage( @@ -1175,9 +1193,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - const defaultValue1 = getTypeDefaultValue('TestIamPermissionsRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedHeaderRequestParams = `resource=${defaultValue1}`; const expectedError = new Error('expected'); @@ -1205,9 +1224,10 @@ describe('v1.CloudBillingClient', () => { const request = generateSampleMessage( new protos.google.iam.v1.TestIamPermissionsRequest() ); - const defaultValue1 = getTypeDefaultValue('TestIamPermissionsRequest', [ - 'resource', - ]); + const defaultValue1 = getTypeDefaultValue( + '.google.iam.v1.TestIamPermissionsRequest', + ['resource'] + ); request.resource = defaultValue1; const expectedError = new Error('The client has already been closed.'); client.close(); @@ -1458,7 +1478,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListProjectBillingInfoRequest', + '.google.cloud.billing.v1.ListProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -1498,7 +1518,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListProjectBillingInfoRequest', + '.google.cloud.billing.v1.ListProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -1553,7 +1573,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListProjectBillingInfoRequest', + '.google.cloud.billing.v1.ListProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -1587,7 +1607,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListProjectBillingInfoRequest', + '.google.cloud.billing.v1.ListProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -1654,7 +1674,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListProjectBillingInfoRequest', + '.google.cloud.billing.v1.ListProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -1710,7 +1730,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListProjectBillingInfoRequest', + '.google.cloud.billing.v1.ListProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; @@ -1764,7 +1784,7 @@ describe('v1.CloudBillingClient', () => { new protos.google.cloud.billing.v1.ListProjectBillingInfoRequest() ); const defaultValue1 = getTypeDefaultValue( - 'ListProjectBillingInfoRequest', + '.google.cloud.billing.v1.ListProjectBillingInfoRequest', ['name'] ); request.name = defaultValue1; diff --git a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts index cb3f85f029a..b8e43bb1f8d 100644 --- a/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts +++ b/packages/google-cloud-billing/test/gapic_cloud_catalog_v1.ts @@ -444,7 +444,10 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.ListSkusRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -474,7 +477,10 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.ListSkusRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -520,7 +526,10 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.ListSkusRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -545,7 +554,10 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.ListSkusRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -593,7 +605,10 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.ListSkusRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); @@ -638,7 +653,10 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.ListSkusRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ @@ -677,7 +695,10 @@ describe('v1.CloudCatalogClient', () => { const request = generateSampleMessage( new protos.google.cloud.billing.v1.ListSkusRequest() ); - const defaultValue1 = getTypeDefaultValue('ListSkusRequest', ['parent']); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.billing.v1.ListSkusRequest', + ['parent'] + ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); From 153a834c1c3cf1f467c9ec094229a698465fb804 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 3 Nov 2022 23:47:00 -0700 Subject: [PATCH 162/169] fix(deps): use google-gax v3.5.2 (#255) --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index e1de5f8ee08..de2dd25aef0 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -27,7 +27,7 @@ "precompile": "gts clean" }, "dependencies": { - "google-gax": "^3.3.0" + "google-gax": "^3.5.2" }, "devDependencies": { "@types/mocha": "^9.0.0", From 3949767a2e45a11fc4b04bbe2f2641c2d97f5364 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 10 Nov 2022 10:38:14 +0100 Subject: [PATCH 163/169] chore(deps): update dependency jsdoc to v4 (#257) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc](https://togithub.com/jsdoc/jsdoc) | [`^3.5.5` -> `^4.0.0`](https://renovatebot.com/diffs/npm/jsdoc/3.6.11/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/compatibility-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/confidence-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
jsdoc/jsdoc ### [`v4.0.0`](https://togithub.com/jsdoc/jsdoc/blob/HEAD/CHANGES.md#​400-November-2022) [Compare Source](https://togithub.com/jsdoc/jsdoc/compare/3.6.11...084218523a7d69fec14a852ce680f374f526af28) - JSDoc releases now use [semantic versioning](https://semver.org/). If JSDoc makes backwards-incompatible changes in the future, the major version will be incremented. - JSDoc no longer uses the [`taffydb`](https://taffydb.com/) package. If your JSDoc template or plugin uses the `taffydb` package, see the [instructions for replacing `taffydb` with `@jsdoc/salty`](https://togithub.com/jsdoc/jsdoc/tree/main/packages/jsdoc-salty#use-salty-in-a-jsdoc-template). - JSDoc now supports Node.js 12.0.0 and later.
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index de2dd25aef0..89a4ed37724 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -35,7 +35,7 @@ "@types/sinon": "^10.0.0", "c8": "^7.0.0", "gts": "^3.1.0", - "jsdoc": "^3.5.5", + "jsdoc": "^4.0.0", "jsdoc-fresh": "^2.0.0", "jsdoc-region-tag": "^2.0.0", "linkinator": "^4.0.0", From 7d1892e3e3d879dcc11d11e6d23874e62b33b38f Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 10 Nov 2022 11:10:16 +0100 Subject: [PATCH 164/169] chore(deps): update dependency @types/node to v18 (#253) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`^16.0.0` -> `^18.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/16.18.3/18.11.9) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/compatibility-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/confidence-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-billing). --- packages/google-cloud-billing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 89a4ed37724..77fee278a60 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "@types/mocha": "^9.0.0", - "@types/node": "^16.0.0", + "@types/node": "^18.0.0", "@types/sinon": "^10.0.0", "c8": "^7.0.0", "gts": "^3.1.0", From e792f46196300ed74083fb8fd8acf604916f070e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 10 Nov 2022 11:20:20 +0000 Subject: [PATCH 165/169] fix: regenerated protos JS and TS definitions (#258) samples: pull in latest typeless bot, clean up some comments Source-Link: https://togithub.com/googleapis/synthtool/commit/0a68e568b6911b60bb6fd452eba4848b176031d8 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:5b05f26103855c3a15433141389c478d1d3fe088fb5d4e3217c4793f6b3f245e --- .../google-cloud-billing/protos/protos.d.ts | 2 +- .../google-cloud-billing/protos/protos.js | 116 +++++++++++++++--- 2 files changed, 102 insertions(+), 16 deletions(-) diff --git a/packages/google-cloud-billing/protos/protos.d.ts b/packages/google-cloud-billing/protos/protos.d.ts index 2b6bf3e69e7..478f7a3002a 100644 --- a/packages/google-cloud-billing/protos/protos.d.ts +++ b/packages/google-cloud-billing/protos/protos.d.ts @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -import Long = require("long"); import type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); /** Namespace google. */ export namespace google { diff --git a/packages/google-cloud-billing/protos/protos.js b/packages/google-cloud-billing/protos/protos.js index ef31f67c9ac..faa7d08fa8b 100644 --- a/packages/google-cloud-billing/protos/protos.js +++ b/packages/google-cloud-billing/protos/protos.js @@ -5217,6 +5217,12 @@ return object; var message = new $root.google.cloud.billing.v1.AggregationInfo(); switch (object.aggregationLevel) { + default: + if (typeof object.aggregationLevel === "number") { + message.aggregationLevel = object.aggregationLevel; + break; + } + break; case "AGGREGATION_LEVEL_UNSPECIFIED": case 0: message.aggregationLevel = 0; @@ -5231,6 +5237,12 @@ break; } switch (object.aggregationInterval) { + default: + if (typeof object.aggregationInterval === "number") { + message.aggregationInterval = object.aggregationInterval; + break; + } + break; case "AGGREGATION_INTERVAL_UNSPECIFIED": case 0: message.aggregationInterval = 0; @@ -5268,9 +5280,9 @@ object.aggregationCount = 0; } if (message.aggregationLevel != null && message.hasOwnProperty("aggregationLevel")) - object.aggregationLevel = options.enums === String ? $root.google.cloud.billing.v1.AggregationInfo.AggregationLevel[message.aggregationLevel] : message.aggregationLevel; + object.aggregationLevel = options.enums === String ? $root.google.cloud.billing.v1.AggregationInfo.AggregationLevel[message.aggregationLevel] === undefined ? message.aggregationLevel : $root.google.cloud.billing.v1.AggregationInfo.AggregationLevel[message.aggregationLevel] : message.aggregationLevel; if (message.aggregationInterval != null && message.hasOwnProperty("aggregationInterval")) - object.aggregationInterval = options.enums === String ? $root.google.cloud.billing.v1.AggregationInfo.AggregationInterval[message.aggregationInterval] : message.aggregationInterval; + object.aggregationInterval = options.enums === String ? $root.google.cloud.billing.v1.AggregationInfo.AggregationInterval[message.aggregationInterval] === undefined ? message.aggregationInterval : $root.google.cloud.billing.v1.AggregationInfo.AggregationInterval[message.aggregationInterval] : message.aggregationInterval; if (message.aggregationCount != null && message.hasOwnProperty("aggregationCount")) object.aggregationCount = message.aggregationCount; return object; @@ -7700,6 +7712,12 @@ if (object.nameField != null) message.nameField = String(object.nameField); switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; case "HISTORY_UNSPECIFIED": case 0: message.history = 0; @@ -7724,6 +7742,10 @@ for (var i = 0; i < object.style.length; ++i) switch (object.style[i]) { default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } case "STYLE_UNSPECIFIED": case 0: message.style[i] = 0; @@ -7771,7 +7793,7 @@ if (message.nameField != null && message.hasOwnProperty("nameField")) object.nameField = message.nameField; if (message.history != null && message.hasOwnProperty("history")) - object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history; + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; if (message.plural != null && message.hasOwnProperty("plural")) object.plural = message.plural; if (message.singular != null && message.hasOwnProperty("singular")) @@ -7779,7 +7801,7 @@ if (message.style && message.style.length) { object.style = []; for (var j = 0; j < message.style.length; ++j) - object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; } return object; }; @@ -10590,6 +10612,12 @@ if (object.number != null) message.number = object.number | 0; switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; case "LABEL_OPTIONAL": case 1: message.label = 1; @@ -10604,6 +10632,12 @@ break; } switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; case "TYPE_DOUBLE": case 1: message.type = 1; @@ -10730,9 +10764,9 @@ if (message.number != null && message.hasOwnProperty("number")) object.number = message.number; if (message.label != null && message.hasOwnProperty("label")) - object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; if (message.typeName != null && message.hasOwnProperty("typeName")) object.typeName = message.typeName; if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) @@ -13079,6 +13113,12 @@ if (object.javaStringCheckUtf8 != null) message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; case "SPEED": case 1: message.optimizeFor = 1; @@ -13187,7 +13227,7 @@ if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) object.javaOuterClassname = message.javaOuterClassname; if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) object.javaMultipleFiles = message.javaMultipleFiles; if (message.goPackage != null && message.hasOwnProperty("goPackage")) @@ -13989,6 +14029,12 @@ return object; var message = new $root.google.protobuf.FieldOptions(); switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; case "STRING": case 0: message.ctype = 0; @@ -14005,6 +14051,12 @@ if (object.packed != null) message.packed = Boolean(object.packed); switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; case "JS_NORMAL": case 0: message.jstype = 0; @@ -14043,6 +14095,10 @@ for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) switch (object[".google.api.fieldBehavior"][i]) { default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } case "FIELD_BEHAVIOR_UNSPECIFIED": case 0: message[".google.api.fieldBehavior"][i] = 0; @@ -14113,7 +14169,7 @@ object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) - object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; if (message.packed != null && message.hasOwnProperty("packed")) object.packed = message.packed; if (message.deprecated != null && message.hasOwnProperty("deprecated")) @@ -14121,7 +14177,7 @@ if (message.lazy != null && message.hasOwnProperty("lazy")) object.lazy = message.lazy; if (message.jstype != null && message.hasOwnProperty("jstype")) - object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; if (message.weak != null && message.hasOwnProperty("weak")) object.weak = message.weak; if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) @@ -14134,7 +14190,7 @@ if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { object[".google.api.fieldBehavior"] = []; for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) - object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; } if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); @@ -15491,6 +15547,12 @@ if (object.deprecated != null) message.deprecated = Boolean(object.deprecated); switch (object.idempotencyLevel) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; case "IDEMPOTENCY_UNKNOWN": case 0: message.idempotencyLevel = 0; @@ -15554,7 +15616,7 @@ if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -17307,6 +17369,12 @@ if (object.end != null) message.end = object.end | 0; switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; case "NONE": case 0: message.semantic = 0; @@ -17356,7 +17424,7 @@ if (message.end != null && message.hasOwnProperty("end")) object.end = message.end; if (message.semantic != null && message.hasOwnProperty("semantic")) - object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; return object; }; @@ -20209,6 +20277,12 @@ return object; var message = new $root.google.iam.v1.AuditLogConfig(); switch (object.logType) { + default: + if (typeof object.logType === "number") { + message.logType = object.logType; + break; + } + break; case "LOG_TYPE_UNSPECIFIED": case 0: message.logType = 0; @@ -20254,7 +20328,7 @@ if (options.defaults) object.logType = options.enums === String ? "LOG_TYPE_UNSPECIFIED" : 0; if (message.logType != null && message.hasOwnProperty("logType")) - object.logType = options.enums === String ? $root.google.iam.v1.AuditLogConfig.LogType[message.logType] : message.logType; + object.logType = options.enums === String ? $root.google.iam.v1.AuditLogConfig.LogType[message.logType] === undefined ? message.logType : $root.google.iam.v1.AuditLogConfig.LogType[message.logType] : message.logType; if (message.exemptedMembers && message.exemptedMembers.length) { object.exemptedMembers = []; for (var j = 0; j < message.exemptedMembers.length; ++j) @@ -20791,6 +20865,12 @@ return object; var message = new $root.google.iam.v1.BindingDelta(); switch (object.action) { + default: + if (typeof object.action === "number") { + message.action = object.action; + break; + } + break; case "ACTION_UNSPECIFIED": case 0: message.action = 0; @@ -20836,7 +20916,7 @@ object.condition = null; } if (message.action != null && message.hasOwnProperty("action")) - object.action = options.enums === String ? $root.google.iam.v1.BindingDelta.Action[message.action] : message.action; + object.action = options.enums === String ? $root.google.iam.v1.BindingDelta.Action[message.action] === undefined ? message.action : $root.google.iam.v1.BindingDelta.Action[message.action] : message.action; if (message.role != null && message.hasOwnProperty("role")) object.role = message.role; if (message.member != null && message.hasOwnProperty("member")) @@ -21101,6 +21181,12 @@ return object; var message = new $root.google.iam.v1.AuditConfigDelta(); switch (object.action) { + default: + if (typeof object.action === "number") { + message.action = object.action; + break; + } + break; case "ACTION_UNSPECIFIED": case 0: message.action = 0; @@ -21143,7 +21229,7 @@ object.logType = ""; } if (message.action != null && message.hasOwnProperty("action")) - object.action = options.enums === String ? $root.google.iam.v1.AuditConfigDelta.Action[message.action] : message.action; + object.action = options.enums === String ? $root.google.iam.v1.AuditConfigDelta.Action[message.action] === undefined ? message.action : $root.google.iam.v1.AuditConfigDelta.Action[message.action] : message.action; if (message.service != null && message.hasOwnProperty("service")) object.service = message.service; if (message.exemptedMember != null && message.hasOwnProperty("exemptedMember")) From ce845157b607967eca4ef9782d85c5f7ea94f842 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 10 Nov 2022 17:29:24 -0800 Subject: [PATCH 166/169] chore(main): release 3.1.3 (#248) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 3.1.3 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- packages/google-cloud-billing/CHANGELOG.md | 9 +++++++++ packages/google-cloud-billing/package.json | 2 +- .../v1/snippet_metadata.google.cloud.billing.v1.json | 2 +- packages/google-cloud-billing/samples/package.json | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/google-cloud-billing/CHANGELOG.md b/packages/google-cloud-billing/CHANGELOG.md index 95de26daff6..86cb09ed140 100644 --- a/packages/google-cloud-billing/CHANGELOG.md +++ b/packages/google-cloud-billing/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [3.1.3](https://github.com/googleapis/nodejs-billing/compare/v3.1.2...v3.1.3) (2022-11-10) + + +### Bug Fixes + +* **deps:** Use google-gax v3.5.2 ([#255](https://github.com/googleapis/nodejs-billing/issues/255)) ([231ab13](https://github.com/googleapis/nodejs-billing/commit/231ab13fc1895dab416c10a7768f89d84557d10b)) +* Preserve default values in x-goog-request-params header ([#247](https://github.com/googleapis/nodejs-billing/issues/247)) ([d12b854](https://github.com/googleapis/nodejs-billing/commit/d12b854825eb1cc75426077979dd574ef08a5bf0)) +* Regenerated protos JS and TS definitions ([#258](https://github.com/googleapis/nodejs-billing/issues/258)) ([2a148e7](https://github.com/googleapis/nodejs-billing/commit/2a148e75a59ab48d405c40e8a549c4d257161332)) + ## [3.1.2](https://github.com/googleapis/nodejs-billing/compare/v3.1.1...v3.1.2) (2022-09-01) diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index 77fee278a60..b54e206d831 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/billing", - "version": "3.1.2", + "version": "3.1.3", "description": "Billing client for Node.js", "repository": "googleapis/nodejs-billing", "license": "Apache-2.0", diff --git a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json index d42ec7f62bc..1aa2814bffc 100644 --- a/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json +++ b/packages/google-cloud-billing/samples/generated/v1/snippet_metadata.google.cloud.billing.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-billing", - "version": "3.1.2", + "version": "3.1.3", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 22a224db1e1..2b149cf0e81 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/billing": "^3.1.2" + "@google-cloud/billing": "^3.1.3" }, "devDependencies": { "c8": "^7.1.0", From 174d795296353d714d299c86a1e8219edb1ec75d Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 11 Nov 2022 01:30:13 -0800 Subject: [PATCH 167/169] build: add release-please config, fix owlbot-config --- .release-please-manifest.json | 1 + .../{.github => }/.OwlBot.yaml | 6 +- packages/google-cloud-billing/.mocharc.js | 2 +- packages/google-cloud-billing/.prettierrc.js | 2 +- .../google-cloud-billing/.repo-metadata.json | 2 +- packages/google-cloud-billing/README.md | 27 +- packages/google-cloud-billing/package.json | 13 +- .../google-cloud-billing/samples/README.md | 246 +++++++++++++++++- packages/google-cloud-billing/src/index.ts | 2 +- release-please-config.json | 3 +- 10 files changed, 278 insertions(+), 26 deletions(-) rename packages/google-cloud-billing/{.github => }/.OwlBot.yaml (81%) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c3feaa284d2..c65b4aa604b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -12,6 +12,7 @@ "packages/google-cloud-bigquery-datapolicies": "0.1.2", "packages/google-cloud-bigquery-datatransfer": "3.1.5", "packages/google-cloud-bigquery-reservation": "2.0.4", + "packages/google-cloud-billing": "3.1.3", "packages/google-cloud-certificatemanager": "0.6.2", "packages/google-cloud-contentwarehouse": "0.1.2", "packages/google-cloud-dataplex": "2.2.2", diff --git a/packages/google-cloud-billing/.github/.OwlBot.yaml b/packages/google-cloud-billing/.OwlBot.yaml similarity index 81% rename from packages/google-cloud-billing/.github/.OwlBot.yaml rename to packages/google-cloud-billing/.OwlBot.yaml index 56fc8dbf595..0148aa6c6ed 100644 --- a/packages/google-cloud-billing/.github/.OwlBot.yaml +++ b/packages/google-cloud-billing/.OwlBot.yaml @@ -11,15 +11,13 @@ # WITHOUT 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/billing/(v.*)/.*-nodejs/(.*) - dest: /owl-bot-staging/$1/$2 + - source: /google/cloud/billing/(v.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-billing/$1 begin-after-commit-hash: fb91803ccef5d7c695139b22788b309e2197856b diff --git a/packages/google-cloud-billing/.mocharc.js b/packages/google-cloud-billing/.mocharc.js index 0b600509bed..cdb7b752160 100644 --- a/packages/google-cloud-billing/.mocharc.js +++ b/packages/google-cloud-billing/.mocharc.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/.prettierrc.js b/packages/google-cloud-billing/.prettierrc.js index d1b95106f4c..d546a4ad546 100644 --- a/packages/google-cloud-billing/.prettierrc.js +++ b/packages/google-cloud-billing/.prettierrc.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/packages/google-cloud-billing/.repo-metadata.json b/packages/google-cloud-billing/.repo-metadata.json index 7ee5cc0ad47..dc7338ad9f5 100644 --- a/packages/google-cloud-billing/.repo-metadata.json +++ b/packages/google-cloud-billing/.repo-metadata.json @@ -2,7 +2,7 @@ "language": "nodejs", "requires_billing": true, "product_documentation": "https://cloud.google.com/billing/docs", - "repo": "googleapis/nodejs-billing", + "repo": "googleapis/google-cloud-node", "default_version": "v1", "name_pretty": "Cloud Billing", "release_level": "stable", diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 3475973ee50..0fc351a7f7c 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Cloud Billing: Node.js Client](https://github.com/googleapis/nodejs-billing) +# [Cloud Billing: Node.js Client](https://github.com/googleapis/google-cloud-node) [![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/billing.svg)](https://www.npmjs.org/package/@google-cloud/billing) @@ -14,11 +14,11 @@ Billing client for Node.js A comprehensive list of changes in each version may be found in -[the CHANGELOG](https://github.com/googleapis/nodejs-billing/blob/main/CHANGELOG.md). +[the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-billing/CHANGELOG.md). * [Cloud Billing Node.js Client API Reference][client-docs] * [Cloud Billing Documentation][product-docs] -* [github.com/googleapis/nodejs-billing](https://github.com/googleapis/nodejs-billing) +* [github.com/googleapis/google-cloud-node/packages/google-cloud-billing](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-billing) Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in [Client Libraries Explained][explained]. @@ -84,11 +84,24 @@ listBillingAccounts(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/nodejs-billing/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. +Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/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-billing/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-billing&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | +| Cloud_billing.create_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js,samples/README.md) | +| Cloud_billing.get_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js,samples/README.md) | +| Cloud_billing.get_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js,samples/README.md) | +| Cloud_billing.get_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js,samples/README.md) | +| Cloud_billing.list_billing_accounts | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js,samples/README.md) | +| Cloud_billing.list_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js,samples/README.md) | +| Cloud_billing.set_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js,samples/README.md) | +| Cloud_billing.test_iam_permissions | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js,samples/README.md) | +| Cloud_billing.update_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js,samples/README.md) | +| Cloud_billing.update_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js,samples/README.md) | +| Cloud_catalog.list_services | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js,samples/README.md) | +| Cloud_catalog.list_skus | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/quickstart.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/test/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/test/quickstart.js,samples/README.md) | @@ -138,7 +151,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-billing/blob/main/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/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`) @@ -150,7 +163,7 @@ to its templates in Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/nodejs-billing/blob/main/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [client-docs]: https://cloud.google.com/nodejs/docs/reference/billing/latest [product-docs]: https://cloud.google.com/billing/docs diff --git a/packages/google-cloud-billing/package.json b/packages/google-cloud-billing/package.json index b54e206d831..7aa361da3bf 100644 --- a/packages/google-cloud-billing/package.json +++ b/packages/google-cloud-billing/package.json @@ -2,7 +2,11 @@ "name": "@google-cloud/billing", "version": "3.1.3", "description": "Billing client for Node.js", - "repository": "googleapis/nodejs-billing", + "repository": { + "type": "git", + "directory": "packages/google-cloud-billing", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, "license": "Apache-2.0", "author": "Google LLC", "files": [ @@ -21,9 +25,9 @@ "prelint": "cd samples; npm link ../; npm install", "predocs-test": "npm run docs", "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", + "system-test": "npm run compile && c8 mocha build/system-test", "test": "c8 mocha build/test", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", + "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test", "precompile": "gts clean" }, "dependencies": { @@ -50,5 +54,6 @@ }, "engines": { "node": ">=12.0.0" - } + }, + "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-billing" } diff --git a/packages/google-cloud-billing/samples/README.md b/packages/google-cloud-billing/samples/README.md index d294718856f..cda04e0ba9a 100644 --- a/packages/google-cloud-billing/samples/README.md +++ b/packages/google-cloud-billing/samples/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Cloud Billing: Node.js Samples](https://github.com/googleapis/nodejs-billing) +# [Cloud Billing: Node.js Samples](https://github.com/googleapis/google-cloud-node) [![Open in Cloud Shell][shell_img]][shell_link] @@ -12,12 +12,25 @@ * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Cloud_billing.create_billing_account](#cloud_billing.create_billing_account) + * [Cloud_billing.get_billing_account](#cloud_billing.get_billing_account) + * [Cloud_billing.get_iam_policy](#cloud_billing.get_iam_policy) + * [Cloud_billing.get_project_billing_info](#cloud_billing.get_project_billing_info) + * [Cloud_billing.list_billing_accounts](#cloud_billing.list_billing_accounts) + * [Cloud_billing.list_project_billing_info](#cloud_billing.list_project_billing_info) + * [Cloud_billing.set_iam_policy](#cloud_billing.set_iam_policy) + * [Cloud_billing.test_iam_permissions](#cloud_billing.test_iam_permissions) + * [Cloud_billing.update_billing_account](#cloud_billing.update_billing_account) + * [Cloud_billing.update_project_billing_info](#cloud_billing.update_project_billing_info) + * [Cloud_catalog.list_services](#cloud_catalog.list_services) + * [Cloud_catalog.list_skus](#cloud_catalog.list_skus) + * [Quickstart](#quickstart) * [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-billing#using-the-client-library). +[Using the client library](https://github.com/googleapis/google-cloud-node#using-the-client-library). `cd samples` @@ -29,16 +42,237 @@ Before running the samples, make sure you've followed the steps outlined in +### Cloud_billing.create_billing_account + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js` + + +----- + + + + +### Cloud_billing.get_billing_account + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js` + + +----- + + + + +### Cloud_billing.get_iam_policy + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js` + + +----- + + + + +### Cloud_billing.get_project_billing_info + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js` + + +----- + + + + +### Cloud_billing.list_billing_accounts + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js` + + +----- + + + + +### Cloud_billing.list_project_billing_info + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js` + + +----- + + + + +### Cloud_billing.set_iam_policy + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js` + + +----- + + + + +### Cloud_billing.test_iam_permissions + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js` + + +----- + + + + +### Cloud_billing.update_billing_account + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js` + + +----- + + + + +### Cloud_billing.update_project_billing_info + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js` + + +----- + + + + +### Cloud_catalog.list_services + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js` + + +----- + + + + +### Cloud_catalog.list_skus + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js` + + +----- + + + + +### Quickstart + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node /workspace/google-cloud-node/samples/quickstart.js` + + +----- + + + + ### Quickstart -View the [source code](https://github.com/googleapis/nodejs-billing/blob/main/samples/quickstart.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/test/quickstart.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-billing&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/test/quickstart.js,samples/README.md) __Usage:__ -`node samples/quickstart.js` +`node /workspace/google-cloud-node/samples/test/quickstart.js` @@ -46,5 +280,5 @@ __Usage:__ [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-billing&page=editor&open_in_editor=samples/README.md +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=samples/README.md [product-docs]: https://cloud.google.com/billing/docs diff --git a/packages/google-cloud-billing/src/index.ts b/packages/google-cloud-billing/src/index.ts index d7bd82d2a3f..eeea1214c9e 100644 --- a/packages/google-cloud-billing/src/index.ts +++ b/packages/google-cloud-billing/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/release-please-config.json b/release-please-config.json index 065edc12bd5..f378196596b 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -13,6 +13,7 @@ "packages/google-cloud-bigquery-datapolicies": {}, "packages/google-cloud-bigquery-datatransfer": {}, "packages/google-cloud-bigquery-reservation": {}, + "packages/google-cloud-billing": {}, "packages/google-cloud-certificatemanager": {}, "packages/google-cloud-contentwarehouse": {}, "packages/google-cloud-dataplex": {}, @@ -48,4 +49,4 @@ } ], "release-type": "node" -} \ No newline at end of file +} From fb6c269185be6f7b910133fff2a1ae079e9a56d2 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 11 Nov 2022 09:53:40 +0000 Subject: [PATCH 168/169] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= =?UTF-8?q?=20post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- packages/google-cloud-billing/README.md | 28 +++---- .../google-cloud-billing/samples/README.md | 84 +++++++++---------- release-please-config.json | 2 +- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/packages/google-cloud-billing/README.md b/packages/google-cloud-billing/README.md index 0fc351a7f7c..f91fec725cc 100644 --- a/packages/google-cloud-billing/README.md +++ b/packages/google-cloud-billing/README.md @@ -88,20 +88,20 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Cloud_billing.create_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js,samples/README.md) | -| Cloud_billing.get_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js,samples/README.md) | -| Cloud_billing.get_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js,samples/README.md) | -| Cloud_billing.get_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js,samples/README.md) | -| Cloud_billing.list_billing_accounts | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js,samples/README.md) | -| Cloud_billing.list_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js,samples/README.md) | -| Cloud_billing.set_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js,samples/README.md) | -| Cloud_billing.test_iam_permissions | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js,samples/README.md) | -| Cloud_billing.update_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js,samples/README.md) | -| Cloud_billing.update_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js,samples/README.md) | -| Cloud_catalog.list_services | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js,samples/README.md) | -| Cloud_catalog.list_skus | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/quickstart.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/test/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/test/quickstart.js,samples/README.md) | +| Cloud_billing.create_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js,samples/README.md) | +| Cloud_billing.get_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js,samples/README.md) | +| Cloud_billing.get_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js,samples/README.md) | +| Cloud_billing.get_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js,samples/README.md) | +| Cloud_billing.list_billing_accounts | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js,samples/README.md) | +| Cloud_billing.list_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js,samples/README.md) | +| Cloud_billing.set_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js,samples/README.md) | +| Cloud_billing.test_iam_permissions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js,samples/README.md) | +| Cloud_billing.update_billing_account | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js,samples/README.md) | +| Cloud_billing.update_project_billing_info | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js,samples/README.md) | +| Cloud_catalog.list_services | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js,samples/README.md) | +| Cloud_catalog.list_skus | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/quickstart.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/test/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/test/quickstart.js,samples/README.md) | diff --git a/packages/google-cloud-billing/samples/README.md b/packages/google-cloud-billing/samples/README.md index cda04e0ba9a..e03c9bc784e 100644 --- a/packages/google-cloud-billing/samples/README.md +++ b/packages/google-cloud-billing/samples/README.md @@ -44,14 +44,14 @@ Before running the samples, make sure you've followed the steps outlined in ### Cloud_billing.create_billing_account -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.create_billing_account.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.create_billing_account.js` ----- @@ -61,14 +61,14 @@ __Usage:__ ### Cloud_billing.get_billing_account -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_billing_account.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_billing_account.js` ----- @@ -78,14 +78,14 @@ __Usage:__ ### Cloud_billing.get_iam_policy -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_iam_policy.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_iam_policy.js` ----- @@ -95,14 +95,14 @@ __Usage:__ ### Cloud_billing.get_project_billing_info -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.get_project_billing_info.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.get_project_billing_info.js` ----- @@ -112,14 +112,14 @@ __Usage:__ ### Cloud_billing.list_billing_accounts -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_billing_accounts.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_billing_accounts.js` ----- @@ -129,14 +129,14 @@ __Usage:__ ### Cloud_billing.list_project_billing_info -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.list_project_billing_info.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.list_project_billing_info.js` ----- @@ -146,14 +146,14 @@ __Usage:__ ### Cloud_billing.set_iam_policy -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.set_iam_policy.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.set_iam_policy.js` ----- @@ -163,14 +163,14 @@ __Usage:__ ### Cloud_billing.test_iam_permissions -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.test_iam_permissions.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.test_iam_permissions.js` ----- @@ -180,14 +180,14 @@ __Usage:__ ### Cloud_billing.update_billing_account -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_billing_account.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_billing_account.js` ----- @@ -197,14 +197,14 @@ __Usage:__ ### Cloud_billing.update_project_billing_info -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_billing.update_project_billing_info.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_billing.update_project_billing_info.js` ----- @@ -214,14 +214,14 @@ __Usage:__ ### Cloud_catalog.list_services -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_services.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_services.js` ----- @@ -231,14 +231,14 @@ __Usage:__ ### Cloud_catalog.list_skus -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/generated/v1/cloud_catalog.list_skus.js` +`node packages/google-cloud-billing/samples/generated/v1/cloud_catalog.list_skus.js` ----- @@ -248,14 +248,14 @@ __Usage:__ ### Quickstart -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/quickstart.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/quickstart.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/quickstart.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/quickstart.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/quickstart.js` +`node packages/google-cloud-billing/samples/quickstart.js` ----- @@ -265,14 +265,14 @@ __Usage:__ ### Quickstart -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main//workspace/google-cloud-node/samples/test/quickstart.js). +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-billing/samples/test/quickstart.js). -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=/workspace/google-cloud-node/samples/test/quickstart.js,samples/README.md) +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-billing/samples/test/quickstart.js,samples/README.md) __Usage:__ -`node /workspace/google-cloud-node/samples/test/quickstart.js` +`node packages/google-cloud-billing/samples/test/quickstart.js` diff --git a/release-please-config.json b/release-please-config.json index f378196596b..5416a0e49a6 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -49,4 +49,4 @@ } ], "release-type": "node" -} +} \ No newline at end of file From 00e119b30d032435ae4de28053af9188395c892c Mon Sep 17 00:00:00 2001 From: Sofia Leon Date: Fri, 11 Nov 2022 14:36:46 -0800 Subject: [PATCH 169/169] update samples/package.json --- packages/google-cloud-billing/samples/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google-cloud-billing/samples/package.json b/packages/google-cloud-billing/samples/package.json index 2b149cf0e81..ca5c7116e7e 100644 --- a/packages/google-cloud-billing/samples/package.json +++ b/packages/google-cloud-billing/samples/package.json @@ -20,4 +20,4 @@ "chai": "^4.2.0", "mocha": "^8.0.0" } -} \ No newline at end of file +}