diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c3feaa284d2..c38b0a70276 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -22,6 +22,7 @@ "packages/google-cloud-gkemulticloud": "0.1.4", "packages/google-cloud-language": "5.1.2", "packages/google-cloud-memcache": "2.1.4", + "packages/google-cloud-monitoring": "3.0.3", "packages/google-cloud-oslogin": "4.0.4", "packages/google-cloud-phishingprotection": "3.0.6", "packages/google-cloud-policytroubleshooter": "2.0.6", diff --git a/packages/google-cloud-monitoring/.OwlBot.yaml b/packages/google-cloud-monitoring/.OwlBot.yaml new file mode 100644 index 00000000000..61c518e89e9 --- /dev/null +++ b/packages/google-cloud-monitoring/.OwlBot.yaml @@ -0,0 +1,24 @@ +# 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. + + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/monitoring/(v.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-monitoring/$1 + +begin-after-commit-hash: ed3195d0a29ae8c2608dc5a2aa2590554a3f9d14 + diff --git a/packages/google-cloud-monitoring/.eslintignore b/packages/google-cloud-monitoring/.eslintignore new file mode 100644 index 00000000000..ea5b04aebe6 --- /dev/null +++ b/packages/google-cloud-monitoring/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ +samples/generated/ diff --git a/packages/google-cloud-monitoring/.eslintrc.json b/packages/google-cloud-monitoring/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-monitoring/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-monitoring/.gitattributes b/packages/google-cloud-monitoring/.gitattributes new file mode 100644 index 00000000000..33739cb74e4 --- /dev/null +++ b/packages/google-cloud-monitoring/.gitattributes @@ -0,0 +1,4 @@ +*.ts text eol=lf +*.js text eol=lf +protos/* linguist-generated +**/api-extractor.json linguist-language=JSON-with-Comments diff --git a/packages/google-cloud-monitoring/.gitignore b/packages/google-cloud-monitoring/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-monitoring/.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-monitoring/.jsdoc.js b/packages/google-cloud-monitoring/.jsdoc.js new file mode 100644 index 00000000000..4c8fbdf61b0 --- /dev/null +++ b/packages/google-cloud-monitoring/.jsdoc.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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/monitoring', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-monitoring/.mocharc.js b/packages/google-cloud-monitoring/.mocharc.js new file mode 100644 index 00000000000..cdb7b752160 --- /dev/null +++ b/packages/google-cloud-monitoring/.mocharc.js @@ -0,0 +1,29 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000, + "recursive": true +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/packages/google-cloud-monitoring/.nycrc b/packages/google-cloud-monitoring/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /dev/null +++ b/packages/google-cloud-monitoring/.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-monitoring/.prettierignore b/packages/google-cloud-monitoring/.prettierignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-monitoring/.prettierignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-monitoring/.prettierrc.js b/packages/google-cloud-monitoring/.prettierrc.js new file mode 100644 index 00000000000..d546a4ad546 --- /dev/null +++ b/packages/google-cloud-monitoring/.prettierrc.js @@ -0,0 +1,17 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/packages/google-cloud-monitoring/.readme-partials.yml b/packages/google-cloud-monitoring/.readme-partials.yml new file mode 100644 index 00000000000..7d23bee5856 --- /dev/null +++ b/packages/google-cloud-monitoring/.readme-partials.yml @@ -0,0 +1,4 @@ +introduction: |- + [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs) collects metrics, events, and metadata from + Google Cloud Platform, Amazon Web Services (AWS), hosted uptime probes, application instrumentation, + and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch and many others. diff --git a/packages/google-cloud-monitoring/.repo-metadata.json b/packages/google-cloud-monitoring/.repo-metadata.json new file mode 100644 index 00000000000..537daec5c13 --- /dev/null +++ b/packages/google-cloud-monitoring/.repo-metadata.json @@ -0,0 +1,16 @@ +{ + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/monitoring/latest", + "product_documentation": "https://cloud.google.com/monitoring/docs", + "name": "monitoring", + "requires_billing": true, + "release_level": "stable", + "language": "nodejs", + "api_id": "monitoring.googleapis.com", + "distribution_name": "@google-cloud/monitoring", + "repo": "googleapis/google-cloud-node", + "issue_tracker": "https://issuetracker.google.com/savedsearches/559785", + "name_pretty": "Stackdriver Monitoring", + "default_version": "v3", + "api_shortname": "monitoring", + "library_type": "GAPIC_AUTO" +} diff --git a/packages/google-cloud-monitoring/CHANGELOG.md b/packages/google-cloud-monitoring/CHANGELOG.md new file mode 100644 index 00000000000..72a95cc0381 --- /dev/null +++ b/packages/google-cloud-monitoring/CHANGELOG.md @@ -0,0 +1,498 @@ +# Changelog + +[npm history][1] + +[1]: https://www.npmjs.com/package/@google-cloud/monitoring?activeTab=versions + +## [3.0.3](https://github.com/googleapis/nodejs-monitoring/compare/v3.0.2...v3.0.3) (2022-11-11) + + +### Bug Fixes + +* **deps:** Use google-gax v3.5.2 ([#647](https://github.com/googleapis/nodejs-monitoring/issues/647)) ([bb6a564](https://github.com/googleapis/nodejs-monitoring/commit/bb6a56486913d06994b3e8c3f1ecd6f9ab38f3db)) +* update proto definitions ([28c9ff7](https://github.com/googleapis/nodejs-monitoring/commit/28c9ff76f052f1f1232ea98ba1be0cca7f5f9826)) +* Update proto definitions([#651](https://github.com/googleapis/nodejs-monitoring/issues/651)) ([28c9ff7](https://github.com/googleapis/nodejs-monitoring/commit/28c9ff76f052f1f1232ea98ba1be0cca7f5f9826)) + +## [3.0.2](https://github.com/googleapis/nodejs-monitoring/compare/v3.0.1...v3.0.2) (2022-09-09) + + +### Bug Fixes + +* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-monitoring/issues/1553)) ([#627](https://github.com/googleapis/nodejs-monitoring/issues/627)) ([647e8ab](https://github.com/googleapis/nodejs-monitoring/commit/647e8abda29928143953929c3ef0113ea88e9e9c)) +* use google-gax v3.3.0 ([647e8ab](https://github.com/googleapis/nodejs-monitoring/commit/647e8abda29928143953929c3ef0113ea88e9e9c)) + +## [3.0.1](https://github.com/googleapis/nodejs-monitoring/compare/v3.0.0...v3.0.1) (2022-08-23) + + +### Bug Fixes + +* change import long to require ([#624](https://github.com/googleapis/nodejs-monitoring/issues/624)) ([5cd302e](https://github.com/googleapis/nodejs-monitoring/commit/5cd302e9bb803ce2b2da844faaccacadac73f833)) +* remove pip install statements ([#1546](https://github.com/googleapis/nodejs-monitoring/issues/1546)) ([#626](https://github.com/googleapis/nodejs-monitoring/issues/626)) ([7f1f9c6](https://github.com/googleapis/nodejs-monitoring/commit/7f1f9c6f226c9abc48d9da4d6a452312ce3085d2)) + +## [3.0.0](https://github.com/googleapis/nodejs-monitoring/compare/v2.3.5...v3.0.0) (2022-05-20) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#617) + +### Build System + +* update library to use Node 12 ([#617](https://github.com/googleapis/nodejs-monitoring/issues/617)) ([965e533](https://github.com/googleapis/nodejs-monitoring/commit/965e5333b6a0561e9147ab940ff1a582207e91ff)) + +### [2.3.5](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.3.4...v2.3.5) (2021-09-08) + + +### Bug Fixes + +* **build:** update branch to main ([#574](https://www.github.com/googleapis/nodejs-monitoring/issues/574)) ([955622f](https://www.github.com/googleapis/nodejs-monitoring/commit/955622f40583247a78301340fc172c9d42fa1354)) + +### [2.3.4](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.3.3...v2.3.4) (2021-08-17) + + +### Bug Fixes + +* **deps:** google-gax v2.24.1 ([#570](https://www.github.com/googleapis/nodejs-monitoring/issues/570)) ([368febb](https://www.github.com/googleapis/nodejs-monitoring/commit/368febba05606ccb71cdee0efc75255acac7d75d)) + +### [2.3.3](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.3.2...v2.3.3) (2021-07-16) + + +### Bug Fixes + +* **deps:** require google-gax v2.17.1 ([#558](https://www.github.com/googleapis/nodejs-monitoring/issues/558)) ([e15ade6](https://www.github.com/googleapis/nodejs-monitoring/commit/e15ade6476338ada88e31fe07f480d73739073ad)) + +### [2.3.3](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.3.2...v2.3.3) (2021-07-16) + + +### Bug Fixes + +* **deps:** require google-gax v2.17.1 ([#558](https://www.github.com/googleapis/nodejs-monitoring/issues/558)) ([e15ade6](https://www.github.com/googleapis/nodejs-monitoring/commit/e15ade6476338ada88e31fe07f480d73739073ad)) + +### [2.3.2](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.3.1...v2.3.2) (2021-06-29) + + +### Bug Fixes + +* **deps:** google-gax v2.17.0 with mTLS ([#552](https://www.github.com/googleapis/nodejs-monitoring/issues/552)) ([43c9ddd](https://www.github.com/googleapis/nodejs-monitoring/commit/43c9dddbd75668da5e7c0b2608346e8f04402e7e)) + +### [2.3.1](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.3.0...v2.3.1) (2021-05-12) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#534](https://www.github.com/googleapis/nodejs-monitoring/issues/534)) ([ce7e9e1](https://www.github.com/googleapis/nodejs-monitoring/commit/ce7e9e1b7527fc1a4b55960596237e4cd2c43e3b)) + +## [2.3.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.2.0...v2.3.0) (2021-03-24) + + +### Features + +* Added support for Monitoring Query Language: https://cloud.google.com/monitoring/mql feat: Added support for units in the MetricService feat: Added total_size to the response of ListAlertPolicies. fix: Un-deprecated cluster_istio for service monitoring. feat: Added IstioCanonicalService for service monitoring. feat: Added creation and mutation records to notification channels. feat: Added support for querying metrics for folders and organizations. fix: Extended the default deadline for UpdateGroup to 180s. feat: Added support for secondary aggregation when querying metrics. ([#523](https://www.github.com/googleapis/nodejs-monitoring/issues/523)) ([cab3fdb](https://www.github.com/googleapis/nodejs-monitoring/commit/cab3fdb02c41149ae40e3a28987bb7ffeed050ac)) + +## [2.2.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.1.5...v2.2.0) (2021-01-09) + + +### Features + +* adds style enumeration ([#513](https://www.github.com/googleapis/nodejs-monitoring/issues/513)) ([2ca2169](https://www.github.com/googleapis/nodejs-monitoring/commit/2ca2169553c90a588cc8c7374d4790da3bf122f2)) + +### [2.1.5](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.1.4...v2.1.5) (2021-01-07) + + +### Bug Fixes + +* update alert policies one at a time because (concurrent updates are not supported) ([#507](https://www.github.com/googleapis/nodejs-monitoring/issues/507)) ([2bf75a2](https://www.github.com/googleapis/nodejs-monitoring/commit/2bf75a2294f82d3b75e0ee3d44c91b0b8e5ec358)) + +### [2.1.4](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.1.3...v2.1.4) (2020-11-25) + + +### Bug Fixes + +* **browser:** check for fetch on window ([#501](https://www.github.com/googleapis/nodejs-monitoring/issues/501)) ([a923606](https://www.github.com/googleapis/nodejs-monitoring/commit/a9236060fdd4516e5f3fa31a5bf76895ad8bf6c1)) + +### [2.1.3](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.1.2...v2.1.3) (2020-11-07) + + +### Bug Fixes + +* do not modify options object, use defaultScopes ([#497](https://www.github.com/googleapis/nodejs-monitoring/issues/497)) ([447cfce](https://www.github.com/googleapis/nodejs-monitoring/commit/447cfce75ed11d66e254d72d105252e8b0ed0a3c)) + +### [2.1.2](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.1.1...v2.1.2) (2020-09-12) + + +### Bug Fixes + +* **deps:** update dependency yargs to v16 ([#480](https://www.github.com/googleapis/nodejs-monitoring/issues/480)) ([188c55a](https://www.github.com/googleapis/nodejs-monitoring/commit/188c55a4126fbf2180fa116985bf3cbdd3c46ce8)) + +### [2.1.1](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.1.0...v2.1.1) (2020-07-24) + + +### Bug Fixes + +* move gitattributes files to node templates ([#464](https://www.github.com/googleapis/nodejs-monitoring/issues/464)) ([db2d19d](https://www.github.com/googleapis/nodejs-monitoring/commit/db2d19d9170eb10d8f2c779589e623222991d393)) + +## [2.1.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v2.0.0...v2.1.0) (2020-06-18) + + +### Features + +* move ts target to es2018 from es2016 ([#440](https://www.github.com/googleapis/nodejs-monitoring/issues/440)) ([f57200d](https://www.github.com/googleapis/nodejs-monitoring/commit/f57200d611a52fe1ba4c3646978f3034ee6df412)) + + +### Bug Fixes + +* proper fallback option handling ([81f52b7](https://www.github.com/googleapis/nodejs-monitoring/commit/81f52b7a697ac4f953644a81ad13aaff4b19570f)) +* update node issue template ([#447](https://www.github.com/googleapis/nodejs-monitoring/issues/447)) ([5f08bf8](https://www.github.com/googleapis/nodejs-monitoring/commit/5f08bf88f8caa969800582d6eb408759ba240278)) + +## [2.0.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.7.0...v2.0.0) (2020-05-08) + + +### ⚠ BREAKING CHANGES + +* Drop support for TimeSeriesQueryLanguageCondition as an alert condition type +* The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. +* monitoring convert to typescript (#360) + +### Features + +* deferred client initialization ([#378](https://www.github.com/googleapis/nodejs-monitoring/issues/378)) ([61eca6a](https://www.github.com/googleapis/nodejs-monitoring/commit/61eca6a6f4447fe5a8d30ee6c40034fb1f7bbb60)) +* drop node8 support, support for async iterators ([#396](https://www.github.com/googleapis/nodejs-monitoring/issues/396)) ([d65e8fb](https://www.github.com/googleapis/nodejs-monitoring/commit/d65e8fb8e8901d7023dba3c226a09ec3782fc0c5)) +* export protos in src/index.ts ([#369](https://www.github.com/googleapis/nodejs-monitoring/issues/369)) ([b0af4b1](https://www.github.com/googleapis/nodejs-monitoring/commit/b0af4b1b48254f91ec9aa9cead1ff0a6714a6393)) +* monitoring convert to typescript ([#360](https://www.github.com/googleapis/nodejs-monitoring/issues/360)) ([5bbd963](https://www.github.com/googleapis/nodejs-monitoring/commit/5bbd96307cc47066b00048e494bfa566ea58650d)) +* refresh monitoring client libraries ([#401](https://www.github.com/googleapis/nodejs-monitoring/issues/401)) ([efd6e6f](https://www.github.com/googleapis/nodejs-monitoring/commit/efd6e6f4e1596ba4e5a3ba63f12c868735d4c571)) +* Update public client library for Cloud Monitoring to introduce new Uptime check feature. Uptime HTTP(S) checks can now be GET or POST ([#425](https://www.github.com/googleapis/nodejs-monitoring/issues/425)) ([103afde](https://www.github.com/googleapis/nodejs-monitoring/commit/103afdedfc6a874f71f866c9e07ef8cbfa70fb8b)) + + +### Bug Fixes + +* regen protos and tests, formatting ([#429](https://www.github.com/googleapis/nodejs-monitoring/issues/429)) ([9e6afc8](https://www.github.com/googleapis/nodejs-monitoring/commit/9e6afc87cc0fcc323539f3bf8dc8e15d66c144b7)) +* remove eslint, update gax, fix generated protos, run the generator ([#415](https://www.github.com/googleapis/nodejs-monitoring/issues/415)) ([ed8d95e](https://www.github.com/googleapis/nodejs-monitoring/commit/ed8d95efec1820a41d893273443172e3fbd2781c)) +* synth.py clean up for multiple version ([#431](https://www.github.com/googleapis/nodejs-monitoring/issues/431)) ([4e0e5bb](https://www.github.com/googleapis/nodejs-monitoring/commit/4e0e5bb3c6bc2cb3f3a368c3199f605f24c21dda)) +* updated proto files with new proto annotations ([cf8cc77](https://www.github.com/googleapis/nodejs-monitoring/commit/cf8cc770ec5fa17874fd67df1469ffa3b2724628)) + + +### Code Refactoring + +* Drop support for TimeSeriesQueryLanguageCondition as an alert condition type ([866c028](https://www.github.com/googleapis/nodejs-monitoring/commit/866c0282ca2da53b0f9b42a2a1977446f7e368ae)) + +## [1.7.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.6.1...v1.7.0) (2019-12-31) + + +### Features + +* adds ContentMatcherOption ([#336](https://www.github.com/googleapis/nodejs-monitoring/issues/336)) ([003b8f7](https://www.github.com/googleapis/nodejs-monitoring/commit/003b8f7bc30c79b11aa393f0272e2554761707d4)) + +### [1.6.1](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.6.0...v1.6.1) (2019-12-05) + + +### Bug Fixes + +* **deps:** TypeScript 3.7.0 causes breaking change in typings ([#339](https://www.github.com/googleapis/nodejs-monitoring/issues/339)) ([3616df7](https://www.github.com/googleapis/nodejs-monitoring/commit/3616df79a5b23a0eae1bb899e7a6a4c45d7cee7e)) +* **deps:** update dependency yargs to v15 ([#333](https://www.github.com/googleapis/nodejs-monitoring/issues/333)) ([dd3ba97](https://www.github.com/googleapis/nodejs-monitoring/commit/dd3ba97f7506577c264f40353d403ac62ce9951b)) +* **docs:** bump release level to GA ([#335](https://www.github.com/googleapis/nodejs-monitoring/issues/335)) ([839a25b](https://www.github.com/googleapis/nodejs-monitoring/commit/839a25b443ec0c65ed18822f5ca305ab0737fa71)) + +## [1.6.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.5.0...v1.6.0) (2019-11-15) + + +### Features + +* add service api support ([#325](https://www.github.com/googleapis/nodejs-monitoring/issues/325)) ([dbc3680](https://www.github.com/googleapis/nodejs-monitoring/commit/dbc36809baeef4fe860da898face3d04103cca63)) +* Introduced detailed status message for CreateTimeSeries: CreateTimeSeriesSummary replaces CreateTimeSeriesError, which is now deprecated and unused ([46e0661](https://www.github.com/googleapis/nodejs-monitoring/commit/46e0661286f8b59c4124338477c5104cd1f5a099)) + + +### Bug Fixes + +* **docs:** snippets are now replaced in jsdoc comments ([#324](https://www.github.com/googleapis/nodejs-monitoring/issues/324)) ([6d81605](https://www.github.com/googleapis/nodejs-monitoring/commit/6d8160596340a0c3ee9f4540e505d3e329a532eb)) + +## [1.5.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.4.0...v1.5.0) (2019-10-22) + + +### Features + +* add is_internal option ([#312](https://www.github.com/googleapis/nodejs-monitoring/issues/312)) ([a2dbb0b](https://www.github.com/googleapis/nodejs-monitoring/commit/a2dbb0b8df925317f01a193038ad520f0c8c43e7)) + + +### Bug Fixes + +* **deps:** bump google-gax to 1.7.5 ([#313](https://www.github.com/googleapis/nodejs-monitoring/issues/313)) ([faf0efa](https://www.github.com/googleapis/nodejs-monitoring/commit/faf0efa5caa535d0cf16d10143a48a0c545e2074)) + +## [1.4.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.3.0...v1.4.0) (2019-10-12) + + +### Features + +* .d.ts for protos ([#298](https://www.github.com/googleapis/nodejs-monitoring/issues/298)) ([dc6e8a1](https://www.github.com/googleapis/nodejs-monitoring/commit/dc6e8a1b82b41638ad873ec35007415f602c8b0b)) + + +### Bug Fixes + +* update sample for enabling or disabling a policy ([#305](https://www.github.com/googleapis/nodejs-monitoring/issues/305)) ([fd84c71](https://www.github.com/googleapis/nodejs-monitoring/commit/fd84c71ab4511c11963c8480cda70117f78f8651)) +* use compatible version of google-gax ([c210d32](https://www.github.com/googleapis/nodejs-monitoring/commit/c210d320a392fb33e6a6779ae4d727a6970326da)) + +## [1.3.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.2.3...v1.3.0) (2019-09-16) + + +### Bug Fixes + +* **deps:** update dependency yargs to v14 ([68a0867](https://www.github.com/googleapis/nodejs-monitoring/commit/68a0867)) +* include the correct version of node in a header ([#286](https://www.github.com/googleapis/nodejs-monitoring/issues/286)) ([0c758f9](https://www.github.com/googleapis/nodejs-monitoring/commit/0c758f9)) + + +### Features + +* load protos from JSON, grpc-fallback support ([435c5d0](https://www.github.com/googleapis/nodejs-monitoring/commit/435c5d0)) +* **GroupServiceClient:** support recursive option when deleting group ([#294](https://www.github.com/googleapis/nodejs-monitoring/issues/294)) ([f7749af](https://www.github.com/googleapis/nodejs-monitoring/commit/f7749af)) + +### [1.2.3](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.2.2...v1.2.3) (2019-08-03) + + +### Bug Fixes + +* allow calls with no request, add JSON proto ([3a8a89b](https://www.github.com/googleapis/nodejs-monitoring/commit/3a8a89b)) + +### [1.2.2](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.2.1...v1.2.2) (2019-06-26) + + +### Bug Fixes + +* **docs:** link to reference docs section on googleapis.dev ([#273](https://www.github.com/googleapis/nodejs-monitoring/issues/273)) ([d4056d6](https://www.github.com/googleapis/nodejs-monitoring/commit/d4056d6)) + +### [1.2.1](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.2.0...v1.2.1) (2019-06-14) + + +### Bug Fixes + +* **docs:** move to new client docs URL ([#269](https://www.github.com/googleapis/nodejs-monitoring/issues/269)) ([cba6442](https://www.github.com/googleapis/nodejs-monitoring/commit/cba6442)) + +## [1.2.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.1.0...v1.2.0) (2019-06-06) + + +### Features + +* add .repo-metadata for README generation ([#263](https://www.github.com/googleapis/nodejs-monitoring/issues/263)) ([d966bd6](https://www.github.com/googleapis/nodejs-monitoring/commit/d966bd6)) + +## [1.1.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v1.0.0...v1.1.0) (2019-06-05) + + +### Features + +* support apiEndpoint override in client constructor ([#265](https://www.github.com/googleapis/nodejs-monitoring/issues/265)) ([8a413bc](https://www.github.com/googleapis/nodejs-monitoring/commit/8a413bc)) + +## [1.0.0](https://www.github.com/googleapis/nodejs-monitoring/compare/v0.7.1...v1.0.0) (2019-05-20) + + +### ⚠ BREAKING CHANGES + +* upgrade engines field to >=8.10.0 (#241) + +### Bug Fixes + +* include 'x-goog-request-params' header in requests ([#233](https://www.github.com/googleapis/nodejs-monitoring/issues/233)) ([54733ef](https://www.github.com/googleapis/nodejs-monitoring/commit/54733ef)) +* **deps:** update dependency google-gax to ^0.26.0 ([#240](https://www.github.com/googleapis/nodejs-monitoring/issues/240)) ([da50ee8](https://www.github.com/googleapis/nodejs-monitoring/commit/da50ee8)) +* **deps:** update dependency google-gax to v1 ([#249](https://www.github.com/googleapis/nodejs-monitoring/issues/249)) ([896141a](https://www.github.com/googleapis/nodejs-monitoring/commit/896141a)) + + +### Build System + +* upgrade engines field to >=8.10.0 ([#241](https://www.github.com/googleapis/nodejs-monitoring/issues/241)) ([6e7587d](https://www.github.com/googleapis/nodejs-monitoring/commit/6e7587d)) + +## v0.7.1 + +03-13-2019 15:05 PDT + +### Bug Fixes +- fix: throw on invalid credentials ([#216](https://github.com/googleapis/nodejs-monitoring/pull/216)) + +### Dependencies +- fix(deps): update dependency google-gax to ^0.25.0 ([#204](https://github.com/googleapis/nodejs-monitoring/pull/204)) + +### Documentation +- docs: update links in contrib guide ([#215](https://github.com/googleapis/nodejs-monitoring/pull/215)) +- docs: update contributing path in README ([#210](https://github.com/googleapis/nodejs-monitoring/pull/210)) +- docs: move CONTRIBUTING.md to root ([#209](https://github.com/googleapis/nodejs-monitoring/pull/209)) +- docs: add lint/fix example to contributing guide ([#206](https://github.com/googleapis/nodejs-monitoring/pull/206)) + +### Internal / Testing Changes +- refactor: update json import paths ([#224](https://github.com/googleapis/nodejs-monitoring/pull/224)) +- chore(deps): update dependency p-retry to v4 ([#223](https://github.com/googleapis/nodejs-monitoring/pull/223)) +- build: Add docuploader credentials to node publish jobs ([#221](https://github.com/googleapis/nodejs-monitoring/pull/221)) +- build: use node10 to run samples-test, system-test etc ([#220](https://github.com/googleapis/nodejs-monitoring/pull/220)) +- build: update release configuration +- chore: update proto docs and code style +- chore(deps): update dependency mocha to v6 ([#217](https://github.com/googleapis/nodejs-monitoring/pull/217)) +- refactor: update the generated code style ([#208](https://github.com/googleapis/nodejs-monitoring/pull/208)) +- build: use linkinator for docs test ([#214](https://github.com/googleapis/nodejs-monitoring/pull/214)) +- fix(deps): update dependency yargs to v13 ([#213](https://github.com/googleapis/nodejs-monitoring/pull/213)) +- build: create docs test npm scripts ([#212](https://github.com/googleapis/nodejs-monitoring/pull/212)) +- build: test using @grpc/grpc-js in CI ([#211](https://github.com/googleapis/nodejs-monitoring/pull/211)) +- chore(deps): update dependency eslint-config-prettier to v4 ([#203](https://github.com/googleapis/nodejs-monitoring/pull/203)) +- build: ignore googleapis.com in doc link check ([#201](https://github.com/googleapis/nodejs-monitoring/pull/201)) +- chore: update year in the license headers. ([#200](https://github.com/googleapis/nodejs-monitoring/pull/200)) + +## v0.7.0 + +01-15-2019 09:35 PST + +### Dependencies +- fix(deps): update dependency google-gax to ^0.23.0 ([#196](https://github.com/googleapis/nodejs-monitoring/pull/196)) +- refactor: remove unused deps + +### Documentation +- doc: remove unused gRPC types +- docs: add samples for channel notification ([#185](https://github.com/googleapis/nodejs-monitoring/pull/185)) +- docs: update readme badges ([#171](https://github.com/googleapis/nodejs-monitoring/pull/171)) +- docs(samples): convert samples to async/await, and use mocha for tests ([#146](https://github.com/googleapis/nodejs-monitoring/pull/146)) +- docs: update proto comments ([#159](https://github.com/googleapis/nodejs-monitoring/pull/159)) +- docs: fix link in changelog ([#132](https://github.com/googleapis/nodejs-monitoring/pull/132)) + +### Internal / Testing Changes +- build: check broken links in generated docs ([#194](https://github.com/googleapis/nodejs-monitoring/pull/194)) +- refactor: modernize and fix the sample tests ([#193](https://github.com/googleapis/nodejs-monitoring/pull/193)) +- chore: fix name of region tag ([#188](https://github.com/googleapis/nodejs-monitoring/pull/188)) +- chore: fix region tags ([#187](https://github.com/googleapis/nodejs-monitoring/pull/187)) +- chore(build): inject yoshi automation key ([#186](https://github.com/googleapis/nodejs-monitoring/pull/186)) +- chore: update nyc and eslint configs ([#184](https://github.com/googleapis/nodejs-monitoring/pull/184)) +- chore: fix publish.sh permission +x ([#182](https://github.com/googleapis/nodejs-monitoring/pull/182)) +- fix(build): fix Kokoro release script ([#181](https://github.com/googleapis/nodejs-monitoring/pull/181)) +- build: add Kokoro configs for autorelease ([#180](https://github.com/googleapis/nodejs-monitoring/pull/180)) +- chore: always nyc report before calling codecov ([#177](https://github.com/googleapis/nodejs-monitoring/pull/177)) +- chore: nyc ignore build/test by default ([#175](https://github.com/googleapis/nodejs-monitoring/pull/175)) +- chore: update license file ([#173](https://github.com/googleapis/nodejs-monitoring/pull/173)) +- fix(build): fix system key decryption ([#169](https://github.com/googleapis/nodejs-monitoring/pull/169)) +- chore: add a synth.metadata +- test: fix failing tests due to leaks ([#163](https://github.com/googleapis/nodejs-monitoring/pull/163)) +- chore: update eslintignore config ([#160](https://github.com/googleapis/nodejs-monitoring/pull/160)) +- chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 ([#158](https://github.com/googleapis/nodejs-monitoring/pull/158)) +- chore: drop contributors from multiple places ([#156](https://github.com/googleapis/nodejs-monitoring/pull/156)) +- chore: use latest npm on Windows ([#154](https://github.com/googleapis/nodejs-monitoring/pull/154)) +- chore: update CircleCI config ([#151](https://github.com/googleapis/nodejs-monitoring/pull/151)) +- chore: include build in eslintignore ([#148](https://github.com/googleapis/nodejs-monitoring/pull/148)) +- chore(deps): update dependency eslint-plugin-node to v8 ([#143](https://github.com/googleapis/nodejs-monitoring/pull/143)) +- feat: run the generator +- chore: update new issue templates +- chore(build): fix the synth file and generation +- chore: remove old issue template ([#140](https://github.com/googleapis/nodejs-monitoring/pull/140)) +- build: run tests on node11 ([#139](https://github.com/googleapis/nodejs-monitoring/pull/139)) +- chores(build): do not collect sponge.xml from windows builds ([#138](https://github.com/googleapis/nodejs-monitoring/pull/138)) +- chores(build): run codecov on continuous builds ([#137](https://github.com/googleapis/nodejs-monitoring/pull/137)) +- build: fix codecov uploading on Kokoro ([#134](https://github.com/googleapis/nodejs-monitoring/pull/134)) +- chore(deps): update dependency sinon to v7 ([#133](https://github.com/googleapis/nodejs-monitoring/pull/133)) +- chore(deps): update dependency eslint-plugin-prettier to v3 ([#131](https://github.com/googleapis/nodejs-monitoring/pull/131)) +- test: remove appveyor config ([#127](https://github.com/googleapis/nodejs-monitoring/pull/127)) +- Fix failing sample tests ([#126](https://github.com/googleapis/nodejs-monitoring/pull/126)) +- Enable prefer-const in the eslint config ([#124](https://github.com/googleapis/nodejs-monitoring/pull/124)) +- Fix the linter ([#123](https://github.com/googleapis/nodejs-monitoring/pull/123)) +- Enable no-var in eslint ([#122](https://github.com/googleapis/nodejs-monitoring/pull/122)) +- run synth.py to fix system-test ([#117](https://github.com/googleapis/nodejs-monitoring/pull/117)) +- Retry npm install in CI ([#115](https://github.com/googleapis/nodejs-monitoring/pull/115)) +- Update CircleCI and Kokoro config ([#113](https://github.com/googleapis/nodejs-monitoring/pull/113)) +- chore(deps): update dependency nyc to v13 ([#111](https://github.com/googleapis/nodejs-monitoring/pull/111)) +- Update the CI config ([#109](https://github.com/googleapis/nodejs-monitoring/pull/109)) +- chore: make the CircleCI config consistent +- fix(deps): update dependency @google-cloud/monitoring to ^0.6.0 ([#104](https://github.com/googleapis/nodejs-monitoring/pull/104)) +- chore(build): make the CircleCI config consistent +- build: node templates ([#101](https://github.com/googleapis/nodejs-monitoring/pull/101)) + +## v0.6.0 + +01-14-2019 14:34 PST + +### Dependencies +- fix(deps): update dependency google-gax to ^0.23.0 ([#196](https://github.com/googleapis/nodejs-monitoring/pull/196)) +- refactor: remove unused deps + +### Documentation +- docs: remove unused gRPC types +- docs(samples): add samples for channel notification ([#185](https://github.com/googleapis/nodejs-monitoring/pull/185)) +- docs: update readme badges ([#171](https://github.com/googleapis/nodejs-monitoring/pull/171)) +- docs(samples): convert samples to async/await, and use mocha for tests ([#146](https://github.com/googleapis/nodejs-monitoring/pull/146)) +- docs: update proto comments ([#159](https://github.com/googleapis/nodejs-monitoring/pull/159)) +- docs: fix link in changelog ([#132](https://github.com/googleapis/nodejs-monitoring/pull/132)) + +### Internal / Testing Changes +- refactor: modernize and fix the sample tests ([#193](https://github.com/googleapis/nodejs-monitoring/pull/193)) +- chore: fix name of region tag ([#188](https://github.com/googleapis/nodejs-monitoring/pull/188)) +- chore: fix region tags ([#187](https://github.com/googleapis/nodejs-monitoring/pull/187)) +- chore(build): inject yoshi automation key ([#186](https://github.com/googleapis/nodejs-monitoring/pull/186)) +- chore: update nyc and eslint configs ([#184](https://github.com/googleapis/nodejs-monitoring/pull/184)) +- chore: fix publish.sh permission +x ([#182](https://github.com/googleapis/nodejs-monitoring/pull/182)) +- fix(build): fix Kokoro release script ([#181](https://github.com/googleapis/nodejs-monitoring/pull/181)) +- build: add Kokoro configs for autorelease ([#180](https://github.com/googleapis/nodejs-monitoring/pull/180)) +- chore: always nyc report before calling codecov ([#177](https://github.com/googleapis/nodejs-monitoring/pull/177)) +- chore: nyc ignore build/test by default ([#175](https://github.com/googleapis/nodejs-monitoring/pull/175)) +- chore: update license file ([#173](https://github.com/googleapis/nodejs-monitoring/pull/173)) +- fix(build): fix system key decryption ([#169](https://github.com/googleapis/nodejs-monitoring/pull/169)) +- chore: add a synth.metadata +- test: fix failing tests due to leaks ([#163](https://github.com/googleapis/nodejs-monitoring/pull/163)) +- chore: update eslintignore config ([#160](https://github.com/googleapis/nodejs-monitoring/pull/160)) +- chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 ([#158](https://github.com/googleapis/nodejs-monitoring/pull/158)) +- chore: drop contributors from multiple places ([#156](https://github.com/googleapis/nodejs-monitoring/pull/156)) +- chore: use latest npm on Windows ([#154](https://github.com/googleapis/nodejs-monitoring/pull/154)) +- chore: update CircleCI config ([#151](https://github.com/googleapis/nodejs-monitoring/pull/151)) +- chore: include build in eslintignore ([#148](https://github.com/googleapis/nodejs-monitoring/pull/148)) +- chore(deps): update dependency eslint-plugin-node to v8 ([#143](https://github.com/googleapis/nodejs-monitoring/pull/143)) +- chore: update new issue templates +- chore(build): fix the synth file and generation +- chore: remove old issue template ([#140](https://github.com/googleapis/nodejs-monitoring/pull/140)) +- build: run tests on node11 ([#139](https://github.com/googleapis/nodejs-monitoring/pull/139)) +- chores(build): do not collect sponge.xml from windows builds ([#138](https://github.com/googleapis/nodejs-monitoring/pull/138)) +- chores(build): run codecov on continuous builds ([#137](https://github.com/googleapis/nodejs-monitoring/pull/137)) +- build: fix codecov uploading on Kokoro ([#134](https://github.com/googleapis/nodejs-monitoring/pull/134)) +- chore(deps): update dependency sinon to v7 ([#133](https://github.com/googleapis/nodejs-monitoring/pull/133)) +- chore(deps): update dependency eslint-plugin-prettier to v3 ([#131](https://github.com/googleapis/nodejs-monitoring/pull/131)) +- test: remove appveyor config ([#127](https://github.com/googleapis/nodejs-monitoring/pull/127)) +- Fix failing sample tests ([#126](https://github.com/googleapis/nodejs-monitoring/pull/126)) +- Enable prefer-const in the eslint config ([#124](https://github.com/googleapis/nodejs-monitoring/pull/124)) +- Fix the linter ([#123](https://github.com/googleapis/nodejs-monitoring/pull/123)) +- Enable no-var in eslint ([#122](https://github.com/googleapis/nodejs-monitoring/pull/122)) +- run synth.py to fix system-test ([#117](https://github.com/googleapis/nodejs-monitoring/pull/117)) +- Retry npm install in CI ([#115](https://github.com/googleapis/nodejs-monitoring/pull/115)) +- Update CircleCI and Kokoro config ([#113](https://github.com/googleapis/nodejs-monitoring/pull/113)) +- chore(deps): update dependency nyc to v13 ([#111](https://github.com/googleapis/nodejs-monitoring/pull/111)) +- Update the CI config ([#109](https://github.com/googleapis/nodejs-monitoring/pull/109)) +- chore: make the CircleCI config consistent +- fix(deps): update dependency @google-cloud/monitoring to ^0.6.0 ([#104](https://github.com/googleapis/nodejs-monitoring/pull/104)) +- chore(build): make the CircleCI config consistent +- build: node templates ([#101](https://github.com/googleapis/nodejs-monitoring/pull/101)) + +## v0.6.0 + +### Implementation Changes +BREAKING CHANGE +- fix: drop support for node.js 4.x and 9.x (#72) + +### New Features +Bring in some documentation changes inside protos (see #96) + +### Dependencies +- chore(deps): update dependency eslint-config-prettier to v3 (#97) +- fix(deps): update dependency google-gax to ^0.18.0 (#88) +- chore(deps): update dependency eslint-plugin-node to v7 (#80) +- chore(deps): update dependency sinon to v6 (#64) +- fix(deps): update dependency yargs to v12 (#65) +- chore: check in synth script and update gax dependency (#62) +- chore(package): update eslint to version 5.0.0 (#57) +- chore(package): update nyc to version 12.0.2 (#53) + +### Documentation +- doc: Fix namespace causing 404s (#99) + +### Internal / Testing Changes +- chore: ignore package-lock.json (#93) +- test: add sample for updating an uptime check (#95) +- chore: update renovate config (#90) +- chore: move mocha options to mocha.opts (#85) +- chore: require node 8 for samples (#86) +- test: use strictEqual in tests (#81) +- chore: really delete node4 and node9 (#73) +- Configure Renovate (#56) +- refactor: drop repo-tool as an exec wrapper (#61) +- fix: update linking for samples (#58) +- chore: the ultimate fix for repo-tools EPERM (#50) +- test: fix uptime sample test (#48) +- chore: timeout for system test (#49) +- test: add resource type filter to alerts test (#46) +- Fixes #43. (#44) +- Fix region tags. (#42) +- Add Alerting samples. (#41) +- chore: test on node10 (#40) diff --git a/packages/google-cloud-monitoring/CODE_OF_CONDUCT.md b/packages/google-cloud-monitoring/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..2add2547a81 --- /dev/null +++ b/packages/google-cloud-monitoring/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/packages/google-cloud-monitoring/CONTRIBUTING.md b/packages/google-cloud-monitoring/CONTRIBUTING.md new file mode 100644 index 00000000000..34e9b55ae8c --- /dev/null +++ b/packages/google-cloud-monitoring/CONTRIBUTING.md @@ -0,0 +1,76 @@ +# How to become a contributor and submit your own code + +**Table of contents** + +* [Contributor License Agreements](#contributor-license-agreements) +* [Contributing a patch](#contributing-a-patch) +* [Running the tests](#running-the-tests) +* [Releasing the library](#releasing-the-library) + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement +(CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +1. Ensure that your code adheres to the existing style in the code to which + you are contributing. +1. Ensure that your code has an appropriate set of tests which all pass. +1. Title your pull request following [Conventional Commits](https://www.conventionalcommits.org/) styling. +1. Submit a pull request. + +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Stackdriver Monitoring API][enable_api]. +1. [Set up authentication with a service account][auth] so you can access the + API from your local workstation. + + +## Running the tests + +1. [Prepare your environment for Node.js setup][setup]. + +1. Install dependencies: + + npm install + +1. Run the tests: + + # Run unit tests. + npm test + + # Run sample integration tests. + npm run samples-test + + # Run all system tests. + npm run system-test + +1. Lint (and maybe fix) any changes: + + npm run fix + +[setup]: https://cloud.google.com/nodejs/docs/setup +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=monitoring.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-monitoring/LICENSE b/packages/google-cloud-monitoring/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-monitoring/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-monitoring/README.md b/packages/google-cloud-monitoring/README.md new file mode 100644 index 00000000000..dc275a392cd --- /dev/null +++ b/packages/google-cloud-monitoring/README.md @@ -0,0 +1,193 @@ +[//]: # "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 + +# [Stackdriver Monitoring: 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/monitoring.svg)](https://www.npmjs.org/package/@google-cloud/monitoring) + + + + +Stackdriver Monitoring API client for Node.js + + +A comprehensive list of changes in each version may be found in +[the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-monitoring/CHANGELOG.md). + +* [Stackdriver Monitoring Node.js Client API Reference][client-docs] +* [Stackdriver Monitoring Documentation][product-docs] +* [github.com/googleapis/google-cloud-node/packages/google-cloud-monitoring](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-monitoring) + +Read more about the client libraries for Cloud APIs, including the older +Google APIs Client Libraries, in [Client Libraries Explained][explained]. + +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained + +**Table of contents:** + + +* [Quickstart](#quickstart) + * [Before you begin](#before-you-begin) + * [Installing the client library](#installing-the-client-library) + * [Using the client library](#using-the-client-library) +* [Samples](#samples) +* [Versioning](#versioning) +* [Contributing](#contributing) +* [License](#license) + +## Quickstart + +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Stackdriver Monitoring 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/monitoring +``` + + +### Using the client library + +```javascript +// Imports the Google Cloud client library +const monitoring = require('@google-cloud/monitoring'); + +async function quickstart() { + // Creates a client + const client = new monitoring.MetricServiceClient(); + + // TODO(developer): Uncomment and set the following variables + // const projectId = "PROJECT_ID" + + // Prepares an individual data point + const dataPoint = { + interval: { + endTime: { + seconds: Date.now() / 1000, + }, + }, + value: { + // The amount of sales + doubleValue: 123.45, + }, + }; + + // Prepares the time series request + const request = { + name: client.projectPath(projectId), + timeSeries: [ + { + // Ties the data point to a custom metric + metric: { + type: 'custom.googleapis.com/stores/daily_sales', + labels: { + store_id: 'Pittsburgh', + }, + }, + resource: { + type: 'global', + labels: { + project_id: projectId, + }, + }, + points: [dataPoint], + }, + ], + }; + + // Writes time series data + const [result] = await client.createTimeSeries(request); + console.log('Done writing time series data.', result); +} +quickstart(); + +``` + + + +## Samples + +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/google-cloud-node/blob/main/packages/google-cloud-monitoring/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-monitoring/samples/quickstart.js,samples/README.md) | +| Quickstart.test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/test/quickstart.test.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-monitoring/samples/test/quickstart.test.js,samples/README.md) | + + + +The [Stackdriver Monitoring Node.js Client API Reference][client-docs] documentation +also contains samples. + +## Supported Node.js Versions + +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). +Libraries are compatible with all current _active_ and _maintenance_ versions of +Node.js. +If you are using an end-of-life version of Node.js, we recommend that you update +as soon as possible to an actively supported LTS version. + +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: + +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. + +Client libraries targeting some end-of-life versions of Node.js are available, and +can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. +For example, `npm install @google-cloud/monitoring@legacy-8` installs client libraries +for versions compatible with Node.js 8. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + + + +This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways +unless absolutely necessary (e.g. because of critical security issues) or with +an extensive deprecation period. Issues and requests against **stable** libraries +are addressed with the highest priority. + + + + + + +More Information: [Google Cloud Platform Launch Stages][launch_stages] + +[launch_stages]: https://cloud.google.com/terms/launch-stages + +## Contributing + +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/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`) +are generated from a central template. To edit one of these files, make an edit +to its templates in +[directory](https://github.com/googleapis/synthtool). + +## License + +Apache Version 2.0 + +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) + +[client-docs]: https://cloud.google.com/nodejs/docs/reference/monitoring/latest +[product-docs]: https://cloud.google.com/monitoring/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=monitoring.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-monitoring/linkinator.config.json b/packages/google-cloud-monitoring/linkinator.config.json new file mode 100644 index 00000000000..29a223b6db6 --- /dev/null +++ b/packages/google-cloud-monitoring/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 10 +} diff --git a/packages/google-cloud-monitoring/owlbot.py b/packages/google-cloud-monitoring/owlbot.py new file mode 100644 index 00000000000..3289c79cd0e --- /dev/null +++ b/packages/google-cloud-monitoring/owlbot.py @@ -0,0 +1,42 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +import synthtool.languages.node_mono_repo as node +import os + + +node.owlbot_main(relative_dir="packages/google-cloud-monitoring",staging_excludes=["README.md", "package.json"]) + +# -------------------------------------------------------------------------- +# Modify test configs +# -------------------------------------------------------------------------- + +# add shared environment variables to test configs +s.move( + ".kokoro/common_env_vars.cfg", + ".kokoro/common.cfg", + merge=lambda src, dst, _, : f"{dst}\n{src}", +) +for path, subdirs, files in os.walk(f".kokoro/continuous"): + for name in files: + if name == "common.cfg": + file_path = os.path.join(path, name) + s.move( + ".kokoro/common_env_vars.cfg", + file_path, + merge=lambda src, dst, _, : f"{dst}\n{src}", + ) diff --git a/packages/google-cloud-monitoring/package.json b/packages/google-cloud-monitoring/package.json new file mode 100644 index 00000000000..85ea4f0c590 --- /dev/null +++ b/packages/google-cloud-monitoring/package.json @@ -0,0 +1,73 @@ +{ + "name": "@google-cloud/monitoring", + "description": "Stackdriver Monitoring API client for Node.js", + "version": "3.0.3", + "license": "Apache-2.0", + "author": "Google Inc", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "directory": "packages/google-cloud-monitoring", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google monitoring", + "monitoring", + "Stackdriver Monitoring API" + ], + "scripts": { + "docs": "jsdoc -c .jsdoc.js", + "lint": "gts check", + "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test", + "system-test": "npm run compile && c8 mocha build/system-test", + "test": "c8 mocha build/test", + "fix": "gts fix", + "docs-test": "linkinator docs", + "predocs-test": "npm run docs", + "prelint": "cd samples; npm link ../; npm install", + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "prepare": "npm run compile", + "precompile": "gts clean" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^18.0.0", + "@types/sinon": "^10.0.0", + "c8": "^7.1.0", + "codecov": "^3.6.5", + "gts": "^3.1.0", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.0", + "jsdoc-region-tag": "^2.0.0", + "linkinator": "^4.0.0", + "mocha": "^9.2.2", + "null-loader": "^4.0.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^9.0.0", + "typescript": "^4.6.4", + "webpack": "^5.0.0", + "webpack-cli": "^4.0.0" + }, + "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-monitoring" +} diff --git a/packages/google-cloud-monitoring/protos/google/cloud/common_resources.proto b/packages/google-cloud-monitoring/protos/google/cloud/common_resources.proto new file mode 100644 index 00000000000..56c9f800d5e --- /dev/null +++ b/packages/google-cloud-monitoring/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-monitoring/protos/google/monitoring/v3/alert.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/alert.proto new file mode 100644 index 00000000000..8d1cbf2edce --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/alert.proto @@ -0,0 +1,394 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/monitoring/v3/common.proto"; +import "google/monitoring/v3/mutation_record.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "AlertProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// A description of the conditions under which some aspect of your system is +// considered to be "unhealthy" and the ways to notify people or services about +// this state. For an overview of alert policies, see +// [Introduction to Alerting](https://cloud.google.com/monitoring/alerts/). +message AlertPolicy { + option (google.api.resource) = { + type: "monitoring.googleapis.com/AlertPolicy" + pattern: "projects/{project}/alertPolicies/{alert_policy}" + pattern: "organizations/{organization}/alertPolicies/{alert_policy}" + pattern: "folders/{folder}/alertPolicies/{alert_policy}" + pattern: "*" + }; + + // A content string and a MIME type that describes the content string's + // format. + message Documentation { + // The text of the documentation, interpreted according to `mime_type`. + // The content may not exceed 8,192 Unicode characters and may not exceed + // more than 10,240 bytes when encoded in UTF-8 format, whichever is + // smaller. + string content = 1; + + // The format of the `content` field. Presently, only the value + // `"text/markdown"` is supported. See + // [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information. + string mime_type = 2; + } + + // A condition is a true/false test that determines when an alerting policy + // should open an incident. If a condition evaluates to true, it signifies + // that something is wrong. + message Condition { + option (google.api.resource) = { + type: "monitoring.googleapis.com/AlertPolicyCondition" + pattern: "projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}" + pattern: "organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}" + pattern: "folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}" + pattern: "*" + }; + + // Specifies how many time series must fail a predicate to trigger a + // condition. If not specified, then a `{count: 1}` trigger is used. + message Trigger { + // A type of trigger. + oneof type { + // The absolute number of time series that must fail + // the predicate for the condition to be triggered. + int32 count = 1; + + // The percentage of time series that must fail the + // predicate for the condition to be triggered. + double percent = 2; + } + } + + // A condition type that compares a collection of time series + // against a threshold. + message MetricThreshold { + // Required. A [filter](https://cloud.google.com/monitoring/api/v3/filters) that + // identifies which time series should be compared with the threshold. + // + // The filter is similar to the one that is specified in the + // [`ListTimeSeries` + // request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + // (that call is useful to verify the time series that will be retrieved / + // processed). The filter must specify the metric type and the resource + // type. Optionally, it can specify resource labels and metric labels. + // This field must not exceed 2048 Unicode characters in length. + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the alignment of data points in individual time series as + // well as how to combine the retrieved time series together (such as + // when aggregating multiple streams on each resource to a single + // stream for each resource or when aggregating streams across all + // members of a group of resrouces). Multiple aggregations + // are applied in the order specified. + // + // This field is similar to the one in the [`ListTimeSeries` + // request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + // It is advisable to use the `ListTimeSeries` method when debugging this + // field. + repeated Aggregation aggregations = 8; + + // A [filter](https://cloud.google.com/monitoring/api/v3/filters) that + // identifies a time series that should be used as the denominator of a + // ratio that will be compared with the threshold. If a + // `denominator_filter` is specified, the time series specified by the + // `filter` field will be used as the numerator. + // + // The filter must specify the metric type and optionally may contain + // restrictions on resource type, resource labels, and metric labels. + // This field may not exceed 2048 Unicode characters in length. + string denominator_filter = 9; + + // Specifies the alignment of data points in individual time series + // selected by `denominatorFilter` as + // well as how to combine the retrieved time series together (such as + // when aggregating multiple streams on each resource to a single + // stream for each resource or when aggregating streams across all + // members of a group of resources). + // + // When computing ratios, the `aggregations` and + // `denominator_aggregations` fields must use the same alignment period + // and produce time series that have the same periodicity and labels. + repeated Aggregation denominator_aggregations = 10; + + // The comparison to apply between the time series (indicated by `filter` + // and `aggregation`) and the threshold (indicated by `threshold_value`). + // The comparison is applied on each time series, with the time series + // on the left-hand side and the threshold on the right-hand side. + // + // Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently. + ComparisonType comparison = 4; + + // A value against which to compare the time series. + double threshold_value = 5; + + // The amount of time that a time series must violate the + // threshold to be considered failing. Currently, only values + // that are a multiple of a minute--e.g., 0, 60, 120, or 300 + // seconds--are supported. If an invalid value is given, an + // error will be returned. When choosing a duration, it is useful to + // keep in mind the frequency of the underlying time series data + // (which may also be affected by any alignments specified in the + // `aggregations` field); a good duration is long enough so that a single + // outlier does not generate spurious alerts, but short enough that + // unhealthy states are detected and alerted on quickly. + google.protobuf.Duration duration = 6; + + // The number/percent of time series for which the comparison must hold + // in order for the condition to trigger. If unspecified, then the + // condition will trigger if the comparison is true for any of the + // time series that have been identified by `filter` and `aggregations`, + // or by the ratio, if `denominator_filter` and `denominator_aggregations` + // are specified. + Trigger trigger = 7; + } + + // A condition type that checks that monitored resources + // are reporting data. The configuration defines a metric and + // a set of monitored resources. The predicate is considered in violation + // when a time series for the specified metric of a monitored + // resource does not include any data in the specified `duration`. + message MetricAbsence { + // Required. A [filter](https://cloud.google.com/monitoring/api/v3/filters) that + // identifies which time series should be compared with the threshold. + // + // The filter is similar to the one that is specified in the + // [`ListTimeSeries` + // request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) + // (that call is useful to verify the time series that will be retrieved / + // processed). The filter must specify the metric type and the resource + // type. Optionally, it can specify resource labels and metric labels. + // This field must not exceed 2048 Unicode characters in length. + string filter = 1 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the alignment of data points in individual time series as + // well as how to combine the retrieved time series together (such as + // when aggregating multiple streams on each resource to a single + // stream for each resource or when aggregating streams across all + // members of a group of resrouces). Multiple aggregations + // are applied in the order specified. + // + // This field is similar to the one in the [`ListTimeSeries` + // request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). + // It is advisable to use the `ListTimeSeries` method when debugging this + // field. + repeated Aggregation aggregations = 5; + + // The amount of time that a time series must fail to report new + // data to be considered failing. The minimum value of this field + // is 120 seconds. Larger values that are a multiple of a + // minute--for example, 240 or 300 seconds--are supported. + // If an invalid value is given, an + // error will be returned. The `Duration.nanos` field is + // ignored. + google.protobuf.Duration duration = 2; + + // The number/percent of time series for which the comparison must hold + // in order for the condition to trigger. If unspecified, then the + // condition will trigger if the comparison is true for any of the + // time series that have been identified by `filter` and `aggregations`. + Trigger trigger = 3; + } + + // A condition type that allows alert policies to be defined using + // [Monitoring Query Language](https://cloud.google.com/monitoring/mql). + message MonitoringQueryLanguageCondition { + // [Monitoring Query Language](https://cloud.google.com/monitoring/mql) + // query that outputs a boolean stream. + string query = 1; + + // The amount of time that a time series must violate the + // threshold to be considered failing. Currently, only values + // that are a multiple of a minute--e.g., 0, 60, 120, or 300 + // seconds--are supported. If an invalid value is given, an + // error will be returned. When choosing a duration, it is useful to + // keep in mind the frequency of the underlying time series data + // (which may also be affected by any alignments specified in the + // `aggregations` field); a good duration is long enough so that a single + // outlier does not generate spurious alerts, but short enough that + // unhealthy states are detected and alerted on quickly. + google.protobuf.Duration duration = 2; + + // The number/percent of time series for which the comparison must hold + // in order for the condition to trigger. If unspecified, then the + // condition will trigger if the comparison is true for any of the + // time series that have been identified by `filter` and `aggregations`, + // or by the ratio, if `denominator_filter` and `denominator_aggregations` + // are specified. + Trigger trigger = 3; + } + + // Required if the condition exists. The unique resource name for this + // condition. Its format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID] + // + // `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the + // condition is created as part of a new or updated alerting policy. + // + // When calling the + // [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + // method, do not include the `name` field in the conditions of the + // requested alerting policy. Stackdriver Monitoring creates the + // condition identifiers and includes them in the new policy. + // + // When calling the + // [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] + // method to update a policy, including a condition `name` causes the + // existing condition to be updated. Conditions without names are added to + // the updated policy. Existing conditions are deleted if they are not + // updated. + // + // Best practice is to preserve `[CONDITION_ID]` if you make only small + // changes, such as those to condition thresholds, durations, or trigger + // values. Otherwise, treat the change as a new condition and let the + // existing condition be deleted. + string name = 12; + + // A short name or phrase used to identify the condition in dashboards, + // notifications, and incidents. To avoid confusion, don't use the same + // display name for multiple conditions in the same policy. + string display_name = 6; + + // Only one of the following condition types will be specified. + oneof condition { + // A condition that compares a time series against a threshold. + MetricThreshold condition_threshold = 1; + + // A condition that checks that a time series continues to + // receive new data points. + MetricAbsence condition_absent = 2; + + // A condition that uses the Monitoring Query Language to define + // alerts. + MonitoringQueryLanguageCondition condition_monitoring_query_language = 19; + } + } + + // Operators for combining conditions. + enum ConditionCombinerType { + // An unspecified combiner. + COMBINE_UNSPECIFIED = 0; + + // Combine conditions using the logical `AND` operator. An + // incident is created only if all the conditions are met + // simultaneously. This combiner is satisfied if all conditions are + // met, even if they are met on completely different resources. + AND = 1; + + // Combine conditions using the logical `OR` operator. An incident + // is created if any of the listed conditions is met. + OR = 2; + + // Combine conditions using logical `AND` operator, but unlike the regular + // `AND` option, an incident is created only if all conditions are met + // simultaneously on at least one resource. + AND_WITH_MATCHING_RESOURCE = 3; + } + + // Required if the policy exists. The resource name for this policy. The + // format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + // + // `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy + // is created. When calling the + // [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] + // method, do not include the `name` field in the alerting policy passed as + // part of the request. + string name = 1; + + // A short name or phrase used to identify the policy in dashboards, + // notifications, and incidents. To avoid confusion, don't use the same + // display name for multiple policies in the same project. The name is + // limited to 512 Unicode characters. + string display_name = 2; + + // Documentation that is included with notifications and incidents related to + // this policy. Best practice is for the documentation to include information + // to help responders understand, mitigate, escalate, and correct the + // underlying problems detected by the alerting policy. Notification channels + // that have limited capacity might not show this documentation. + Documentation documentation = 13; + + // User-supplied key/value data to be used for organizing and + // identifying the `AlertPolicy` objects. + // + // The field can contain up to 64 entries. Each key and value is limited to + // 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + // values can contain only lowercase letters, numerals, underscores, and + // dashes. Keys must begin with a letter. + map user_labels = 16; + + // A list of conditions for the policy. The conditions are combined by AND or + // OR according to the `combiner` field. If the combined conditions evaluate + // to true, then an incident is created. A policy can have from one to six + // conditions. + // If `condition_time_series_query_language` is present, it must be the only + // `condition`. + repeated Condition conditions = 12; + + // How to combine the results of multiple conditions to determine if an + // incident should be opened. + // If `condition_time_series_query_language` is present, this must be + // `COMBINE_UNSPECIFIED`. + ConditionCombinerType combiner = 6; + + // Whether or not the policy is enabled. On write, the default interpretation + // if unset is that the policy is enabled. On read, clients should not make + // any assumption about the state if it has not been populated. The + // field should always be populated on List and Get operations, unless + // a field projection has been specified that strips it out. + google.protobuf.BoolValue enabled = 17; + + // Read-only description of how the alert policy is invalid. OK if the alert + // policy is valid. If not OK, the alert policy will not generate incidents. + google.rpc.Status validity = 18; + + // Identifies the notification channels to which notifications should be sent + // when incidents are opened or closed or when new violations occur on + // an already opened incident. Each element of this array corresponds to + // the `name` field in each of the + // [`NotificationChannel`][google.monitoring.v3.NotificationChannel] + // objects that are returned from the [`ListNotificationChannels`] + // [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + // method. The format of the entries in this field is: + // + // projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + repeated string notification_channels = 14; + + // A read-only record of the creation of the alerting policy. If provided + // in a call to create or update, this field will be ignored. + MutationRecord creation_record = 10; + + // A read-only record of the most recent change to the alerting policy. If + // provided in a call to create or update, this field will be ignored. + MutationRecord mutation_record = 11; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/alert_service.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/alert_service.proto new file mode 100644 index 00000000000..4017b16e070 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/alert_service.proto @@ -0,0 +1,238 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/monitoring/v3/alert.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "AlertServiceProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The AlertPolicyService API is used to manage (list, create, delete, +// edit) alert policies in Stackdriver Monitoring. An alerting policy is +// a description of the conditions under which some aspect of your +// system is considered to be "unhealthy" and the ways to notify +// people or services about this state. In addition to using this API, alert +// policies can also be managed through +// [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), +// which can be reached by clicking the "Monitoring" tab in +// [Cloud Console](https://console.cloud.google.com/). +service AlertPolicyService { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read"; + + // Lists the existing alerting policies for the workspace. + rpc ListAlertPolicies(ListAlertPoliciesRequest) returns (ListAlertPoliciesResponse) { + option (google.api.http) = { + get: "/v3/{name=projects/*}/alertPolicies" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a single alerting policy. + rpc GetAlertPolicy(GetAlertPolicyRequest) returns (AlertPolicy) { + option (google.api.http) = { + get: "/v3/{name=projects/*/alertPolicies/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new alerting policy. + rpc CreateAlertPolicy(CreateAlertPolicyRequest) returns (AlertPolicy) { + option (google.api.http) = { + post: "/v3/{name=projects/*}/alertPolicies" + body: "alert_policy" + }; + option (google.api.method_signature) = "name,alert_policy"; + } + + // Deletes an alerting policy. + rpc DeleteAlertPolicy(DeleteAlertPolicyRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3/{name=projects/*/alertPolicies/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates an alerting policy. You can either replace the entire policy with + // a new one or replace only certain fields in the current alerting policy by + // specifying the fields to be updated via `updateMask`. Returns the + // updated alerting policy. + rpc UpdateAlertPolicy(UpdateAlertPolicyRequest) returns (AlertPolicy) { + option (google.api.http) = { + patch: "/v3/{alert_policy.name=projects/*/alertPolicies/*}" + body: "alert_policy" + }; + option (google.api.method_signature) = "update_mask,alert_policy"; + } +} + +// The protocol for the `CreateAlertPolicy` request. +message CreateAlertPolicyRequest { + // Required. The project in which to create the alerting policy. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + // + // Note that this field names the parent container in which the alerting + // policy will be written, not the name of the created policy. |name| must be + // a host project of a workspace, otherwise INVALID_ARGUMENT error will + // return. The alerting policy that is returned will have a name that contains + // a normalized representation of this name as a prefix but adds a suffix of + // the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + // container. + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/AlertPolicy" + } + ]; + + // Required. The requested alerting policy. You should omit the `name` field in this + // policy. The name will be returned in the new policy, including + // a new `[ALERT_POLICY_ID]` value. + AlertPolicy alert_policy = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The protocol for the `GetAlertPolicy` request. +message GetAlertPolicyRequest { + // Required. The alerting policy to retrieve. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/AlertPolicy" + } + ]; +} + +// The protocol for the `ListAlertPolicies` request. +message ListAlertPoliciesRequest { + // Required. The project whose alert policies are to be listed. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + // + // Note that this field names the parent container in which the alerting + // policies to be listed are stored. To retrieve a single alerting policy + // by name, use the + // [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] + // operation, instead. + string name = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/AlertPolicy" + } + ]; + + // If provided, this field specifies the criteria that must be met by + // alert policies to be included in the response. + // + // For more details, see [sorting and + // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + string filter = 5; + + // A comma-separated list of fields by which to sort the result. Supports + // the same set of field references as the `filter` field. Entries can be + // prefixed with a minus sign to sort by the field in descending order. + // + // For more details, see [sorting and + // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + string order_by = 6; + + // The maximum number of results to return in a single response. + int32 page_size = 2; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return more results from the previous method call. + string page_token = 3; +} + +// The protocol for the `ListAlertPolicies` response. +message ListAlertPoliciesResponse { + // The returned alert policies. + repeated AlertPolicy alert_policies = 3; + + // If there might be more results than were returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `page_token` in the next call to this method. + string next_page_token = 2; + + // The total number of alert policies in all pages. This number is only an + // estimate, and may change in subsequent pages. https://aip.dev/158 + int32 total_size = 4; +} + +// The protocol for the `UpdateAlertPolicy` request. +message UpdateAlertPolicyRequest { + // Optional. A list of alerting policy field names. If this field is not + // empty, each listed field in the existing alerting policy is set to the + // value of the corresponding field in the supplied policy (`alert_policy`), + // or to the field's default value if the field is not in the supplied + // alerting policy. Fields not listed retain their previous value. + // + // Examples of valid field masks include `display_name`, `documentation`, + // `documentation.content`, `documentation.mime_type`, `user_labels`, + // `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + // + // If this field is empty, then the supplied alerting policy replaces the + // existing policy. It is the same as deleting the existing policy and + // adding the supplied policy, except for the following: + // + // + The new policy will have the same `[ALERT_POLICY_ID]` as the former + // policy. This gives you continuity with the former policy in your + // notifications and incidents. + // + Conditions in the new policy will keep their former `[CONDITION_ID]` if + // the supplied condition includes the `name` field with that + // `[CONDITION_ID]`. If the supplied condition omits the `name` field, + // then a new `[CONDITION_ID]` is created. + google.protobuf.FieldMask update_mask = 2; + + // Required. The updated alerting policy or the updated values for the + // fields listed in `update_mask`. + // If `update_mask` is not empty, any fields in this policy that are + // not in `update_mask` are ignored. + AlertPolicy alert_policy = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The protocol for the `DeleteAlertPolicy` request. +message DeleteAlertPolicyRequest { + // Required. The alerting policy to delete. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + // + // For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/AlertPolicy" + } + ]; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/common.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/common.proto new file mode 100644 index 00000000000..77a28ea3af4 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/common.proto @@ -0,0 +1,488 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/distribution.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// A single strongly-typed value. +message TypedValue { + // The typed value field. + oneof value { + // A Boolean value: `true` or `false`. + bool bool_value = 1; + + // A 64-bit integer. Its range is approximately ±9.2x1018. + int64 int64_value = 2; + + // A 64-bit double-precision floating-point number. Its magnitude + // is approximately ±10±300 and it has 16 + // significant digits of precision. + double double_value = 3; + + // A variable-length string value. + string string_value = 4; + + // A distribution value. + google.api.Distribution distribution_value = 5; + } +} + +// A closed time interval. It extends from the start time to the end time, and includes both: `[startTime, endTime]`. Valid time intervals depend on the [`MetricKind`](/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind) of the metric value. The end time must not be earlier than the start time. When writing data points, the start time must not be more than 25 hours in the past and the end time must not be more than five minutes in the future. +// +// * For `GAUGE` metrics, the `startTime` value is technically optional; if +// no value is specified, the start time defaults to the value of the +// end time, and the interval represents a single point in time. If both +// start and end times are specified, they must be identical. Such an +// interval is valid only for `GAUGE` metrics, which are point-in-time +// measurements. The end time of a new interval must be at least a +// millisecond after the end time of the previous interval. +// +// * For `DELTA` metrics, the start time and end time must specify a +// non-zero interval, with subsequent points specifying contiguous and +// non-overlapping intervals. For `DELTA` metrics, the start time of +// the next interval must be at least a millisecond after the end time +// of the previous interval. +// +// * For `CUMULATIVE` metrics, the start time and end time must specify a +// a non-zero interval, with subsequent points specifying the same +// start time and increasing end times, until an event resets the +// cumulative value to zero and sets a new start time for the following +// points. The new start time must be at least a millisecond after the +// end time of the previous interval. +// +// * The start time of a new interval must be at least a millisecond after the +// end time of the previous interval because intervals are closed. If the +// start time of a new interval is the same as the end time of the previous +// interval, then data written at the new start time could overwrite data +// written at the previous end time. +message TimeInterval { + // Required. The end of the time interval. + google.protobuf.Timestamp end_time = 2; + + // Optional. The beginning of the time interval. The default value + // for the start time is the end time. The start time must not be + // later than the end time. + google.protobuf.Timestamp start_time = 1; +} + +// Describes how to combine multiple time series to provide a different view of +// the data. Aggregation of time series is done in two steps. First, each time +// series in the set is _aligned_ to the same time interval boundaries, then the +// set of time series is optionally _reduced_ in number. +// +// Alignment consists of applying the `per_series_aligner` operation +// to each time series after its data has been divided into regular +// `alignment_period` time intervals. This process takes _all_ of the data +// points in an alignment period, applies a mathematical transformation such as +// averaging, minimum, maximum, delta, etc., and converts them into a single +// data point per period. +// +// Reduction is when the aligned and transformed time series can optionally be +// combined, reducing the number of time series through similar mathematical +// transformations. Reduction involves applying a `cross_series_reducer` to +// all the time series, optionally sorting the time series into subsets with +// `group_by_fields`, and applying the reducer to each subset. +// +// The raw time series data can contain a huge amount of information from +// multiple sources. Alignment and reduction transforms this mass of data into +// a more manageable and representative collection of data, for example "the +// 95% latency across the average of all tasks in a cluster". This +// representative data can be more easily graphed and comprehended, and the +// individual time series data is still available for later drilldown. For more +// details, see [Filtering and +// aggregation](https://cloud.google.com/monitoring/api/v3/aggregation). +message Aggregation { + // The `Aligner` specifies the operation that will be applied to the data + // points in each alignment period in a time series. Except for + // `ALIGN_NONE`, which specifies that no operation be applied, each alignment + // operation replaces the set of data values in each alignment period with + // a single value: the result of applying the operation to the data values. + // An aligned time series has a single data value at the end of each + // `alignment_period`. + // + // An alignment operation can change the data type of the values, too. For + // example, if you apply a counting operation to boolean values, the data + // `value_type` in the original time series is `BOOLEAN`, but the `value_type` + // in the aligned result is `INT64`. + enum Aligner { + // No alignment. Raw data is returned. Not valid if cross-series reduction + // is requested. The `value_type` of the result is the same as the + // `value_type` of the input. + ALIGN_NONE = 0; + + // Align and convert to + // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA]. + // The output is `delta = y1 - y0`. + // + // This alignment is valid for + // [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and + // `DELTA` metrics. If the selected alignment period results in periods + // with no data, then the aligned value for such a period is created by + // interpolation. The `value_type` of the aligned result is the same as + // the `value_type` of the input. + ALIGN_DELTA = 1; + + // Align and convert to a rate. The result is computed as + // `rate = (y1 - y0)/(t1 - t0)`, or "delta over time". + // Think of this aligner as providing the slope of the line that passes + // through the value at the start and at the end of the `alignment_period`. + // + // This aligner is valid for `CUMULATIVE` + // and `DELTA` metrics with numeric values. If the selected alignment + // period results in periods with no data, then the aligned value for + // such a period is created by interpolation. The output is a `GAUGE` + // metric with `value_type` `DOUBLE`. + // + // If, by "rate", you mean "percentage change", see the + // `ALIGN_PERCENT_CHANGE` aligner instead. + ALIGN_RATE = 2; + + // Align by interpolating between adjacent points around the alignment + // period boundary. This aligner is valid for `GAUGE` metrics with + // numeric values. The `value_type` of the aligned result is the same as the + // `value_type` of the input. + ALIGN_INTERPOLATE = 3; + + // Align by moving the most recent data point before the end of the + // alignment period to the boundary at the end of the alignment + // period. This aligner is valid for `GAUGE` metrics. The `value_type` of + // the aligned result is the same as the `value_type` of the input. + ALIGN_NEXT_OLDER = 4; + + // Align the time series by returning the minimum value in each alignment + // period. This aligner is valid for `GAUGE` and `DELTA` metrics with + // numeric values. The `value_type` of the aligned result is the same as + // the `value_type` of the input. + ALIGN_MIN = 10; + + // Align the time series by returning the maximum value in each alignment + // period. This aligner is valid for `GAUGE` and `DELTA` metrics with + // numeric values. The `value_type` of the aligned result is the same as + // the `value_type` of the input. + ALIGN_MAX = 11; + + // Align the time series by returning the mean value in each alignment + // period. This aligner is valid for `GAUGE` and `DELTA` metrics with + // numeric values. The `value_type` of the aligned result is `DOUBLE`. + ALIGN_MEAN = 12; + + // Align the time series by returning the number of values in each alignment + // period. This aligner is valid for `GAUGE` and `DELTA` metrics with + // numeric or Boolean values. The `value_type` of the aligned result is + // `INT64`. + ALIGN_COUNT = 13; + + // Align the time series by returning the sum of the values in each + // alignment period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with numeric and distribution values. The `value_type` of the + // aligned result is the same as the `value_type` of the input. + ALIGN_SUM = 14; + + // Align the time series by returning the standard deviation of the values + // in each alignment period. This aligner is valid for `GAUGE` and + // `DELTA` metrics with numeric values. The `value_type` of the output is + // `DOUBLE`. + ALIGN_STDDEV = 15; + + // Align the time series by returning the number of `True` values in + // each alignment period. This aligner is valid for `GAUGE` metrics with + // Boolean values. The `value_type` of the output is `INT64`. + ALIGN_COUNT_TRUE = 16; + + // Align the time series by returning the number of `False` values in + // each alignment period. This aligner is valid for `GAUGE` metrics with + // Boolean values. The `value_type` of the output is `INT64`. + ALIGN_COUNT_FALSE = 24; + + // Align the time series by returning the ratio of the number of `True` + // values to the total number of values in each alignment period. This + // aligner is valid for `GAUGE` metrics with Boolean values. The output + // value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`. + ALIGN_FRACTION_TRUE = 17; + + // Align the time series by using [percentile + // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + // data point in each alignment period is the 99th percentile of all data + // points in the period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with distribution values. The output is a `GAUGE` metric with + // `value_type` `DOUBLE`. + ALIGN_PERCENTILE_99 = 18; + + // Align the time series by using [percentile + // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + // data point in each alignment period is the 95th percentile of all data + // points in the period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with distribution values. The output is a `GAUGE` metric with + // `value_type` `DOUBLE`. + ALIGN_PERCENTILE_95 = 19; + + // Align the time series by using [percentile + // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + // data point in each alignment period is the 50th percentile of all data + // points in the period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with distribution values. The output is a `GAUGE` metric with + // `value_type` `DOUBLE`. + ALIGN_PERCENTILE_50 = 20; + + // Align the time series by using [percentile + // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting + // data point in each alignment period is the 5th percentile of all data + // points in the period. This aligner is valid for `GAUGE` and `DELTA` + // metrics with distribution values. The output is a `GAUGE` metric with + // `value_type` `DOUBLE`. + ALIGN_PERCENTILE_05 = 21; + + // Align and convert to a percentage change. This aligner is valid for + // `GAUGE` and `DELTA` metrics with numeric values. This alignment returns + // `((current - previous)/previous) * 100`, where the value of `previous` is + // determined based on the `alignment_period`. + // + // If the values of `current` and `previous` are both 0, then the returned + // value is 0. If only `previous` is 0, the returned value is infinity. + // + // A 10-minute moving mean is computed at each point of the alignment period + // prior to the above calculation to smooth the metric and prevent false + // positives from very short-lived spikes. The moving mean is only + // applicable for data whose values are `>= 0`. Any values `< 0` are + // treated as a missing datapoint, and are ignored. While `DELTA` + // metrics are accepted by this alignment, special care should be taken that + // the values for the metric will always be positive. The output is a + // `GAUGE` metric with `value_type` `DOUBLE`. + ALIGN_PERCENT_CHANGE = 23; + } + + // A Reducer operation describes how to aggregate data points from multiple + // time series into a single time series, where the value of each data point + // in the resulting series is a function of all the already aligned values in + // the input time series. + enum Reducer { + // No cross-time series reduction. The output of the `Aligner` is + // returned. + REDUCE_NONE = 0; + + // Reduce by computing the mean value across time series for each + // alignment period. This reducer is valid for + // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and + // [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with + // numeric or distribution values. The `value_type` of the output is + // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. + REDUCE_MEAN = 1; + + // Reduce by computing the minimum value across time series for each + // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + // with numeric values. The `value_type` of the output is the same as the + // `value_type` of the input. + REDUCE_MIN = 2; + + // Reduce by computing the maximum value across time series for each + // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + // with numeric values. The `value_type` of the output is the same as the + // `value_type` of the input. + REDUCE_MAX = 3; + + // Reduce by computing the sum across time series for each + // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics + // with numeric and distribution values. The `value_type` of the output is + // the same as the `value_type` of the input. + REDUCE_SUM = 4; + + // Reduce by computing the standard deviation across time series + // for each alignment period. This reducer is valid for `DELTA` and + // `GAUGE` metrics with numeric or distribution values. The `value_type` + // of the output is `DOUBLE`. + REDUCE_STDDEV = 5; + + // Reduce by computing the number of data points across time series + // for each alignment period. This reducer is valid for `DELTA` and + // `GAUGE` metrics of numeric, Boolean, distribution, and string + // `value_type`. The `value_type` of the output is `INT64`. + REDUCE_COUNT = 6; + + // Reduce by computing the number of `True`-valued data points across time + // series for each alignment period. This reducer is valid for `DELTA` and + // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output + // is `INT64`. + REDUCE_COUNT_TRUE = 7; + + // Reduce by computing the number of `False`-valued data points across time + // series for each alignment period. This reducer is valid for `DELTA` and + // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output + // is `INT64`. + REDUCE_COUNT_FALSE = 15; + + // Reduce by computing the ratio of the number of `True`-valued data points + // to the total number of data points for each alignment period. This + // reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`. + // The output value is in the range [0.0, 1.0] and has `value_type` + // `DOUBLE`. + REDUCE_FRACTION_TRUE = 8; + + // Reduce by computing the [99th + // percentile](https://en.wikipedia.org/wiki/Percentile) of data points + // across time series for each alignment period. This reducer is valid for + // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + // of the output is `DOUBLE`. + REDUCE_PERCENTILE_99 = 9; + + // Reduce by computing the [95th + // percentile](https://en.wikipedia.org/wiki/Percentile) of data points + // across time series for each alignment period. This reducer is valid for + // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + // of the output is `DOUBLE`. + REDUCE_PERCENTILE_95 = 10; + + // Reduce by computing the [50th + // percentile](https://en.wikipedia.org/wiki/Percentile) of data points + // across time series for each alignment period. This reducer is valid for + // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + // of the output is `DOUBLE`. + REDUCE_PERCENTILE_50 = 11; + + // Reduce by computing the [5th + // percentile](https://en.wikipedia.org/wiki/Percentile) of data points + // across time series for each alignment period. This reducer is valid for + // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value + // of the output is `DOUBLE`. + REDUCE_PERCENTILE_05 = 12; + } + + // The `alignment_period` specifies a time interval, in seconds, that is used + // to divide the data in all the + // [time series][google.monitoring.v3.TimeSeries] into consistent blocks of + // time. This will be done before the per-series aligner can be applied to + // the data. + // + // The value must be at least 60 seconds. If a per-series + // aligner other than `ALIGN_NONE` is specified, this field is required or an + // error is returned. If no per-series aligner is specified, or the aligner + // `ALIGN_NONE` is specified, then this field is ignored. + // + // The maximum value of the `alignment_period` is 104 weeks (2 years) for + // charts, and 90,000 seconds (25 hours) for alerting policies. + google.protobuf.Duration alignment_period = 1; + + // An `Aligner` describes how to bring the data points in a single + // time series into temporal alignment. Except for `ALIGN_NONE`, all + // alignments cause all the data points in an `alignment_period` to be + // mathematically grouped together, resulting in a single data point for + // each `alignment_period` with end timestamp at the end of the period. + // + // Not all alignment operations may be applied to all time series. The valid + // choices depend on the `metric_kind` and `value_type` of the original time + // series. Alignment can change the `metric_kind` or the `value_type` of + // the time series. + // + // Time series data must be aligned in order to perform cross-time + // series reduction. If `cross_series_reducer` is specified, then + // `per_series_aligner` must be specified and not equal to `ALIGN_NONE` + // and `alignment_period` must be specified; otherwise, an error is + // returned. + Aligner per_series_aligner = 2; + + // The reduction operation to be used to combine time series into a single + // time series, where the value of each data point in the resulting series is + // a function of all the already aligned values in the input time series. + // + // Not all reducer operations can be applied to all time series. The valid + // choices depend on the `metric_kind` and the `value_type` of the original + // time series. Reduction can yield a time series with a different + // `metric_kind` or `value_type` than the input time series. + // + // Time series data must first be aligned (see `per_series_aligner`) in order + // to perform cross-time series reduction. If `cross_series_reducer` is + // specified, then `per_series_aligner` must be specified, and must not be + // `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an + // error is returned. + Reducer cross_series_reducer = 4; + + // The set of fields to preserve when `cross_series_reducer` is + // specified. The `group_by_fields` determine how the time series are + // partitioned into subsets prior to applying the aggregation + // operation. Each subset contains time series that have the same + // value for each of the grouping fields. Each individual time + // series is a member of exactly one subset. The + // `cross_series_reducer` is applied to each subset of time series. + // It is not possible to reduce across different resource types, so + // this field implicitly contains `resource.type`. Fields not + // specified in `group_by_fields` are aggregated away. If + // `group_by_fields` is not specified and all the time series have + // the same resource type, then the time series are aggregated into + // a single output time series. If `cross_series_reducer` is not + // defined, this field is ignored. + repeated string group_by_fields = 5; +} + +// Specifies an ordering relationship on two arguments, called `left` and +// `right`. +enum ComparisonType { + // No ordering relationship is specified. + COMPARISON_UNSPECIFIED = 0; + + // True if the left argument is greater than the right argument. + COMPARISON_GT = 1; + + // True if the left argument is greater than or equal to the right argument. + COMPARISON_GE = 2; + + // True if the left argument is less than the right argument. + COMPARISON_LT = 3; + + // True if the left argument is less than or equal to the right argument. + COMPARISON_LE = 4; + + // True if the left argument is equal to the right argument. + COMPARISON_EQ = 5; + + // True if the left argument is not equal to the right argument. + COMPARISON_NE = 6; +} + +// The tier of service for a Workspace. Please see the +// [service tiers +// documentation](https://cloud.google.com/monitoring/workspaces/tiers) for more +// details. +enum ServiceTier { + option deprecated = true; + + // An invalid sentinel value, used to indicate that a tier has not + // been provided explicitly. + SERVICE_TIER_UNSPECIFIED = 0; + + // The Stackdriver Basic tier, a free tier of service that provides basic + // features, a moderate allotment of logs, and access to built-in metrics. + // A number of features are not available in this tier. For more details, + // see [the service tiers + // documentation](https://cloud.google.com/monitoring/workspaces/tiers). + SERVICE_TIER_BASIC = 1; + + // The Stackdriver Premium tier, a higher, more expensive tier of service + // that provides access to all Stackdriver features, lets you use Stackdriver + // with AWS accounts, and has a larger allotments for logs and metrics. For + // more details, see [the service tiers + // documentation](https://cloud.google.com/monitoring/workspaces/tiers). + SERVICE_TIER_PREMIUM = 2; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/dropped_labels.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/dropped_labels.proto new file mode 100644 index 00000000000..16e213c4abf --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/dropped_labels.proto @@ -0,0 +1,46 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "DroppedLabelsProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// A set of (label, value) pairs that were removed from a Distribution +// time series during aggregation and then added as an attachment to a +// Distribution.Exemplar. +// +// The full label set for the exemplars is constructed by using the dropped +// pairs in combination with the label values that remain on the aggregated +// Distribution time series. The constructed full label set can be used to +// identify the specific entity, such as the instance or job, which might be +// contributing to a long-tail. However, with dropped labels, the storage +// requirements are reduced because only the aggregated distribution values for +// a large group of time series are stored. +// +// Note that there are no guarantees on ordering of the labels from +// exemplar-to-exemplar and from distribution-to-distribution in the same +// stream, and there may be duplicates. It is up to clients to resolve any +// ambiguities. +message DroppedLabels { + // Map from label to its value, for all labels dropped in any aggregation. + map label = 1; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/group.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/group.proto new file mode 100644 index 00000000000..a414cc8520b --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/group.proto @@ -0,0 +1,90 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "GroupProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The description of a dynamic collection of monitored resources. Each group +// has a filter that is matched against monitored resources and their associated +// metadata. If a group's filter matches an available monitored resource, then +// that resource is a member of that group. Groups can contain any number of +// monitored resources, and each monitored resource can be a member of any +// number of groups. +// +// Groups can be nested in parent-child hierarchies. The `parentName` field +// identifies an optional parent for each group. If a group has a parent, then +// the only monitored resources available to be matched by the group's filter +// are the resources contained in the parent group. In other words, a group +// contains the monitored resources that match its filter and the filters of all +// the group's ancestors. A group without a parent can contain any monitored +// resource. +// +// For example, consider an infrastructure running a set of instances with two +// user-defined tags: `"environment"` and `"role"`. A parent group has a filter, +// `environment="production"`. A child of that parent group has a filter, +// `role="transcoder"`. The parent group contains all instances in the +// production environment, regardless of their roles. The child group contains +// instances that have the transcoder role *and* are in the production +// environment. +// +// The monitored resources contained in a group can change at any moment, +// depending on what resources exist and what filters are associated with the +// group and its ancestors. +message Group { + option (google.api.resource) = { + type: "monitoring.googleapis.com/Group" + pattern: "projects/{project}/groups/{group}" + pattern: "organizations/{organization}/groups/{group}" + pattern: "folders/{folder}/groups/{group}" + pattern: "*" + }; + + // Output only. The name of this group. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + // + // When creating a group, this field is ignored and a new name is created + // consisting of the project specified in the call to `CreateGroup` + // and a unique `[GROUP_ID]` that is generated automatically. + string name = 1; + + // A user-assigned name for this group, used only for display purposes. + string display_name = 2; + + // The name of the group's parent, if it has one. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + // + // For groups with no parent, `parent_name` is the empty string, `""`. + string parent_name = 3; + + // The filter used to determine which monitored resources belong to this + // group. + string filter = 5; + + // If true, the members of this group are considered to be a cluster. + // The system can perform additional analysis on groups that are clusters. + bool is_cluster = 6; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/group_service.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/group_service.proto new file mode 100644 index 00000000000..6385c8bbf80 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/group_service.proto @@ -0,0 +1,288 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/monitored_resource.proto"; +import "google/api/resource.proto"; +import "google/monitoring/v3/common.proto"; +import "google/monitoring/v3/group.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "GroupServiceProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The Group API lets you inspect and manage your +// [groups](#google.monitoring.v3.Group). +// +// A group is a named filter that is used to identify +// a collection of monitored resources. Groups are typically used to +// mirror the physical and/or logical topology of the environment. +// Because group membership is computed dynamically, monitored +// resources that are started in the future are automatically placed +// in matching groups. By using a group to name monitored resources in, +// for example, an alert policy, the target of that alert policy is +// updated automatically as monitored resources are added and removed +// from the infrastructure. +service GroupService { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read"; + + // Lists the existing groups. + rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) { + option (google.api.http) = { + get: "/v3/{name=projects/*}/groups" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a single group. + rpc GetGroup(GetGroupRequest) returns (Group) { + option (google.api.http) = { + get: "/v3/{name=projects/*/groups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new group. + rpc CreateGroup(CreateGroupRequest) returns (Group) { + option (google.api.http) = { + post: "/v3/{name=projects/*}/groups" + body: "group" + }; + option (google.api.method_signature) = "name,group"; + } + + // Updates an existing group. + // You can change any group attributes except `name`. + rpc UpdateGroup(UpdateGroupRequest) returns (Group) { + option (google.api.http) = { + put: "/v3/{group.name=projects/*/groups/*}" + body: "group" + }; + option (google.api.method_signature) = "group"; + } + + // Deletes an existing group. + rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3/{name=projects/*/groups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists the monitored resources that are members of a group. + rpc ListGroupMembers(ListGroupMembersRequest) returns (ListGroupMembersResponse) { + option (google.api.http) = { + get: "/v3/{name=projects/*/groups/*}/members" + }; + option (google.api.method_signature) = "name"; + } +} + +// The `ListGroup` request. +message ListGroupsRequest { + // Required. The project whose groups are to be listed. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string name = 7 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/Group" + } + ]; + + // An optional filter consisting of a single group name. The filters limit + // the groups returned based on their parent-child relationship with the + // specified group. If no filter is specified, all groups are returned. + oneof filter { + // A group name. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + // + // Returns groups whose `parent_name` field contains the group + // name. If no groups have this parent, the results are empty. + string children_of_group = 2 [(google.api.resource_reference) = { + type: "monitoring.googleapis.com/Group" + }]; + + // A group name. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + // + // Returns groups that are ancestors of the specified group. + // The groups are returned in order, starting with the immediate parent and + // ending with the most distant ancestor. If the specified group has no + // immediate parent, the results are empty. + string ancestors_of_group = 3 [(google.api.resource_reference) = { + type: "monitoring.googleapis.com/Group" + }]; + + // A group name. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + // + // Returns the descendants of the specified group. This is a superset of + // the results returned by the `children_of_group` filter, and includes + // children-of-children, and so forth. + string descendants_of_group = 4 [(google.api.resource_reference) = { + type: "monitoring.googleapis.com/Group" + }]; + } + + // A positive number that is the maximum number of results to return. + int32 page_size = 5; + + // If this field is not empty then it must contain the `next_page_token` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 6; +} + +// The `ListGroups` response. +message ListGroupsResponse { + // The groups that match the specified filters. + repeated Group group = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `page_token` in the next call to this method. + string next_page_token = 2; +} + +// The `GetGroup` request. +message GetGroupRequest { + // Required. The group to retrieve. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Group" + } + ]; +} + +// The `CreateGroup` request. +message CreateGroupRequest { + // Required. The project in which to create the group. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string name = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/Group" + } + ]; + + // Required. A group definition. It is an error to define the `name` field because + // the system assigns the name. + Group group = 2 [(google.api.field_behavior) = REQUIRED]; + + // If true, validate this request but do not create the group. + bool validate_only = 3; +} + +// The `UpdateGroup` request. +message UpdateGroupRequest { + // Required. The new definition of the group. All fields of the existing group, + // excepting `name`, are replaced with the corresponding fields of this group. + Group group = 2 [(google.api.field_behavior) = REQUIRED]; + + // If true, validate this request but do not update the existing group. + bool validate_only = 3; +} + +// The `DeleteGroup` request. The default behavior is to be able to delete a +// single group without any descendants. +message DeleteGroupRequest { + // Required. The group to delete. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Group" + } + ]; + + // If this field is true, then the request means to delete a group with all + // its descendants. Otherwise, the request means to delete a group only when + // it has no descendants. The default value is false. + bool recursive = 4; +} + +// The `ListGroupMembers` request. +message ListGroupMembersRequest { + // Required. The group whose members are listed. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + string name = 7 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Group" + } + ]; + + // A positive number that is the maximum number of results to return. + int32 page_size = 3; + + // If this field is not empty then it must contain the `next_page_token` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 4; + + // An optional [list + // filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + // describing the members to be returned. The filter may reference the type, + // labels, and metadata of monitored resources that comprise the group. For + // example, to return only resources representing Compute Engine VM instances, + // use this filter: + // + // `resource.type = "gce_instance"` + string filter = 5; + + // An optional time interval for which results should be returned. Only + // members that were part of the group during the specified interval are + // included in the response. If no interval is provided then the group + // membership over the last minute is returned. + TimeInterval interval = 6; +} + +// The `ListGroupMembers` response. +message ListGroupMembersResponse { + // A set of monitored resources in the group. + repeated google.api.MonitoredResource members = 1; + + // If there are more results than have been returned, then this field is + // set to a non-empty value. To see the additional results, use that value as + // `page_token` in the next call to this method. + string next_page_token = 2; + + // The total number of elements matching this request. + int32 total_size = 3; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/metric.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/metric.proto new file mode 100644 index 00000000000..c0c23a39bba --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/metric.proto @@ -0,0 +1,239 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/distribution.proto"; +import "google/api/label.proto"; +import "google/api/metric.proto"; +import "google/api/monitored_resource.proto"; +import "google/monitoring/v3/common.proto"; +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "MetricProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// A single data point in a time series. +message Point { + // The time interval to which the data point applies. For `GAUGE` metrics, + // the start time is optional, but if it is supplied, it must equal the + // end time. For `DELTA` metrics, the start + // and end time should specify a non-zero interval, with subsequent points + // specifying contiguous and non-overlapping intervals. For `CUMULATIVE` + // metrics, the start and end time should specify a non-zero interval, with + // subsequent points specifying the same start time and increasing end times, + // until an event resets the cumulative value to zero and sets a new start + // time for the following points. + TimeInterval interval = 1; + + // The value of the data point. + TypedValue value = 2; +} + +// A collection of data points that describes the time-varying values +// of a metric. A time series is identified by a combination of a +// fully-specified monitored resource and a fully-specified metric. +// This type is used for both listing and creating time series. +message TimeSeries { + // The associated metric. A fully-specified metric used to identify the time + // series. + google.api.Metric metric = 1; + + // The associated monitored resource. Custom metrics can use only certain + // monitored resource types in their time series data. + google.api.MonitoredResource resource = 2; + + // Output only. The associated monitored resource metadata. When reading a + // time series, this field will include metadata labels that are explicitly + // named in the reduction. When creating a time series, this field is ignored. + google.api.MonitoredResourceMetadata metadata = 7; + + // The metric kind of the time series. When listing time series, this metric + // kind might be different from the metric kind of the associated metric if + // this time series is an alignment or reduction of other time series. + // + // When creating a time series, this field is optional. If present, it must be + // the same as the metric kind of the associated metric. If the associated + // metric's descriptor must be auto-created, then this field specifies the + // metric kind of the new descriptor and must be either `GAUGE` (the default) + // or `CUMULATIVE`. + google.api.MetricDescriptor.MetricKind metric_kind = 3; + + // The value type of the time series. When listing time series, this value + // type might be different from the value type of the associated metric if + // this time series is an alignment or reduction of other time series. + // + // When creating a time series, this field is optional. If present, it must be + // the same as the type of the data in the `points` field. + google.api.MetricDescriptor.ValueType value_type = 4; + + // The data points of this time series. When listing time series, points are + // returned in reverse time order. + // + // When creating a time series, this field must contain exactly one point and + // the point's type must be the same as the value type of the associated + // metric. If the associated metric's descriptor must be auto-created, then + // the value type of the descriptor is determined by the point's type, which + // must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`. + repeated Point points = 5; + + // The units in which the metric value is reported. It is only applicable + // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + // defines the representation of the stored metric values. + string unit = 8; +} + +// A descriptor for the labels and points in a time series. +message TimeSeriesDescriptor { + // A descriptor for the value columns in a data point. + message ValueDescriptor { + // The value key. + string key = 1; + + // The value type. + google.api.MetricDescriptor.ValueType value_type = 2; + + // The value stream kind. + google.api.MetricDescriptor.MetricKind metric_kind = 3; + + // The unit in which `time_series` point values are reported. `unit` + // follows the UCUM format for units as seen in + // https://unitsofmeasure.org/ucum.html. + // `unit` is only valid if `value_type` is INTEGER, DOUBLE, DISTRIBUTION. + string unit = 4; + } + + // Descriptors for the labels. + repeated google.api.LabelDescriptor label_descriptors = 1; + + // Descriptors for the point data value columns. + repeated ValueDescriptor point_descriptors = 5; +} + +// Represents the values of a time series associated with a +// TimeSeriesDescriptor. +message TimeSeriesData { + // A point's value columns and time interval. Each point has one or more + // point values corresponding to the entries in `point_descriptors` field in + // the TimeSeriesDescriptor associated with this object. + message PointData { + // The values that make up the point. + repeated TypedValue values = 1; + + // The time interval associated with the point. + TimeInterval time_interval = 2; + } + + // The values of the labels in the time series identifier, given in the same + // order as the `label_descriptors` field of the TimeSeriesDescriptor + // associated with this object. Each value must have a value of the type + // given in the corresponding entry of `label_descriptors`. + repeated LabelValue label_values = 1; + + // The points in the time series. + repeated PointData point_data = 2; +} + +// A label value. +message LabelValue { + // The label value can be a bool, int64, or string. + oneof value { + // A bool label value. + bool bool_value = 1; + + // An int64 label value. + int64 int64_value = 2; + + // A string label value. + string string_value = 3; + } +} + +// An error associated with a query in the time series query language format. +message QueryError { + // The location of the time series query language text that this error applies + // to. + TextLocator locator = 1; + + // The error message. + string message = 2; +} + +// A locator for text. Indicates a particular part of the text of a request or +// of an object referenced in the request. +// +// For example, suppose the request field `text` contains: +// +// text: "The quick brown fox jumps over the lazy dog." +// +// Then the locator: +// +// source: "text" +// start_position { +// line: 1 +// column: 17 +// } +// end_position { +// line: 1 +// column: 19 +// } +// +// refers to the part of the text: "fox". +message TextLocator { + // The position of a byte within the text. + message Position { + // The line, starting with 1, where the byte is positioned. + int32 line = 1; + + // The column within the line, starting with 1, where the byte is + // positioned. This is a byte index even though the text is UTF-8. + int32 column = 2; + } + + // The source of the text. The source may be a field in the request, in which + // case its format is the format of the + // google.rpc.BadRequest.FieldViolation.field field in + // https://cloud.google.com/apis/design/errors#error_details. It may also be + // be a source other than the request field (e.g. a macro definition + // referenced in the text of the query), in which case this is the name of + // the source (e.g. the macro name). + string source = 1; + + // The position of the first byte within the text. + Position start_position = 2; + + // The position of the last byte within the text. + Position end_position = 3; + + // If `source`, `start_position`, and `end_position` describe a call on + // some object (e.g. a macro in the time series query language text) and a + // location is to be designated in that object's text, `nested_locator` + // identifies the location within that object. + TextLocator nested_locator = 4; + + // When `nested_locator` is set, this field gives the reason for the nesting. + // Usually, the reason is a macro invocation. In that case, the macro name + // (including the leading '@') signals the location of the macro call + // in the text and a macro argument name (including the leading '$') signals + // the location of the macro argument inside the macro body that got + // substituted away. + string nesting_reason = 5; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/metric_service.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/metric_service.proto new file mode 100644 index 00000000000..ab30e285166 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/metric_service.proto @@ -0,0 +1,500 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/metric.proto"; +import "google/api/monitored_resource.proto"; +import "google/api/resource.proto"; +import "google/monitoring/v3/alert.proto"; +import "google/monitoring/v3/common.proto"; +import "google/monitoring/v3/metric.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "MetricServiceProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; +option (google.api.resource_definition) = { + type: "monitoring.googleapis.com/MetricDescriptor" + pattern: "projects/{project}/metricDescriptors/{metric_descriptor=**}" + pattern: "organizations/{organization}/metricDescriptors/{metric_descriptor=**}" + pattern: "folders/{folder}/metricDescriptors/{metric_descriptor=**}" + pattern: "*" + history: ORIGINALLY_SINGLE_PATTERN +}; +option (google.api.resource_definition) = { + type: "monitoring.googleapis.com/MonitoredResourceDescriptor" + pattern: "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}" + pattern: "organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}" + pattern: "folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}" + pattern: "*" + history: ORIGINALLY_SINGLE_PATTERN +}; +option (google.api.resource_definition) = { + type: "monitoring.googleapis.com/Workspace" + pattern: "projects/{project}" + pattern: "workspaces/{workspace}" +}; +option (google.api.resource_definition) = { + type: "monitoring.googleapis.com/TimeSeries" + pattern: "projects/{project}/timeSeries/{time_series}" + pattern: "organizations/{organization}/timeSeries/{time_series}" + pattern: "folders/{folder}/timeSeries/{time_series}" +}; + +// Manages metric descriptors, monitored resource descriptors, and +// time series data. +service MetricService { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read," + "https://www.googleapis.com/auth/monitoring.write"; + + // Lists monitored resource descriptors that match a filter. This method does not require a Workspace. + rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) { + option (google.api.http) = { + get: "/v3/{name=projects/*}/monitoredResourceDescriptors" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a single monitored resource descriptor. This method does not require a Workspace. + rpc GetMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest) returns (google.api.MonitoredResourceDescriptor) { + option (google.api.http) = { + get: "/v3/{name=projects/*/monitoredResourceDescriptors/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists metric descriptors that match a filter. This method does not require a Workspace. + rpc ListMetricDescriptors(ListMetricDescriptorsRequest) returns (ListMetricDescriptorsResponse) { + option (google.api.http) = { + get: "/v3/{name=projects/*}/metricDescriptors" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a single metric descriptor. This method does not require a Workspace. + rpc GetMetricDescriptor(GetMetricDescriptorRequest) returns (google.api.MetricDescriptor) { + option (google.api.http) = { + get: "/v3/{name=projects/*/metricDescriptors/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new metric descriptor. + // User-created metric descriptors define + // [custom metrics](https://cloud.google.com/monitoring/custom-metrics). + rpc CreateMetricDescriptor(CreateMetricDescriptorRequest) returns (google.api.MetricDescriptor) { + option (google.api.http) = { + post: "/v3/{name=projects/*}/metricDescriptors" + body: "metric_descriptor" + }; + option (google.api.method_signature) = "name,metric_descriptor"; + } + + // Deletes a metric descriptor. Only user-created + // [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be + // deleted. + rpc DeleteMetricDescriptor(DeleteMetricDescriptorRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3/{name=projects/*/metricDescriptors/**}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists time series that match a filter. This method does not require a Workspace. + rpc ListTimeSeries(ListTimeSeriesRequest) returns (ListTimeSeriesResponse) { + option (google.api.http) = { + get: "/v3/{name=projects/*}/timeSeries" + additional_bindings { + get: "/v3/{name=organizations/*}/timeSeries" + } + additional_bindings { + get: "/v3/{name=folders/*}/timeSeries" + } + }; + option (google.api.method_signature) = "name,filter,interval,view"; + } + + // Creates or adds data to one or more time series. + // The response is empty if all time series in the request were written. + // If any time series could not be written, a corresponding failure message is + // included in the error response. + rpc CreateTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v3/{name=projects/*}/timeSeries" + body: "*" + }; + option (google.api.method_signature) = "name,time_series"; + } +} + +// The `ListMonitoredResourceDescriptors` request. +message ListMonitoredResourceDescriptorsRequest { + // Required. The project on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string name = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/MonitoredResourceDescriptor" + } + ]; + + // An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + // describing the descriptors to be returned. The filter can reference the + // descriptor's type and labels. For example, the following filter returns + // only Google Compute Engine descriptors that have an `id` label: + // + // resource.type = starts_with("gce_") AND resource.label:id + string filter = 2; + + // A positive number that is the maximum number of results to return. + int32 page_size = 3; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 4; +} + +// The `ListMonitoredResourceDescriptors` response. +message ListMonitoredResourceDescriptorsResponse { + // The monitored resource descriptors that are available to this project + // and that match `filter`, if present. + repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `page_token` in the next call to this method. + string next_page_token = 2; +} + +// The `GetMonitoredResourceDescriptor` request. +message GetMonitoredResourceDescriptorRequest { + // Required. The monitored resource descriptor to get. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + // + // The `[RESOURCE_TYPE]` is a predefined type, such as + // `cloudsql_database`. + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/MonitoredResourceDescriptor" + } + ]; +} + +// The `ListMetricDescriptors` request. +message ListMetricDescriptorsRequest { + // Required. The project on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string name = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/MetricDescriptor" + } + ]; + + // If this field is empty, all custom and + // system-defined metric descriptors are returned. + // Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + // specifies which metric descriptors are to be + // returned. For example, the following filter matches all + // [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + // + // metric.type = starts_with("custom.googleapis.com/") + string filter = 2; + + // A positive number that is the maximum number of results to return. + int32 page_size = 3; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 4; +} + +// The `ListMetricDescriptors` response. +message ListMetricDescriptorsResponse { + // The metric descriptors that are available to the project + // and that match the value of `filter`, if present. + repeated google.api.MetricDescriptor metric_descriptors = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `page_token` in the next call to this method. + string next_page_token = 2; +} + +// The `GetMetricDescriptor` request. +message GetMetricDescriptorRequest { + // Required. The metric descriptor on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + // + // An example value of `[METRIC_ID]` is + // `"compute.googleapis.com/instance/disk/read_bytes_count"`. + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/MetricDescriptor" + } + ]; +} + +// The `CreateMetricDescriptor` request. +message CreateMetricDescriptorRequest { + // Required. The project on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/MetricDescriptor" + } + ]; + + // Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics) + // descriptor. + google.api.MetricDescriptor metric_descriptor = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The `DeleteMetricDescriptor` request. +message DeleteMetricDescriptorRequest { + // Required. The metric descriptor on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + // + // An example of `[METRIC_ID]` is: + // `"custom.googleapis.com/my_test_metric"`. + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/MetricDescriptor" + } + ]; +} + +// The `ListTimeSeries` request. +message ListTimeSeriesRequest { + // Controls which fields are returned by `ListTimeSeries`. + enum TimeSeriesView { + // Returns the identity of the metric(s), the time series, + // and the time series data. + FULL = 0; + + // Returns the identity of the metric and the time series resource, + // but not the time series data. + HEADERS = 1; + } + + // Required. The project, organization or folder on which to execute the request. The + // format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + // organizations/[ORGANIZATION_ID] + // folders/[FOLDER_ID] + string name = 10 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/TimeSeries" + } + ]; + + // Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + // that specifies which time series should be returned. The filter must + // specify a single metric type, and can additionally specify metric labels + // and other information. For example: + // + // metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + // metric.labels.instance_name = "my-instance-name" + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The time interval for which results should be returned. Only time series + // that contain data points in the specified interval are included + // in the response. + TimeInterval interval = 4 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the alignment of data points in individual time series as + // well as how to combine the retrieved time series across specified labels. + // + // By default (if no `aggregation` is explicitly specified), the raw time + // series data is returned. + Aggregation aggregation = 5; + + // Apply a second aggregation after `aggregation` is applied. May only be + // specified if `aggregation` is specified. + Aggregation secondary_aggregation = 11; + + // Unsupported: must be left blank. The points in each time series are + // currently returned in reverse time order (most recent to oldest). + string order_by = 6; + + // Required. Specifies which information is returned about the time series. + TimeSeriesView view = 7 [(google.api.field_behavior) = REQUIRED]; + + // A positive number that is the maximum number of results to return. If + // `page_size` is empty or more than 100,000 results, the effective + // `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + // maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + // the maximum number of `TimeSeries` returned. + int32 page_size = 8; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 9; +} + +// The `ListTimeSeries` response. +message ListTimeSeriesResponse { + // One or more time series that match the filter included in the request. + repeated TimeSeries time_series = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `page_token` in the next call to this method. + string next_page_token = 2; + + // Query execution errors that may have caused the time series data returned + // to be incomplete. + repeated google.rpc.Status execution_errors = 3; + + // The unit in which all `time_series` point values are reported. `unit` + // follows the UCUM format for units as seen in + // https://unitsofmeasure.org/ucum.html. + // If different `time_series` have different units (for example, because they + // come from different metric types, or a unit is absent), then `unit` will be + // "{not_a_unit}". + string unit = 5; +} + +// The `CreateTimeSeries` request. +message CreateTimeSeriesRequest { + // Required. The project on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The new data to be added to a list of time series. + // Adds at most one data point to each of several time series. The new data + // point must be more recent than any other point in its time series. Each + // `TimeSeries` value must fully specify a unique time series by supplying + // all label values for the metric and the monitored resource. + // + // The maximum number of `TimeSeries` objects per `Create` request is 200. + repeated TimeSeries time_series = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// DEPRECATED. Used to hold per-time-series error status. +message CreateTimeSeriesError { + // DEPRECATED. Time series ID that resulted in the `status` error. + TimeSeries time_series = 1 [deprecated = true]; + + // DEPRECATED. The status of the requested write operation for `time_series`. + google.rpc.Status status = 2 [deprecated = true]; +} + +// Summary of the result of a failed request to write data to a time series. +message CreateTimeSeriesSummary { + // Detailed information about an error category. + message Error { + // The status of the requested write operation. + google.rpc.Status status = 1; + + // The number of points that couldn't be written because of `status`. + int32 point_count = 2; + } + + // The number of points in the request. + int32 total_point_count = 1; + + // The number of points that were successfully written. + int32 success_point_count = 2; + + // The number of points that failed to be written. Order is not guaranteed. + repeated Error errors = 3; +} + +// The `QueryTimeSeries` request. +message QueryTimeSeriesRequest { + // Required. The project on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string name = 1; + + // Required. The query in the [Monitoring Query + // Language](https://cloud.google.com/monitoring/mql/reference) format. + // The default time zone is in UTC. + string query = 7; + + // A positive number that is the maximum number of time_series_data to return. + int32 page_size = 9; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 10; +} + +// The `QueryTimeSeries` response. +message QueryTimeSeriesResponse { + // The descriptor for the time series data. + TimeSeriesDescriptor time_series_descriptor = 8; + + // The time series data. + repeated TimeSeriesData time_series_data = 9; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, use that value as + // `page_token` in the next call to this method. + string next_page_token = 10; + + // Query execution errors that may have caused the time series data returned + // to be incomplete. The available data will be available in the + // response. + repeated google.rpc.Status partial_errors = 11; +} + +// This is an error detail intended to be used with INVALID_ARGUMENT errors. +message QueryErrorList { + // Errors in parsing the time series query language text. The number of errors + // in the response may be limited. + repeated QueryError errors = 1; + + // A summary of all the errors. + string error_summary = 2; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/mutation_record.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/mutation_record.proto new file mode 100644 index 00000000000..77c2d5c2b75 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/mutation_record.proto @@ -0,0 +1,36 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "MutationRecordProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// Describes a change made to a configuration. +message MutationRecord { + // When the change occurred. + google.protobuf.Timestamp mutate_time = 1; + + // The email address of the user making the change. + string mutated_by = 2; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/notification.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/notification.proto new file mode 100644 index 00000000000..74ea3a15f4f --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/notification.proto @@ -0,0 +1,193 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/label.proto"; +import "google/api/launch_stage.proto"; +import "google/api/resource.proto"; +import "google/monitoring/v3/common.proto"; +import "google/monitoring/v3/mutation_record.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "NotificationProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// A description of a notification channel. The descriptor includes +// the properties of the channel and the set of labels or fields that +// must be specified to configure channels of a given type. +message NotificationChannelDescriptor { + option (google.api.resource) = { + type: "monitoring.googleapis.com/NotificationChannelDescriptor" + pattern: "projects/{project}/notificationChannelDescriptors/{channel_descriptor}" + pattern: "organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}" + pattern: "folders/{folder}/notificationChannelDescriptors/{channel_descriptor}" + pattern: "*" + }; + + // The full REST resource name for this descriptor. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[TYPE] + // + // In the above, `[TYPE]` is the value of the `type` field. + string name = 6; + + // The type of notification channel, such as "email" and "sms". To view the + // full list of channels, see + // [Channel + // descriptors](https://cloud.google.com/monitoring/alerts/using-channels-api#ncd). + // Notification channel types are globally unique. + string type = 1; + + // A human-readable name for the notification channel type. This + // form of the name is suitable for a user interface. + string display_name = 2; + + // A human-readable description of the notification channel + // type. The description may include a description of the properties + // of the channel and pointers to external documentation. + string description = 3; + + // The set of labels that must be defined to identify a particular + // channel of the corresponding type. Each label includes a + // description for how that field should be populated. + repeated google.api.LabelDescriptor labels = 4; + + // The tiers that support this notification channel; the project service tier + // must be one of the supported_tiers. + repeated ServiceTier supported_tiers = 5 [deprecated = true]; + + // The product launch stage for channels of this type. + google.api.LaunchStage launch_stage = 7; +} + +// A `NotificationChannel` is a medium through which an alert is +// delivered when a policy violation is detected. Examples of channels +// include email, SMS, and third-party messaging applications. Fields +// containing sensitive information like authentication tokens or +// contact info are only partially populated on retrieval. +message NotificationChannel { + option (google.api.resource) = { + type: "monitoring.googleapis.com/NotificationChannel" + pattern: "projects/{project}/notificationChannels/{notification_channel}" + pattern: "organizations/{organization}/notificationChannels/{notification_channel}" + pattern: "folders/{folder}/notificationChannels/{notification_channel}" + pattern: "*" + }; + + // Indicates whether the channel has been verified or not. It is illegal + // to specify this field in a + // [`CreateNotificationChannel`][google.monitoring.v3.NotificationChannelService.CreateNotificationChannel] + // or an + // [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] + // operation. + enum VerificationStatus { + // Sentinel value used to indicate that the state is unknown, omitted, or + // is not applicable (as in the case of channels that neither support + // nor require verification in order to function). + VERIFICATION_STATUS_UNSPECIFIED = 0; + + // The channel has yet to be verified and requires verification to function. + // Note that this state also applies to the case where the verification + // process has been initiated by sending a verification code but where + // the verification code has not been submitted to complete the process. + UNVERIFIED = 1; + + // It has been proven that notifications can be received on this + // notification channel and that someone on the project has access + // to messages that are delivered to that channel. + VERIFIED = 2; + } + + // The type of the notification channel. This field matches the + // value of the [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type] field. + string type = 1; + + // The full REST resource name for this channel. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + // + // The `[CHANNEL_ID]` is automatically assigned by the server on creation. + string name = 6; + + // An optional human-readable name for this notification channel. It is + // recommended that you specify a non-empty and unique name in order to + // make it easier to identify the channels in your project, though this is + // not enforced. The display name is limited to 512 Unicode characters. + string display_name = 3; + + // An optional human-readable description of this notification channel. This + // description may provide additional details, beyond the display + // name, for the channel. This may not exceed 1024 Unicode characters. + string description = 4; + + // Configuration fields that define the channel and its behavior. The + // permissible and required labels are specified in the + // [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels] of the + // `NotificationChannelDescriptor` corresponding to the `type` field. + map labels = 5; + + // User-supplied key/value data that does not need to conform to + // the corresponding `NotificationChannelDescriptor`'s schema, unlike + // the `labels` field. This field is intended to be used for organizing + // and identifying the `NotificationChannel` objects. + // + // The field can contain up to 64 entries. Each key and value is limited to + // 63 Unicode characters or 128 bytes, whichever is smaller. Labels and + // values can contain only lowercase letters, numerals, underscores, and + // dashes. Keys must begin with a letter. + map user_labels = 8; + + // Indicates whether this channel has been verified or not. On a + // [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels] + // or + // [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + // operation, this field is expected to be populated. + // + // If the value is `UNVERIFIED`, then it indicates that the channel is + // non-functioning (it both requires verification and lacks verification); + // otherwise, it is assumed that the channel works. + // + // If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that + // the channel is of a type that does not require verification or that + // this specific channel has been exempted from verification because it was + // created prior to verification being required for channels of this type. + // + // This field cannot be modified using a standard + // [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] + // operation. To change the value of this field, you must call + // [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]. + VerificationStatus verification_status = 9; + + // Whether notifications are forwarded to the described channel. This makes + // it possible to disable delivery of notifications to a particular channel + // without removing the channel from all alerting policies that reference + // the channel. This is a more convenient approach when the change is + // temporary and you want to receive notifications from the same set + // of alerting policies on the channel at some point in the future. + google.protobuf.BoolValue enabled = 11; + + // Record of the creation of this channel. + MutationRecord creation_record = 12; + + // Records of the modification of this channel. + repeated MutationRecord mutation_records = 13; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/notification_service.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/notification_service.proto new file mode 100644 index 00000000000..0039ce15ebc --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/notification_service.proto @@ -0,0 +1,411 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/monitoring/v3/notification.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "NotificationServiceProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The Notification Channel API provides access to configuration that +// controls how messages related to incidents are sent. +service NotificationChannelService { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read"; + + // Lists the descriptors for supported channel types. The use of descriptors + // makes it possible for new channel types to be dynamically added. + rpc ListNotificationChannelDescriptors(ListNotificationChannelDescriptorsRequest) returns (ListNotificationChannelDescriptorsResponse) { + option (google.api.http) = { + get: "/v3/{name=projects/*}/notificationChannelDescriptors" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a single channel descriptor. The descriptor indicates which fields + // are expected / permitted for a notification channel of the given type. + rpc GetNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest) returns (NotificationChannelDescriptor) { + option (google.api.http) = { + get: "/v3/{name=projects/*/notificationChannelDescriptors/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists the notification channels that have been created for the project. + rpc ListNotificationChannels(ListNotificationChannelsRequest) returns (ListNotificationChannelsResponse) { + option (google.api.http) = { + get: "/v3/{name=projects/*}/notificationChannels" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a single notification channel. The channel includes the relevant + // configuration details with which the channel was created. However, the + // response may truncate or omit passwords, API keys, or other private key + // matter and thus the response may not be 100% identical to the information + // that was supplied in the call to the create method. + rpc GetNotificationChannel(GetNotificationChannelRequest) returns (NotificationChannel) { + option (google.api.http) = { + get: "/v3/{name=projects/*/notificationChannels/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new notification channel, representing a single notification + // endpoint such as an email address, SMS number, or PagerDuty service. + rpc CreateNotificationChannel(CreateNotificationChannelRequest) returns (NotificationChannel) { + option (google.api.http) = { + post: "/v3/{name=projects/*}/notificationChannels" + body: "notification_channel" + }; + option (google.api.method_signature) = "name,notification_channel"; + } + + // Updates a notification channel. Fields not specified in the field mask + // remain unchanged. + rpc UpdateNotificationChannel(UpdateNotificationChannelRequest) returns (NotificationChannel) { + option (google.api.http) = { + patch: "/v3/{notification_channel.name=projects/*/notificationChannels/*}" + body: "notification_channel" + }; + option (google.api.method_signature) = "update_mask,notification_channel"; + } + + // Deletes a notification channel. + rpc DeleteNotificationChannel(DeleteNotificationChannelRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3/{name=projects/*/notificationChannels/*}" + }; + option (google.api.method_signature) = "name,force"; + } + + // Causes a verification code to be delivered to the channel. The code + // can then be supplied in `VerifyNotificationChannel` to verify the channel. + rpc SendNotificationChannelVerificationCode(SendNotificationChannelVerificationCodeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Requests a verification code for an already verified channel that can then + // be used in a call to VerifyNotificationChannel() on a different channel + // with an equivalent identity in the same or in a different project. This + // makes it possible to copy a channel between projects without requiring + // manual reverification of the channel. If the channel is not in the + // verified state, this method will fail (in other words, this may only be + // used if the SendNotificationChannelVerificationCode and + // VerifyNotificationChannel paths have already been used to put the given + // channel into the verified state). + // + // There is no guarantee that the verification codes returned by this method + // will be of a similar structure or form as the ones that are delivered + // to the channel via SendNotificationChannelVerificationCode; while + // VerifyNotificationChannel() will recognize both the codes delivered via + // SendNotificationChannelVerificationCode() and returned from + // GetNotificationChannelVerificationCode(), it is typically the case that + // the verification codes delivered via + // SendNotificationChannelVerificationCode() will be shorter and also + // have a shorter expiration (e.g. codes such as "G-123456") whereas + // GetVerificationCode() will typically return a much longer, websafe base + // 64 encoded string that has a longer expiration time. + rpc GetNotificationChannelVerificationCode(GetNotificationChannelVerificationCodeRequest) returns (GetNotificationChannelVerificationCodeResponse) { + option (google.api.http) = { + post: "/v3/{name=projects/*/notificationChannels/*}:getVerificationCode" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Verifies a `NotificationChannel` by proving receipt of the code + // delivered to the channel as a result of calling + // `SendNotificationChannelVerificationCode`. + rpc VerifyNotificationChannel(VerifyNotificationChannelRequest) returns (NotificationChannel) { + option (google.api.http) = { + post: "/v3/{name=projects/*/notificationChannels/*}:verify" + body: "*" + }; + option (google.api.method_signature) = "name,code"; + } +} + +// The `ListNotificationChannelDescriptors` request. +message ListNotificationChannelDescriptorsRequest { + // Required. The REST resource name of the parent from which to retrieve + // the notification channel descriptors. The expected syntax is: + // + // projects/[PROJECT_ID_OR_NUMBER] + // + // Note that this names the parent container in which to look for the + // descriptors; to retrieve a single descriptor by name, use the + // [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + // operation, instead. + string name = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/NotificationChannelDescriptor" + } + ]; + + // The maximum number of results to return in a single response. If + // not set to a positive number, a reasonable value will be chosen by the + // service. + int32 page_size = 2; + + // If non-empty, `page_token` must contain a value returned as the + // `next_page_token` in a previous response to request the next set + // of results. + string page_token = 3; +} + +// The `ListNotificationChannelDescriptors` response. +message ListNotificationChannelDescriptorsResponse { + // The monitored resource descriptors supported for the specified + // project, optionally filtered. + repeated NotificationChannelDescriptor channel_descriptors = 1; + + // If not empty, indicates that there may be more results that match + // the request. Use the value in the `page_token` field in a + // subsequent request to fetch the next set of results. If empty, + // all results have been returned. + string next_page_token = 2; +} + +// The `GetNotificationChannelDescriptor` response. +message GetNotificationChannelDescriptorRequest { + // Required. The channel type for which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/NotificationChannelDescriptor" + } + ]; +} + +// The `CreateNotificationChannel` request. +message CreateNotificationChannelRequest { + // Required. The project on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + // + // This names the container into which the channel will be + // written, this does not name the newly created channel. The resulting + // channel's name will have a normalized version of this field as a prefix, + // but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/NotificationChannel" + } + ]; + + // Required. The definition of the `NotificationChannel` to create. + NotificationChannel notification_channel = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The `ListNotificationChannels` request. +message ListNotificationChannelsRequest { + // Required. The project on which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + // + // This names the container + // in which to look for the notification channels; it does not name a + // specific channel. To query a specific channel by REST resource name, use + // the + // [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + // operation. + string name = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/NotificationChannel" + } + ]; + + // If provided, this field specifies the criteria that must be met by + // notification channels to be included in the response. + // + // For more details, see [sorting and + // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + string filter = 6; + + // A comma-separated list of fields by which to sort the result. Supports + // the same set of fields as in `filter`. Entries can be prefixed with + // a minus sign to sort in descending rather than ascending order. + // + // For more details, see [sorting and + // filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + string order_by = 7; + + // The maximum number of results to return in a single response. If + // not set to a positive number, a reasonable value will be chosen by the + // service. + int32 page_size = 3; + + // If non-empty, `page_token` must contain a value returned as the + // `next_page_token` in a previous response to request the next set + // of results. + string page_token = 4; +} + +// The `ListNotificationChannels` response. +message ListNotificationChannelsResponse { + // The notification channels defined for the specified project. + repeated NotificationChannel notification_channels = 3; + + // If not empty, indicates that there may be more results that match + // the request. Use the value in the `page_token` field in a + // subsequent request to fetch the next set of results. If empty, + // all results have been returned. + string next_page_token = 2; + + // The total number of notification channels in all pages. This number is only + // an estimate, and may change in subsequent pages. https://aip.dev/158 + int32 total_size = 4; +} + +// The `GetNotificationChannel` request. +message GetNotificationChannelRequest { + // Required. The channel for which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/NotificationChannel" + } + ]; +} + +// The `UpdateNotificationChannel` request. +message UpdateNotificationChannelRequest { + // The fields to update. + google.protobuf.FieldMask update_mask = 2; + + // Required. A description of the changes to be applied to the specified + // notification channel. The description must provide a definition for + // fields to be updated; the names of these fields should also be + // included in the `update_mask`. + NotificationChannel notification_channel = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The `DeleteNotificationChannel` request. +message DeleteNotificationChannelRequest { + // Required. The channel for which to execute the request. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + string name = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/NotificationChannel" + } + ]; + + // If true, the notification channel will be deleted regardless of its + // use in alert policies (the policies will be updated to remove the + // channel). If false, channels that are still referenced by an existing + // alerting policy will fail to be deleted in a delete operation. + bool force = 5; +} + +// The `SendNotificationChannelVerificationCode` request. +message SendNotificationChannelVerificationCodeRequest { + // Required. The notification channel to which to send a verification code. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/NotificationChannel" + } + ]; +} + +// The `GetNotificationChannelVerificationCode` request. +message GetNotificationChannelVerificationCodeRequest { + // Required. The notification channel for which a verification code is to be generated + // and retrieved. This must name a channel that is already verified; if + // the specified channel is not verified, the request will fail. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/NotificationChannel" + } + ]; + + // The desired expiration time. If specified, the API will guarantee that + // the returned code will not be valid after the specified timestamp; + // however, the API cannot guarantee that the returned code will be + // valid for at least as long as the requested time (the API puts an upper + // bound on the amount of time for which a code may be valid). If omitted, + // a default expiration will be used, which may be less than the max + // permissible expiration (so specifying an expiration may extend the + // code's lifetime over omitting an expiration, even though the API does + // impose an upper limit on the maximum expiration that is permitted). + google.protobuf.Timestamp expire_time = 2; +} + +// The `GetNotificationChannelVerificationCode` request. +message GetNotificationChannelVerificationCodeResponse { + // The verification code, which may be used to verify other channels + // that have an equivalent identity (i.e. other channels of the same + // type with the same fingerprint such as other email channels with + // the same email address or other sms channels with the same number). + string code = 1; + + // The expiration time associated with the code that was returned. If + // an expiration was provided in the request, this is the minimum of the + // requested expiration in the request and the max permitted expiration. + google.protobuf.Timestamp expire_time = 2; +} + +// The `VerifyNotificationChannel` request. +message VerifyNotificationChannelRequest { + // Required. The notification channel to verify. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/NotificationChannel" + } + ]; + + // Required. The verification code that was delivered to the channel as + // a result of invoking the `SendNotificationChannelVerificationCode` API + // method or that was retrieved from a verified channel via + // `GetNotificationChannelVerificationCode`. For example, one might have + // "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + // guaranteed that the code is valid UTF-8; one should not + // make any assumptions regarding the structure or format of the code). + string code = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/query_service.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/query_service.proto new file mode 100644 index 00000000000..80bb4126336 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/query_service.proto @@ -0,0 +1,50 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/label.proto"; +import "google/monitoring/v3/metric.proto"; +import "google/monitoring/v3/metric_service.proto"; +import "google/api/client.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "QueryServiceProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The QueryService API is used to manage time series data in Stackdriver +// Monitoring. Time series data is a collection of data points that describes +// the time-varying values of a metric. +service QueryService { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read"; + + // Queries time series using Monitoring Query Language. This method does not require a Workspace. + rpc QueryTimeSeries(QueryTimeSeriesRequest) returns (QueryTimeSeriesResponse) { + option (google.api.http) = { + post: "/v3/{name=projects/*}/timeSeries:query" + body: "*" + }; + } +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/service.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/service.proto new file mode 100644 index 00000000000..a0156e9e8dc --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/service.proto @@ -0,0 +1,444 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/calendar_period.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "ServiceMonitoringProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// A `Service` is a discrete, autonomous, and network-accessible unit, designed +// to solve an individual concern +// ([Wikipedia](https://en.wikipedia.org/wiki/Service-orientation)). In +// Cloud Monitoring, a `Service` acts as the root resource under which +// operational aspects of the service are accessible. +message Service { + option (google.api.resource) = { + type: "monitoring.googleapis.com/Service" + pattern: "projects/{project}/services/{service}" + pattern: "organizations/{organization}/services/{service}" + pattern: "folders/{folder}/services/{service}" + pattern: "*" + }; + + // Custom view of service telemetry. Currently a place-holder pending final + // design. + message Custom { + + } + + // App Engine service. Learn more at https://cloud.google.com/appengine. + message AppEngine { + // The ID of the App Engine module underlying this service. Corresponds to + // the `module_id` resource label in the `gae_app` monitored resource: + // https://cloud.google.com/monitoring/api/resources#tag_gae_app + string module_id = 1; + } + + // Cloud Endpoints service. Learn more at https://cloud.google.com/endpoints. + message CloudEndpoints { + // The name of the Cloud Endpoints service underlying this service. + // Corresponds to the `service` resource label in the `api` monitored + // resource: https://cloud.google.com/monitoring/api/resources#tag_api + string service = 1; + } + + // Istio service scoped to a single Kubernetes cluster. Learn more at + // https://istio.io. Clusters running OSS Istio will have their services + // ingested as this type. + message ClusterIstio { + // The location of the Kubernetes cluster in which this Istio service is + // defined. Corresponds to the `location` resource label in `k8s_cluster` + // resources. + string location = 1; + + // The name of the Kubernetes cluster in which this Istio service is + // defined. Corresponds to the `cluster_name` resource label in + // `k8s_cluster` resources. + string cluster_name = 2; + + // The namespace of the Istio service underlying this service. Corresponds + // to the `destination_service_namespace` metric label in Istio metrics. + string service_namespace = 3; + + // The name of the Istio service underlying this service. Corresponds to the + // `destination_service_name` metric label in Istio metrics. + string service_name = 4; + } + + // Istio service scoped to an Istio mesh. Anthos clusters running ASM < 1.6.8 + // will have their services ingested as this type. + message MeshIstio { + // Identifier for the mesh in which this Istio service is defined. + // Corresponds to the `mesh_uid` metric label in Istio metrics. + string mesh_uid = 1; + + // The namespace of the Istio service underlying this service. Corresponds + // to the `destination_service_namespace` metric label in Istio metrics. + string service_namespace = 3; + + // The name of the Istio service underlying this service. Corresponds to the + // `destination_service_name` metric label in Istio metrics. + string service_name = 4; + } + + // Canonical service scoped to an Istio mesh. Anthos clusters running ASM >= + // 1.6.8 will have their services ingested as this type. + message IstioCanonicalService { + // Identifier for the Istio mesh in which this canonical service is defined. + // Corresponds to the `mesh_uid` metric label in + // [Istio metrics](https://cloud.google.com/monitoring/api/metrics_istio). + string mesh_uid = 1; + + // The namespace of the canonical service underlying this service. + // Corresponds to the `destination_canonical_service_namespace` metric + // label in [Istio + // metrics](https://cloud.google.com/monitoring/api/metrics_istio). + string canonical_service_namespace = 3; + + // The name of the canonical service underlying this service. + // Corresponds to the `destination_canonical_service_name` metric label in + // label in [Istio + // metrics](https://cloud.google.com/monitoring/api/metrics_istio). + string canonical_service = 4; + } + + // Configuration for how to query telemetry on a Service. + message Telemetry { + // The full name of the resource that defines this service. Formatted as + // described in https://cloud.google.com/apis/design/resource_names. + string resource_name = 1; + } + + // Resource name for this Service. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + string name = 1; + + // Name used for UI elements listing this Service. + string display_name = 2; + + // REQUIRED. Service-identifying atoms specifying the underlying service. + oneof identifier { + // Custom service type. + Custom custom = 6; + + // Type used for App Engine services. + AppEngine app_engine = 7; + + // Type used for Cloud Endpoints services. + CloudEndpoints cloud_endpoints = 8; + + // Type used for Istio services that live in a Kubernetes cluster. + ClusterIstio cluster_istio = 9; + + // Type used for Istio services scoped to an Istio mesh. + MeshIstio mesh_istio = 10; + + // Type used for canonical services scoped to an Istio mesh. + // Metrics for Istio are + // [documented here](https://istio.io/latest/docs/reference/config/metrics/) + IstioCanonicalService istio_canonical_service = 11; + } + + // Configuration for how to query telemetry on a Service. + Telemetry telemetry = 13; +} + +// A Service-Level Objective (SLO) describes a level of desired good service. It +// consists of a service-level indicator (SLI), a performance goal, and a period +// over which the objective is to be evaluated against that goal. The SLO can +// use SLIs defined in a number of different manners. Typical SLOs might include +// "99% of requests in each rolling week have latency below 200 milliseconds" or +// "99.5% of requests in each calendar month return successfully." +message ServiceLevelObjective { + option (google.api.resource) = { + type: "monitoring.googleapis.com/ServiceLevelObjective" + pattern: "projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}" + pattern: "organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}" + pattern: "folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}" + pattern: "*" + history: ORIGINALLY_SINGLE_PATTERN + }; + + // `ServiceLevelObjective.View` determines what form of + // `ServiceLevelObjective` is returned from `GetServiceLevelObjective`, + // `ListServiceLevelObjectives`, and `ListServiceLevelObjectiveVersions` RPCs. + enum View { + // Same as FULL. + VIEW_UNSPECIFIED = 0; + + // Return the embedded `ServiceLevelIndicator` in the form in which it was + // defined. If it was defined using a `BasicSli`, return that `BasicSli`. + FULL = 2; + + // For `ServiceLevelIndicator`s using `BasicSli` articulation, instead + // return the `ServiceLevelIndicator` with its mode of computation fully + // spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using + // `RequestBasedSli` or `WindowsBasedSli`, return the + // `ServiceLevelIndicator` as it was provided. + EXPLICIT = 1; + } + + // Resource name for this `ServiceLevelObjective`. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + string name = 1; + + // Name used for UI elements listing this SLO. + string display_name = 11; + + // The definition of good service, used to measure and calculate the quality + // of the `Service`'s performance with respect to a single aspect of service + // quality. + ServiceLevelIndicator service_level_indicator = 3; + + // The fraction of service that must be good in order for this objective to be + // met. `0 < goal <= 0.999`. + double goal = 4; + + // The time period over which the objective will be evaluated. + oneof period { + // A rolling time period, semantically "in the past ``". + // Must be an integer multiple of 1 day no larger than 30 days. + google.protobuf.Duration rolling_period = 5; + + // A calendar period, semantically "since the start of the current + // ``". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and + // `MONTH` are supported. + google.type.CalendarPeriod calendar_period = 6; + } +} + +// A Service-Level Indicator (SLI) describes the "performance" of a service. For +// some services, the SLI is well-defined. In such cases, the SLI can be +// described easily by referencing the well-known SLI and providing the needed +// parameters. Alternatively, a "custom" SLI can be defined with a query to the +// underlying metric store. An SLI is defined to be `good_service / +// total_service` over any queried time interval. The value of performance +// always falls into the range `0 <= performance <= 1`. A custom SLI describes +// how to compute this ratio, whether this is by dividing values from a pair of +// time series, cutting a `Distribution` into good and bad counts, or counting +// time windows in which the service complies with a criterion. For separation +// of concerns, a single Service-Level Indicator measures performance for only +// one aspect of service quality, such as fraction of successful queries or +// fast-enough queries. +message ServiceLevelIndicator { + // Service level indicators can be grouped by whether the "unit" of service + // being measured is based on counts of good requests or on counts of good + // time windows + oneof type { + // Basic SLI on a well-known service type. + BasicSli basic_sli = 4; + + // Request-based SLIs + RequestBasedSli request_based = 1; + + // Windows-based SLIs + WindowsBasedSli windows_based = 2; + } +} + +// An SLI measuring performance on a well-known service type. Performance will +// be computed on the basis of pre-defined metrics. The type of the +// `service_resource` determines the metrics to use and the +// `service_resource.labels` and `metric_labels` are used to construct a +// monitoring filter to filter that metric down to just the data relevant to +// this service. +message BasicSli { + // Future parameters for the availability SLI. + message AvailabilityCriteria { + + } + + // Parameters for a latency threshold SLI. + message LatencyCriteria { + // Good service is defined to be the count of requests made to this service + // that return in no more than `threshold`. + google.protobuf.Duration threshold = 3; + } + + // OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from + // other methods will not be used to calculate performance for this SLI. If + // omitted, this SLI applies to all the Service's methods. For service types + // that don't support breaking down by method, setting this field will result + // in an error. + repeated string method = 7; + + // OPTIONAL: The set of locations to which this SLI is relevant. Telemetry + // from other locations will not be used to calculate performance for this + // SLI. If omitted, this SLI applies to all locations in which the Service has + // activity. For service types that don't support breaking down by location, + // setting this field will result in an error. + repeated string location = 8; + + // OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry + // from other API versions will not be used to calculate performance for this + // SLI. If omitted, this SLI applies to all API versions. For service types + // that don't support breaking down by version, setting this field will result + // in an error. + repeated string version = 9; + + // This SLI can be evaluated on the basis of availability or latency. + oneof sli_criteria { + // Good service is defined to be the count of requests made to this service + // that return successfully. + AvailabilityCriteria availability = 2; + + // Good service is defined to be the count of requests made to this service + // that are fast enough with respect to `latency.threshold`. + LatencyCriteria latency = 3; + } +} + +// Range of numerical values, inclusive of `min` and exclusive of `max`. If the +// open range "< range.max" is desired, set `range.min = -infinity`. If the open +// range ">= range.min" is desired, set `range.max = infinity`. +message Range { + // Range minimum. + double min = 1; + + // Range maximum. + double max = 2; +} + +// Service Level Indicators for which atomic units of service are counted +// directly. +message RequestBasedSli { + // The means to compute a ratio of `good_service` to `total_service`. + oneof method { + // `good_total_ratio` is used when the ratio of `good_service` to + // `total_service` is computed from two `TimeSeries`. + TimeSeriesRatio good_total_ratio = 1; + + // `distribution_cut` is used when `good_service` is a count of values + // aggregated in a `Distribution` that fall into a good range. The + // `total_service` is the total count of all values aggregated in the + // `Distribution`. + DistributionCut distribution_cut = 3; + } +} + +// A `TimeSeriesRatio` specifies two `TimeSeries` to use for computing the +// `good_service / total_service` ratio. The specified `TimeSeries` must have +// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = +// DELTA` or `MetricKind = CUMULATIVE`. The `TimeSeriesRatio` must specify +// exactly two of good, bad, and total, and the relationship `good_service + +// bad_service = total_service` will be assumed. +message TimeSeriesRatio { + // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + // specifying a `TimeSeries` quantifying good service provided. Must have + // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + // DELTA` or `MetricKind = CUMULATIVE`. + string good_service_filter = 4; + + // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + // specifying a `TimeSeries` quantifying bad service, either demanded service + // that was not provided or demanded service that was of inadequate quality. + // Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have + // `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + string bad_service_filter = 5; + + // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + // specifying a `TimeSeries` quantifying total demanded service. Must have + // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = + // DELTA` or `MetricKind = CUMULATIVE`. + string total_service_filter = 6; +} + +// A `DistributionCut` defines a `TimeSeries` and thresholds used for measuring +// good service and total service. The `TimeSeries` must have `ValueType = +// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. The +// computed `good_service` will be the count of values x in the `Distribution` +// such that `range.min <= x < range.max`. +message DistributionCut { + // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + // specifying a `TimeSeries` aggregating values. Must have `ValueType = + // DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. + string distribution_filter = 4; + + // Range of values considered "good." For a one-sided range, set one bound to + // an infinite value. + Range range = 5; +} + +// A `WindowsBasedSli` defines `good_service` as the count of time windows for +// which the provided service was of good quality. Criteria for determining +// if service was good are embedded in the `window_criterion`. +message WindowsBasedSli { + // A `PerformanceThreshold` is used when each window is good when that window + // has a sufficiently high `performance`. + message PerformanceThreshold { + // The means, either a request-based SLI or a basic SLI, by which to compute + // performance over a window. + oneof type { + // `RequestBasedSli` to evaluate to judge window quality. + RequestBasedSli performance = 1; + + // `BasicSli` to evaluate to judge window quality. + BasicSli basic_sli_performance = 3; + } + + // If window `performance >= threshold`, the window is counted as good. + double threshold = 2; + } + + // A `MetricRange` is used when each window is good when the value x of a + // single `TimeSeries` satisfies `range.min <= x < range.max`. The provided + // `TimeSeries` must have `ValueType = INT64` or `ValueType = DOUBLE` and + // `MetricKind = GAUGE`. + message MetricRange { + // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + // specifying the `TimeSeries` to use for evaluating window quality. + string time_series = 1; + + // Range of values considered "good." For a one-sided range, set one bound + // to an infinite value. + Range range = 4; + } + + // The criterion to use for evaluating window goodness. + oneof window_criterion { + // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + // specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if + // any `true` values appear in the window. + string good_bad_metric_filter = 5; + + // A window is good if its `performance` is high enough. + PerformanceThreshold good_total_ratio_threshold = 2; + + // A window is good if the metric's value is in a good range, averaged + // across returned streams. + MetricRange metric_mean_in_range = 6; + + // A window is good if the metric's value is in a good range, summed across + // returned streams. + MetricRange metric_sum_in_range = 7; + } + + // Duration over which window quality is evaluated. Must be an integer + // fraction of a day and at least `60s`. + google.protobuf.Duration window_period = 4; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/service_service.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/service_service.proto new file mode 100644 index 00000000000..07916e62418 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/service_service.proto @@ -0,0 +1,350 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/monitoring/v3/service.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "ServiceMonitoringServiceProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The Cloud Monitoring Service-Oriented Monitoring API has endpoints for +// managing and querying aspects of a workspace's services. These include the +// `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy +// of categorized Health Metrics. +service ServiceMonitoringService { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read"; + + // Create a `Service`. + rpc CreateService(CreateServiceRequest) returns (Service) { + option (google.api.http) = { + post: "/v3/{parent=*/*}/services" + body: "service" + }; + option (google.api.method_signature) = "parent,service"; + } + + // Get the named `Service`. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { + get: "/v3/{name=*/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List `Service`s for this workspace. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v3/{parent=*/*}/services" + }; + option (google.api.method_signature) = "parent"; + } + + // Update this `Service`. + rpc UpdateService(UpdateServiceRequest) returns (Service) { + option (google.api.http) = { + patch: "/v3/{service.name=*/*/services/*}" + body: "service" + }; + option (google.api.method_signature) = "service"; + } + + // Soft delete this `Service`. + rpc DeleteService(DeleteServiceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3/{name=*/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Create a `ServiceLevelObjective` for the given `Service`. + rpc CreateServiceLevelObjective(CreateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { + option (google.api.http) = { + post: "/v3/{parent=*/*/services/*}/serviceLevelObjectives" + body: "service_level_objective" + }; + option (google.api.method_signature) = "parent,service_level_objective"; + } + + // Get a `ServiceLevelObjective` by name. + rpc GetServiceLevelObjective(GetServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { + option (google.api.http) = { + get: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List the `ServiceLevelObjective`s for the given `Service`. + rpc ListServiceLevelObjectives(ListServiceLevelObjectivesRequest) returns (ListServiceLevelObjectivesResponse) { + option (google.api.http) = { + get: "/v3/{parent=*/*/services/*}/serviceLevelObjectives" + }; + option (google.api.method_signature) = "parent"; + } + + // Update the given `ServiceLevelObjective`. + rpc UpdateServiceLevelObjective(UpdateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { + option (google.api.http) = { + patch: "/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}" + body: "service_level_objective" + }; + option (google.api.method_signature) = "service_level_objective"; + } + + // Delete the given `ServiceLevelObjective`. + rpc DeleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// The `CreateService` request. +message CreateServiceRequest { + // Required. Resource name of the parent workspace. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/Service" + } + ]; + + // Optional. The Service id to use for this Service. If omitted, an id will be + // generated instead. Must match the pattern `[a-z0-9\-]+` + string service_id = 3; + + // Required. The `Service` to create. + Service service = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The `GetService` request. +message GetServiceRequest { + // Required. Resource name of the `Service`. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Service" + } + ]; +} + +// The `ListServices` request. +message ListServicesRequest { + // Required. Resource name of the parent containing the listed services, either a + // project or a Monitoring Workspace. The formats are: + // + // projects/[PROJECT_ID_OR_NUMBER] + // workspaces/[HOST_PROJECT_ID_OR_NUMBER] + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/Service" + } + ]; + + // A filter specifying what `Service`s to return. The filter currently + // supports the following fields: + // + // - `identifier_case` + // - `app_engine.module_id` + // - `cloud_endpoints.service` (reserved for future use) + // - `mesh_istio.mesh_uid` + // - `mesh_istio.service_namespace` + // - `mesh_istio.service_name` + // - `cluster_istio.location` (deprecated) + // - `cluster_istio.cluster_name` (deprecated) + // - `cluster_istio.service_namespace` (deprecated) + // - `cluster_istio.service_name` (deprecated) + // + // `identifier_case` refers to which option in the identifier oneof is + // populated. For example, the filter `identifier_case = "CUSTOM"` would match + // all services with a value for the `custom` field. Valid options are + // "CUSTOM", "APP_ENGINE", "MESH_ISTIO", plus "CLUSTER_ISTIO" (deprecated) + // and "CLOUD_ENDPOINTS" (reserved for future use). + string filter = 2; + + // A non-negative number that is the maximum number of results to return. + // When 0, use default page size. + int32 page_size = 3; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 4; +} + +// The `ListServices` response. +message ListServicesResponse { + // The `Service`s matching the specified filter. + repeated Service services = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `page_token` in the next call to this method. + string next_page_token = 2; +} + +// The `UpdateService` request. +message UpdateServiceRequest { + // Required. The `Service` to draw updates from. + // The given `name` specifies the resource to update. + Service service = 1 [(google.api.field_behavior) = REQUIRED]; + + // A set of field paths defining which fields to use for the update. + google.protobuf.FieldMask update_mask = 2; +} + +// The `DeleteService` request. +message DeleteServiceRequest { + // Required. Resource name of the `Service` to delete. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Service" + } + ]; +} + +// The `CreateServiceLevelObjective` request. +message CreateServiceLevelObjectiveRequest { + // Required. Resource name of the parent `Service`. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Service" + } + ]; + + // Optional. The ServiceLevelObjective id to use for this + // ServiceLevelObjective. If omitted, an id will be generated instead. Must + // match the pattern `[a-z0-9\-]+` + string service_level_objective_id = 3; + + // Required. The `ServiceLevelObjective` to create. + // The provided `name` will be respected if no `ServiceLevelObjective` exists + // with this name. + ServiceLevelObjective service_level_objective = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The `GetServiceLevelObjective` request. +message GetServiceLevelObjectiveRequest { + // Required. Resource name of the `ServiceLevelObjective` to get. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/ServiceLevelObjective" + } + ]; + + // View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the + // `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + // `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + // `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + ServiceLevelObjective.View view = 2; +} + +// The `ListServiceLevelObjectives` request. +message ListServiceLevelObjectivesRequest { + // Required. Resource name of the parent containing the listed SLOs, either a + // project or a Monitoring Workspace. The formats are: + // + // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + // workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/Service" + } + ]; + + // A filter specifying what `ServiceLevelObjective`s to return. + string filter = 2; + + // A non-negative number that is the maximum number of results to return. + // When 0, use default page size. + int32 page_size = 3; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return additional results from the previous method call. + string page_token = 4; + + // View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + // `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + // `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + // `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + ServiceLevelObjective.View view = 5; +} + +// The `ListServiceLevelObjectives` response. +message ListServiceLevelObjectivesResponse { + // The `ServiceLevelObjective`s matching the specified filter. + repeated ServiceLevelObjective service_level_objectives = 1; + + // If there are more results than have been returned, then this field is set + // to a non-empty value. To see the additional results, + // use that value as `page_token` in the next call to this method. + string next_page_token = 2; +} + +// The `UpdateServiceLevelObjective` request. +message UpdateServiceLevelObjectiveRequest { + // Required. The `ServiceLevelObjective` to draw updates from. + // The given `name` specifies the resource to update. + ServiceLevelObjective service_level_objective = 1 [(google.api.field_behavior) = REQUIRED]; + + // A set of field paths defining which fields to use for the update. + google.protobuf.FieldMask update_mask = 2; +} + +// The `DeleteServiceLevelObjective` request. +message DeleteServiceLevelObjectiveRequest { + // Required. Resource name of the `ServiceLevelObjective` to delete. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/ServiceLevelObjective" + } + ]; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/span_context.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/span_context.proto new file mode 100644 index 00000000000..cfb8f267fc8 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/span_context.proto @@ -0,0 +1,45 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "SpanContextProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The context of a span, attached to +// [Exemplars][google.api.Distribution.Exemplars] +// in [Distribution][google.api.Distribution] values during aggregation. +// +// It contains the name of a span with format: +// +// projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID] +message SpanContext { + // The resource name of the span. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/traces/[TRACE_ID]/spans/[SPAN_ID] + // + // `[TRACE_ID]` is a unique identifier for a trace within a project; + // it is a 32-character hexadecimal encoding of a 16-byte array. + // + // `[SPAN_ID]` is a unique identifier for a span within a trace; it + // is a 16-character hexadecimal encoding of an 8-byte array. + string span_name = 1; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/uptime.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/uptime.proto new file mode 100644 index 00000000000..1f66ffcc57e --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/uptime.proto @@ -0,0 +1,400 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/monitored_resource.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "UptimeProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The regions from which an Uptime check can be run. +enum UptimeCheckRegion { + // Default value if no region is specified. Will result in Uptime checks + // running from all regions. + REGION_UNSPECIFIED = 0; + + // Allows checks to run from locations within the United States of America. + USA = 1; + + // Allows checks to run from locations within the continent of Europe. + EUROPE = 2; + + // Allows checks to run from locations within the continent of South + // America. + SOUTH_AMERICA = 3; + + // Allows checks to run from locations within the Asia Pacific area (ex: + // Singapore). + ASIA_PACIFIC = 4; +} + +// An internal checker allows Uptime checks to run on private/internal GCP +// resources. +message InternalChecker { + option deprecated = true; + + // Operational states for an internal checker. + enum State { + // An internal checker should never be in the unspecified state. + UNSPECIFIED = 0; + + // The checker is being created, provisioned, and configured. A checker in + // this state can be returned by `ListInternalCheckers` or + // `GetInternalChecker`, as well as by examining the [long running + // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) + // that created it. + CREATING = 1; + + // The checker is running and available for use. A checker in this state + // can be returned by `ListInternalCheckers` or `GetInternalChecker` as + // well as by examining the [long running + // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) + // that created it. + // If a checker is being torn down, it is neither visible nor usable, so + // there is no "deleting" or "down" state. + RUNNING = 2; + } + + // A unique resource name for this InternalChecker. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID] + // + // `[PROJECT_ID_OR_NUMBER]` is the Stackdriver Workspace project for the + // Uptime check config associated with the internal checker. + string name = 1; + + // The checker's human-readable name. The display name + // should be unique within a Stackdriver Workspace in order to make it easier + // to identify; however, uniqueness is not enforced. + string display_name = 2; + + // The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the + // internal resource lives (ex: "default"). + string network = 3; + + // The GCP zone the Uptime check should egress from. Only respected for + // internal Uptime checks, where internal_network is specified. + string gcp_zone = 4; + + // The GCP project ID where the internal checker lives. Not necessary + // the same as the Workspace project. + string peer_project_id = 6; + + // The current operational state of the internal checker. + State state = 7; +} + +// This message configures which resources and services to monitor for +// availability. +message UptimeCheckConfig { + option (google.api.resource) = { + type: "monitoring.googleapis.com/UptimeCheckConfig" + pattern: "projects/{project}/uptimeCheckConfigs/{uptime_check_config}" + pattern: "organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}" + pattern: "folders/{folder}/uptimeCheckConfigs/{uptime_check_config}" + pattern: "*" + }; + + // The resource submessage for group checks. It can be used instead of a + // monitored resource, when multiple resources are being monitored. + message ResourceGroup { + // The group of resources being monitored. Should be only the `[GROUP_ID]`, + // and not the full-path + // `projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]`. + string group_id = 1; + + // The resource type of the group members. + GroupResourceType resource_type = 2; + } + + // Information involved in an HTTP/HTTPS Uptime check request. + message HttpCheck { + // The authentication parameters to provide to the specified resource or + // URL that requires a username and password. Currently, only + // [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is + // supported in Uptime checks. + message BasicAuthentication { + // The username to use when authenticating with the HTTP server. + string username = 1; + + // The password to use when authenticating with the HTTP server. + string password = 2; + } + + // The HTTP request method options. + enum RequestMethod { + // No request method specified. + METHOD_UNSPECIFIED = 0; + + // GET request. + GET = 1; + + // POST request. + POST = 2; + } + + // Header options corresponding to the content type of a HTTP request body. + enum ContentType { + // No content type specified. + TYPE_UNSPECIFIED = 0; + + // `body` is in URL-encoded form. Equivalent to setting the `Content-Type` + // to `application/x-www-form-urlencoded` in the HTTP request. + URL_ENCODED = 1; + } + + // The HTTP request method to use for the check. If set to + // `METHOD_UNSPECIFIED` then `request_method` defaults to `GET`. + RequestMethod request_method = 8; + + // If `true`, use HTTPS instead of HTTP to run the check. + bool use_ssl = 1; + + // Optional (defaults to "/"). The path to the page against which to run + // the check. Will be combined with the `host` (specified within the + // `monitored_resource`) and `port` to construct the full URL. If the + // provided path does not begin with "/", a "/" will be prepended + // automatically. + string path = 2; + + // Optional (defaults to 80 when `use_ssl` is `false`, and 443 when + // `use_ssl` is `true`). The TCP port on the HTTP server against which to + // run the check. Will be combined with host (specified within the + // `monitored_resource`) and `path` to construct the full URL. + int32 port = 3; + + // The authentication information. Optional when creating an HTTP check; + // defaults to empty. + BasicAuthentication auth_info = 4; + + // Boolean specifying whether to encrypt the header information. + // Encryption should be specified for any headers related to authentication + // that you do not wish to be seen when retrieving the configuration. The + // server will be responsible for encrypting the headers. + // On Get/List calls, if `mask_headers` is set to `true` then the headers + // will be obscured with `******.` + bool mask_headers = 5; + + // The list of headers to send as part of the Uptime check request. + // If two headers have the same key and different values, they should + // be entered as a single header, with the value being a comma-separated + // list of all the desired values as described at + // https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). + // Entering two separate headers with the same key in a Create call will + // cause the first to be overwritten by the second. + // The maximum number of headers allowed is 100. + map headers = 6; + + // The content type header to use for the check. The following + // configurations result in errors: + // 1. Content type is specified in both the `headers` field and the + // `content_type` field. + // 2. Request method is `GET` and `content_type` is not `TYPE_UNSPECIFIED` + // 3. Request method is `POST` and `content_type` is `TYPE_UNSPECIFIED`. + // 4. Request method is `POST` and a "Content-Type" header is provided via + // `headers` field. The `content_type` field should be used instead. + ContentType content_type = 9; + + // Boolean specifying whether to include SSL certificate validation as a + // part of the Uptime check. Only applies to checks where + // `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`, + // setting `validate_ssl` to `true` has no effect. + bool validate_ssl = 7; + + // The request body associated with the HTTP POST request. If `content_type` + // is `URL_ENCODED`, the body passed in must be URL-encoded. Users can + // provide a `Content-Length` header via the `headers` field or the API will + // do so. If the `request_method` is `GET` and `body` is not empty, the API + // will return an error. The maximum byte size is 1 megabyte. Note: As with + // all `bytes` fields, JSON representations are base64 encoded. e.g.: + // "foo=bar" in URL-encoded form is "foo%3Dbar" and in base64 encoding is + // "Zm9vJTI1M0RiYXI=". + bytes body = 10; + } + + // Information required for a TCP Uptime check request. + message TcpCheck { + // The TCP port on the server against which to run the check. Will be + // combined with host (specified within the `monitored_resource`) to + // construct the full URL. Required. + int32 port = 1; + } + + // Optional. Used to perform content matching. This allows matching based on + // substrings and regular expressions, together with their negations. Only the + // first 4 MB of an HTTP or HTTPS check's response (and the first + // 1 MB of a TCP check's response) are examined for purposes of content + // matching. + message ContentMatcher { + // Options to perform content matching. + enum ContentMatcherOption { + // No content matcher type specified (maintained for backward + // compatibility, but deprecated for future use). + // Treated as `CONTAINS_STRING`. + CONTENT_MATCHER_OPTION_UNSPECIFIED = 0; + + // Selects substring matching. The match succeeds if the output contains + // the `content` string. This is the default value for checks without + // a `matcher` option, or where the value of `matcher` is + // `CONTENT_MATCHER_OPTION_UNSPECIFIED`. + CONTAINS_STRING = 1; + + // Selects negation of substring matching. The match succeeds if the + // output does _NOT_ contain the `content` string. + NOT_CONTAINS_STRING = 2; + + // Selects regular-expression matching. The match succeeds of the output + // matches the regular expression specified in the `content` string. + MATCHES_REGEX = 3; + + // Selects negation of regular-expression matching. The match succeeds if + // the output does _NOT_ match the regular expression specified in the + // `content` string. + NOT_MATCHES_REGEX = 4; + } + + // String or regex content to match. Maximum 1024 bytes. An empty `content` + // string indicates no content matching is to be performed. + string content = 1; + + // The type of content matcher that will be applied to the server output, + // compared to the `content` string when the check is run. + ContentMatcherOption matcher = 2; + } + + // A unique resource name for this Uptime check configuration. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + // + // `[PROJECT_ID_OR_NUMBER]` is the Workspace host project associated with the + // Uptime check. + // + // This field should be omitted when creating the Uptime check configuration; + // on create, the resource name is assigned by the server and included in the + // response. + string name = 1; + + // A human-friendly name for the Uptime check configuration. The display name + // should be unique within a Stackdriver Workspace in order to make it easier + // to identify; however, uniqueness is not enforced. Required. + string display_name = 2; + + // The resource the check is checking. Required. + oneof resource { + // The [monitored + // resource](https://cloud.google.com/monitoring/api/resources) associated + // with the configuration. + // The following monitored resource types are supported for Uptime checks: + // `uptime_url`, + // `gce_instance`, + // `gae_app`, + // `aws_ec2_instance`, + // `aws_elb_load_balancer` + google.api.MonitoredResource monitored_resource = 3; + + // The group resource associated with the configuration. + ResourceGroup resource_group = 4; + } + + // The type of Uptime check request. + oneof check_request_type { + // Contains information needed to make an HTTP or HTTPS check. + HttpCheck http_check = 5; + + // Contains information needed to make a TCP check. + TcpCheck tcp_check = 6; + } + + // How often, in seconds, the Uptime check is performed. + // Currently, the only supported values are `60s` (1 minute), `300s` + // (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional, + // defaults to `60s`. + google.protobuf.Duration period = 7; + + // The maximum amount of time to wait for the request to complete (must be + // between 1 and 60 seconds). Required. + google.protobuf.Duration timeout = 8; + + // The content that is expected to appear in the data returned by the target + // server against which the check is run. Currently, only the first entry + // in the `content_matchers` list is supported, and additional entries will + // be ignored. This field is optional and should only be specified if a + // content match is required as part of the/ Uptime check. + repeated ContentMatcher content_matchers = 9; + + // The list of regions from which the check will be run. + // Some regions contain one location, and others contain more than one. + // If this field is specified, enough regions must be provided to include a + // minimum of 3 locations. Not specifying this field will result in Uptime + // checks running from all available regions. + repeated UptimeCheckRegion selected_regions = 10; + + // If this is `true`, then checks are made only from the 'internal_checkers'. + // If it is `false`, then checks are made only from the 'selected_regions'. + // It is an error to provide 'selected_regions' when is_internal is `true`, + // or to provide 'internal_checkers' when is_internal is `false`. + bool is_internal = 15 [deprecated = true]; + + // The internal checkers that this check will egress from. If `is_internal` is + // `true` and this list is empty, the check will egress from all the + // InternalCheckers configured for the project that owns this + // `UptimeCheckConfig`. + repeated InternalChecker internal_checkers = 14 [deprecated = true]; +} + +// Contains the region, location, and list of IP +// addresses where checkers in the location run from. +message UptimeCheckIp { + // A broad region category in which the IP address is located. + UptimeCheckRegion region = 1; + + // A more specific location within the region that typically encodes + // a particular city/town/metro (and its containing state/province or country) + // within the broader umbrella region category. + string location = 2; + + // The IP address from which the Uptime check originates. This is a fully + // specified IP address (not an IP address range). Most IP addresses, as of + // this publication, are in IPv4 format; however, one should not rely on the + // IP addresses being in IPv4 format indefinitely, and should support + // interpreting this field in either IPv4 or IPv6 format. + string ip_address = 3; +} + +// The supported resource types that can be used as values of +// `group_resource.resource_type`. +// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types. +// The resource types `gae_app` and `uptime_url` are not valid here because +// group checks on App Engine modules and URLs are not allowed. +enum GroupResourceType { + // Default value (not valid). + RESOURCE_TYPE_UNSPECIFIED = 0; + + // A group of instances from Google Cloud Platform (GCP) or + // Amazon Web Services (AWS). + INSTANCE = 1; + + // A group of Amazon ELB load balancers. + AWS_ELB_LOAD_BALANCER = 2; +} diff --git a/packages/google-cloud-monitoring/protos/google/monitoring/v3/uptime_service.proto b/packages/google-cloud-monitoring/protos/google/monitoring/v3/uptime_service.proto new file mode 100644 index 00000000000..78ad6697c1a --- /dev/null +++ b/packages/google-cloud-monitoring/protos/google/monitoring/v3/uptime_service.proto @@ -0,0 +1,241 @@ +// 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. + +syntax = "proto3"; + +package google.monitoring.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/monitoring/v3/uptime.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Monitoring.V3"; +option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; +option java_multiple_files = true; +option java_outer_classname = "UptimeServiceProto"; +option java_package = "com.google.monitoring.v3"; +option php_namespace = "Google\\Cloud\\Monitoring\\V3"; +option ruby_package = "Google::Cloud::Monitoring::V3"; + +// The UptimeCheckService API is used to manage (list, create, delete, edit) +// Uptime check configurations in the Stackdriver Monitoring product. An Uptime +// check is a piece of configuration that determines which resources and +// services to monitor for availability. These configurations can also be +// configured interactively by navigating to the [Cloud Console] +// (http://console.cloud.google.com), selecting the appropriate project, +// clicking on "Monitoring" on the left-hand side to navigate to Stackdriver, +// and then clicking on "Uptime". +service UptimeCheckService { + option (google.api.default_host) = "monitoring.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/monitoring," + "https://www.googleapis.com/auth/monitoring.read"; + + // Lists the existing valid Uptime check configurations for the project + // (leaving out any invalid configurations). + rpc ListUptimeCheckConfigs(ListUptimeCheckConfigsRequest) returns (ListUptimeCheckConfigsResponse) { + option (google.api.http) = { + get: "/v3/{parent=projects/*}/uptimeCheckConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a single Uptime check configuration. + rpc GetUptimeCheckConfig(GetUptimeCheckConfigRequest) returns (UptimeCheckConfig) { + option (google.api.http) = { + get: "/v3/{name=projects/*/uptimeCheckConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Uptime check configuration. + rpc CreateUptimeCheckConfig(CreateUptimeCheckConfigRequest) returns (UptimeCheckConfig) { + option (google.api.http) = { + post: "/v3/{parent=projects/*}/uptimeCheckConfigs" + body: "uptime_check_config" + }; + option (google.api.method_signature) = "parent,uptime_check_config"; + } + + // Updates an Uptime check configuration. You can either replace the entire + // configuration with a new one or replace only certain fields in the current + // configuration by specifying the fields to be updated via `updateMask`. + // Returns the updated configuration. + rpc UpdateUptimeCheckConfig(UpdateUptimeCheckConfigRequest) returns (UptimeCheckConfig) { + option (google.api.http) = { + patch: "/v3/{uptime_check_config.name=projects/*/uptimeCheckConfigs/*}" + body: "uptime_check_config" + }; + option (google.api.method_signature) = "uptime_check_config"; + } + + // Deletes an Uptime check configuration. Note that this method will fail + // if the Uptime check configuration is referenced by an alert policy or + // other dependent configs that would be rendered invalid by the deletion. + rpc DeleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v3/{name=projects/*/uptimeCheckConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns the list of IP addresses that checkers run from + rpc ListUptimeCheckIps(ListUptimeCheckIpsRequest) returns (ListUptimeCheckIpsResponse) { + option (google.api.http) = { + get: "/v3/uptimeCheckIps" + }; + } +} + +// The protocol for the `ListUptimeCheckConfigs` request. +message ListUptimeCheckConfigsRequest { + // Required. The project whose Uptime check configurations are listed. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/UptimeCheckConfig" + } + ]; + + // The maximum number of results to return in a single response. The server + // may further constrain the maximum number of results returned in a single + // page. If the page_size is <=0, the server will decide the number of results + // to be returned. + int32 page_size = 3; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return more results from the previous method call. + string page_token = 4; +} + +// The protocol for the `ListUptimeCheckConfigs` response. +message ListUptimeCheckConfigsResponse { + // The returned Uptime check configurations. + repeated UptimeCheckConfig uptime_check_configs = 1; + + // This field represents the pagination token to retrieve the next page of + // results. If the value is empty, it means no further results for the + // request. To retrieve the next page of results, the value of the + // next_page_token is passed to the subsequent List method call (in the + // request message's page_token field). + string next_page_token = 2; + + // The total number of Uptime check configurations for the project, + // irrespective of any pagination. + int32 total_size = 3; +} + +// The protocol for the `GetUptimeCheckConfig` request. +message GetUptimeCheckConfigRequest { + // Required. The Uptime check configuration to retrieve. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/UptimeCheckConfig" + } + ]; +} + +// The protocol for the `CreateUptimeCheckConfig` request. +message CreateUptimeCheckConfigRequest { + // Required. The project in which to create the Uptime check. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER] + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "monitoring.googleapis.com/UptimeCheckConfig" + } + ]; + + // Required. The new Uptime check configuration. + UptimeCheckConfig uptime_check_config = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The protocol for the `UpdateUptimeCheckConfig` request. +message UpdateUptimeCheckConfigRequest { + // Optional. If present, only the listed fields in the current Uptime check + // configuration are updated with values from the new configuration. If this + // field is empty, then the current configuration is completely replaced with + // the new configuration. + google.protobuf.FieldMask update_mask = 2; + + // Required. If an `updateMask` has been specified, this field gives + // the values for the set of fields mentioned in the `updateMask`. If an + // `updateMask` has not been given, this Uptime check configuration replaces + // the current configuration. If a field is mentioned in `updateMask` but + // the corresonding field is omitted in this partial Uptime check + // configuration, it has the effect of deleting/clearing the field from the + // configuration on the server. + // + // The following fields can be updated: `display_name`, + // `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + // `selected_regions`. + UptimeCheckConfig uptime_check_config = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The protocol for the `DeleteUptimeCheckConfig` request. +message DeleteUptimeCheckConfigRequest { + // Required. The Uptime check configuration to delete. The format is: + // + // projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "monitoring.googleapis.com/UptimeCheckConfig" + } + ]; +} + +// The protocol for the `ListUptimeCheckIps` request. +message ListUptimeCheckIpsRequest { + // The maximum number of results to return in a single response. The server + // may further constrain the maximum number of results returned in a single + // page. If the page_size is <=0, the server will decide the number of results + // to be returned. + // NOTE: this field is not yet implemented + int32 page_size = 2; + + // If this field is not empty then it must contain the `nextPageToken` value + // returned by a previous call to this method. Using this field causes the + // method to return more results from the previous method call. + // NOTE: this field is not yet implemented + string page_token = 3; +} + +// The protocol for the `ListUptimeCheckIps` response. +message ListUptimeCheckIpsResponse { + // The returned list of IP addresses (including region and location) that the + // checkers run from. + repeated UptimeCheckIp uptime_check_ips = 1; + + // This field represents the pagination token to retrieve the next page of + // results. If the value is empty, it means no further results for the + // request. To retrieve the next page of results, the value of the + // next_page_token is passed to the subsequent List method call (in the + // request message's page_token field). + // NOTE: this field is not yet implemented + string next_page_token = 2; +} diff --git a/packages/google-cloud-monitoring/protos/protos.d.ts b/packages/google-cloud-monitoring/protos/protos.d.ts new file mode 100644 index 00000000000..abdc8d2eee8 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/protos.d.ts @@ -0,0 +1,21696 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); +/** Namespace google. */ +export namespace google { + + /** Namespace monitoring. */ + namespace monitoring { + + /** Namespace v3. */ + namespace v3 { + + /** Properties of an AlertPolicy. */ + interface IAlertPolicy { + + /** AlertPolicy name */ + name?: (string|null); + + /** AlertPolicy displayName */ + displayName?: (string|null); + + /** AlertPolicy documentation */ + documentation?: (google.monitoring.v3.AlertPolicy.IDocumentation|null); + + /** AlertPolicy userLabels */ + userLabels?: ({ [k: string]: string }|null); + + /** AlertPolicy conditions */ + conditions?: (google.monitoring.v3.AlertPolicy.ICondition[]|null); + + /** AlertPolicy combiner */ + combiner?: (google.monitoring.v3.AlertPolicy.ConditionCombinerType|keyof typeof google.monitoring.v3.AlertPolicy.ConditionCombinerType|null); + + /** AlertPolicy enabled */ + enabled?: (google.protobuf.IBoolValue|null); + + /** AlertPolicy validity */ + validity?: (google.rpc.IStatus|null); + + /** AlertPolicy notificationChannels */ + notificationChannels?: (string[]|null); + + /** AlertPolicy creationRecord */ + creationRecord?: (google.monitoring.v3.IMutationRecord|null); + + /** AlertPolicy mutationRecord */ + mutationRecord?: (google.monitoring.v3.IMutationRecord|null); + } + + /** Represents an AlertPolicy. */ + class AlertPolicy implements IAlertPolicy { + + /** + * Constructs a new AlertPolicy. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IAlertPolicy); + + /** AlertPolicy name. */ + public name: string; + + /** AlertPolicy displayName. */ + public displayName: string; + + /** AlertPolicy documentation. */ + public documentation?: (google.monitoring.v3.AlertPolicy.IDocumentation|null); + + /** AlertPolicy userLabels. */ + public userLabels: { [k: string]: string }; + + /** AlertPolicy conditions. */ + public conditions: google.monitoring.v3.AlertPolicy.ICondition[]; + + /** AlertPolicy combiner. */ + public combiner: (google.monitoring.v3.AlertPolicy.ConditionCombinerType|keyof typeof google.monitoring.v3.AlertPolicy.ConditionCombinerType); + + /** AlertPolicy enabled. */ + public enabled?: (google.protobuf.IBoolValue|null); + + /** AlertPolicy validity. */ + public validity?: (google.rpc.IStatus|null); + + /** AlertPolicy notificationChannels. */ + public notificationChannels: string[]; + + /** AlertPolicy creationRecord. */ + public creationRecord?: (google.monitoring.v3.IMutationRecord|null); + + /** AlertPolicy mutationRecord. */ + public mutationRecord?: (google.monitoring.v3.IMutationRecord|null); + + /** + * Creates a new AlertPolicy instance using the specified properties. + * @param [properties] Properties to set + * @returns AlertPolicy instance + */ + public static create(properties?: google.monitoring.v3.IAlertPolicy): google.monitoring.v3.AlertPolicy; + + /** + * Encodes the specified AlertPolicy message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.verify|verify} messages. + * @param message AlertPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IAlertPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AlertPolicy message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.verify|verify} messages. + * @param message AlertPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IAlertPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AlertPolicy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AlertPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.AlertPolicy; + + /** + * Decodes an AlertPolicy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AlertPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.AlertPolicy; + + /** + * Verifies an AlertPolicy message. + * @param message Plain 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 AlertPolicy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AlertPolicy + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.AlertPolicy; + + /** + * Creates a plain object from an AlertPolicy message. Also converts values to other types if specified. + * @param message AlertPolicy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.AlertPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AlertPolicy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AlertPolicy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AlertPolicy { + + /** Properties of a Documentation. */ + interface IDocumentation { + + /** Documentation content */ + content?: (string|null); + + /** Documentation mimeType */ + mimeType?: (string|null); + } + + /** Represents a Documentation. */ + class Documentation implements IDocumentation { + + /** + * Constructs a new Documentation. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.AlertPolicy.IDocumentation); + + /** Documentation content. */ + public content: string; + + /** Documentation mimeType. */ + public mimeType: string; + + /** + * Creates a new Documentation instance using the specified properties. + * @param [properties] Properties to set + * @returns Documentation instance + */ + public static create(properties?: google.monitoring.v3.AlertPolicy.IDocumentation): google.monitoring.v3.AlertPolicy.Documentation; + + /** + * Encodes the specified Documentation message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Documentation.verify|verify} messages. + * @param message Documentation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.AlertPolicy.IDocumentation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Documentation message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Documentation.verify|verify} messages. + * @param message Documentation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.AlertPolicy.IDocumentation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Documentation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Documentation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.AlertPolicy.Documentation; + + /** + * Decodes a Documentation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Documentation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.AlertPolicy.Documentation; + + /** + * Verifies a Documentation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Documentation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Documentation + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.AlertPolicy.Documentation; + + /** + * Creates a plain object from a Documentation message. Also converts values to other types if specified. + * @param message Documentation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.AlertPolicy.Documentation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Documentation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Documentation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Condition. */ + interface ICondition { + + /** Condition name */ + name?: (string|null); + + /** Condition displayName */ + displayName?: (string|null); + + /** Condition conditionThreshold */ + conditionThreshold?: (google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold|null); + + /** Condition conditionAbsent */ + conditionAbsent?: (google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence|null); + + /** Condition conditionMonitoringQueryLanguage */ + conditionMonitoringQueryLanguage?: (google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition|null); + } + + /** Represents a Condition. */ + class Condition implements ICondition { + + /** + * Constructs a new Condition. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.AlertPolicy.ICondition); + + /** Condition name. */ + public name: string; + + /** Condition displayName. */ + public displayName: string; + + /** Condition conditionThreshold. */ + public conditionThreshold?: (google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold|null); + + /** Condition conditionAbsent. */ + public conditionAbsent?: (google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence|null); + + /** Condition conditionMonitoringQueryLanguage. */ + public conditionMonitoringQueryLanguage?: (google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition|null); + + /** Condition condition. */ + public condition?: ("conditionThreshold"|"conditionAbsent"|"conditionMonitoringQueryLanguage"); + + /** + * Creates a new Condition instance using the specified properties. + * @param [properties] Properties to set + * @returns Condition instance + */ + public static create(properties?: google.monitoring.v3.AlertPolicy.ICondition): google.monitoring.v3.AlertPolicy.Condition; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.AlertPolicy.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.verify|verify} messages. + * @param message Condition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.AlertPolicy.ICondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.AlertPolicy.Condition; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.AlertPolicy.Condition; + + /** + * Verifies a Condition message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Condition + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.AlertPolicy.Condition; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @param message Condition + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.AlertPolicy.Condition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Condition to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Condition + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Condition { + + /** Properties of a Trigger. */ + interface ITrigger { + + /** Trigger count */ + count?: (number|null); + + /** Trigger percent */ + percent?: (number|null); + } + + /** Represents a Trigger. */ + class Trigger implements ITrigger { + + /** + * Constructs a new Trigger. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.AlertPolicy.Condition.ITrigger); + + /** Trigger count. */ + public count?: (number|null); + + /** Trigger percent. */ + public percent?: (number|null); + + /** Trigger type. */ + public type?: ("count"|"percent"); + + /** + * Creates a new Trigger instance using the specified properties. + * @param [properties] Properties to set + * @returns Trigger instance + */ + public static create(properties?: google.monitoring.v3.AlertPolicy.Condition.ITrigger): google.monitoring.v3.AlertPolicy.Condition.Trigger; + + /** + * Encodes the specified Trigger message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.Trigger.verify|verify} messages. + * @param message Trigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.AlertPolicy.Condition.ITrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Trigger message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.Trigger.verify|verify} messages. + * @param message Trigger message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.AlertPolicy.Condition.ITrigger, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Trigger message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Trigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.AlertPolicy.Condition.Trigger; + + /** + * Decodes a Trigger message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Trigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.AlertPolicy.Condition.Trigger; + + /** + * Verifies a Trigger message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Trigger message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Trigger + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.AlertPolicy.Condition.Trigger; + + /** + * Creates a plain object from a Trigger message. Also converts values to other types if specified. + * @param message Trigger + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.AlertPolicy.Condition.Trigger, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Trigger to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Trigger + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MetricThreshold. */ + interface IMetricThreshold { + + /** MetricThreshold filter */ + filter?: (string|null); + + /** MetricThreshold aggregations */ + aggregations?: (google.monitoring.v3.IAggregation[]|null); + + /** MetricThreshold denominatorFilter */ + denominatorFilter?: (string|null); + + /** MetricThreshold denominatorAggregations */ + denominatorAggregations?: (google.monitoring.v3.IAggregation[]|null); + + /** MetricThreshold comparison */ + comparison?: (google.monitoring.v3.ComparisonType|keyof typeof google.monitoring.v3.ComparisonType|null); + + /** MetricThreshold thresholdValue */ + thresholdValue?: (number|null); + + /** MetricThreshold duration */ + duration?: (google.protobuf.IDuration|null); + + /** MetricThreshold trigger */ + trigger?: (google.monitoring.v3.AlertPolicy.Condition.ITrigger|null); + } + + /** Represents a MetricThreshold. */ + class MetricThreshold implements IMetricThreshold { + + /** + * Constructs a new MetricThreshold. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold); + + /** MetricThreshold filter. */ + public filter: string; + + /** MetricThreshold aggregations. */ + public aggregations: google.monitoring.v3.IAggregation[]; + + /** MetricThreshold denominatorFilter. */ + public denominatorFilter: string; + + /** MetricThreshold denominatorAggregations. */ + public denominatorAggregations: google.monitoring.v3.IAggregation[]; + + /** MetricThreshold comparison. */ + public comparison: (google.monitoring.v3.ComparisonType|keyof typeof google.monitoring.v3.ComparisonType); + + /** MetricThreshold thresholdValue. */ + public thresholdValue: number; + + /** MetricThreshold duration. */ + public duration?: (google.protobuf.IDuration|null); + + /** MetricThreshold trigger. */ + public trigger?: (google.monitoring.v3.AlertPolicy.Condition.ITrigger|null); + + /** + * Creates a new MetricThreshold instance using the specified properties. + * @param [properties] Properties to set + * @returns MetricThreshold instance + */ + public static create(properties?: google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold): google.monitoring.v3.AlertPolicy.Condition.MetricThreshold; + + /** + * Encodes the specified MetricThreshold message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.verify|verify} messages. + * @param message MetricThreshold message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MetricThreshold message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.verify|verify} messages. + * @param message MetricThreshold message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MetricThreshold message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MetricThreshold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.AlertPolicy.Condition.MetricThreshold; + + /** + * Decodes a MetricThreshold message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MetricThreshold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.AlertPolicy.Condition.MetricThreshold; + + /** + * Verifies a MetricThreshold message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MetricThreshold message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MetricThreshold + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.AlertPolicy.Condition.MetricThreshold; + + /** + * Creates a plain object from a MetricThreshold message. Also converts values to other types if specified. + * @param message MetricThreshold + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.AlertPolicy.Condition.MetricThreshold, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MetricThreshold to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MetricThreshold + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MetricAbsence. */ + interface IMetricAbsence { + + /** MetricAbsence filter */ + filter?: (string|null); + + /** MetricAbsence aggregations */ + aggregations?: (google.monitoring.v3.IAggregation[]|null); + + /** MetricAbsence duration */ + duration?: (google.protobuf.IDuration|null); + + /** MetricAbsence trigger */ + trigger?: (google.monitoring.v3.AlertPolicy.Condition.ITrigger|null); + } + + /** Represents a MetricAbsence. */ + class MetricAbsence implements IMetricAbsence { + + /** + * Constructs a new MetricAbsence. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence); + + /** MetricAbsence filter. */ + public filter: string; + + /** MetricAbsence aggregations. */ + public aggregations: google.monitoring.v3.IAggregation[]; + + /** MetricAbsence duration. */ + public duration?: (google.protobuf.IDuration|null); + + /** MetricAbsence trigger. */ + public trigger?: (google.monitoring.v3.AlertPolicy.Condition.ITrigger|null); + + /** + * Creates a new MetricAbsence instance using the specified properties. + * @param [properties] Properties to set + * @returns MetricAbsence instance + */ + public static create(properties?: google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence): google.monitoring.v3.AlertPolicy.Condition.MetricAbsence; + + /** + * Encodes the specified MetricAbsence message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.verify|verify} messages. + * @param message MetricAbsence message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MetricAbsence message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.verify|verify} messages. + * @param message MetricAbsence message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MetricAbsence message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MetricAbsence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.AlertPolicy.Condition.MetricAbsence; + + /** + * Decodes a MetricAbsence message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MetricAbsence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.AlertPolicy.Condition.MetricAbsence; + + /** + * Verifies a MetricAbsence message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MetricAbsence message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MetricAbsence + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.AlertPolicy.Condition.MetricAbsence; + + /** + * Creates a plain object from a MetricAbsence message. Also converts values to other types if specified. + * @param message MetricAbsence + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.AlertPolicy.Condition.MetricAbsence, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MetricAbsence to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MetricAbsence + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MonitoringQueryLanguageCondition. */ + interface IMonitoringQueryLanguageCondition { + + /** MonitoringQueryLanguageCondition query */ + query?: (string|null); + + /** MonitoringQueryLanguageCondition duration */ + duration?: (google.protobuf.IDuration|null); + + /** MonitoringQueryLanguageCondition trigger */ + trigger?: (google.monitoring.v3.AlertPolicy.Condition.ITrigger|null); + } + + /** Represents a MonitoringQueryLanguageCondition. */ + class MonitoringQueryLanguageCondition implements IMonitoringQueryLanguageCondition { + + /** + * Constructs a new MonitoringQueryLanguageCondition. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition); + + /** MonitoringQueryLanguageCondition query. */ + public query: string; + + /** MonitoringQueryLanguageCondition duration. */ + public duration?: (google.protobuf.IDuration|null); + + /** MonitoringQueryLanguageCondition trigger. */ + public trigger?: (google.monitoring.v3.AlertPolicy.Condition.ITrigger|null); + + /** + * Creates a new MonitoringQueryLanguageCondition instance using the specified properties. + * @param [properties] Properties to set + * @returns MonitoringQueryLanguageCondition instance + */ + public static create(properties?: google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition): google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition; + + /** + * Encodes the specified MonitoringQueryLanguageCondition message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.verify|verify} messages. + * @param message MonitoringQueryLanguageCondition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MonitoringQueryLanguageCondition message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.verify|verify} messages. + * @param message MonitoringQueryLanguageCondition message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MonitoringQueryLanguageCondition message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MonitoringQueryLanguageCondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition; + + /** + * Decodes a MonitoringQueryLanguageCondition message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MonitoringQueryLanguageCondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition; + + /** + * Verifies a MonitoringQueryLanguageCondition message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MonitoringQueryLanguageCondition message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MonitoringQueryLanguageCondition + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition; + + /** + * Creates a plain object from a MonitoringQueryLanguageCondition message. Also converts values to other types if specified. + * @param message MonitoringQueryLanguageCondition + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MonitoringQueryLanguageCondition to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MonitoringQueryLanguageCondition + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** ConditionCombinerType enum. */ + enum ConditionCombinerType { + COMBINE_UNSPECIFIED = 0, + AND = 1, + OR = 2, + AND_WITH_MATCHING_RESOURCE = 3 + } + } + + /** Properties of a TypedValue. */ + interface ITypedValue { + + /** TypedValue boolValue */ + boolValue?: (boolean|null); + + /** TypedValue int64Value */ + int64Value?: (number|Long|string|null); + + /** TypedValue doubleValue */ + doubleValue?: (number|null); + + /** TypedValue stringValue */ + stringValue?: (string|null); + + /** TypedValue distributionValue */ + distributionValue?: (google.api.IDistribution|null); + } + + /** Represents a TypedValue. */ + class TypedValue implements ITypedValue { + + /** + * Constructs a new TypedValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ITypedValue); + + /** TypedValue boolValue. */ + public boolValue?: (boolean|null); + + /** TypedValue int64Value. */ + public int64Value?: (number|Long|string|null); + + /** TypedValue doubleValue. */ + public doubleValue?: (number|null); + + /** TypedValue stringValue. */ + public stringValue?: (string|null); + + /** TypedValue distributionValue. */ + public distributionValue?: (google.api.IDistribution|null); + + /** TypedValue value. */ + public value?: ("boolValue"|"int64Value"|"doubleValue"|"stringValue"|"distributionValue"); + + /** + * Creates a new TypedValue instance using the specified properties. + * @param [properties] Properties to set + * @returns TypedValue instance + */ + public static create(properties?: google.monitoring.v3.ITypedValue): google.monitoring.v3.TypedValue; + + /** + * Encodes the specified TypedValue message. Does not implicitly {@link google.monitoring.v3.TypedValue.verify|verify} messages. + * @param message TypedValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ITypedValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TypedValue message, length delimited. Does not implicitly {@link google.monitoring.v3.TypedValue.verify|verify} messages. + * @param message TypedValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ITypedValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TypedValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TypedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TypedValue; + + /** + * Decodes a TypedValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TypedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TypedValue; + + /** + * Verifies a TypedValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TypedValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TypedValue + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TypedValue; + + /** + * Creates a plain object from a TypedValue message. Also converts values to other types if specified. + * @param message TypedValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TypedValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TypedValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TypedValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TimeInterval. */ + interface ITimeInterval { + + /** TimeInterval endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** TimeInterval startTime */ + startTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a TimeInterval. */ + class TimeInterval implements ITimeInterval { + + /** + * Constructs a new TimeInterval. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ITimeInterval); + + /** TimeInterval endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** TimeInterval startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new TimeInterval instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeInterval instance + */ + public static create(properties?: google.monitoring.v3.ITimeInterval): google.monitoring.v3.TimeInterval; + + /** + * Encodes the specified TimeInterval message. Does not implicitly {@link google.monitoring.v3.TimeInterval.verify|verify} messages. + * @param message TimeInterval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ITimeInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeInterval message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeInterval.verify|verify} messages. + * @param message TimeInterval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ITimeInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeInterval message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeInterval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TimeInterval; + + /** + * Decodes a TimeInterval message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeInterval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TimeInterval; + + /** + * Verifies a TimeInterval message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeInterval message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeInterval + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TimeInterval; + + /** + * Creates a plain object from a TimeInterval message. Also converts values to other types if specified. + * @param message TimeInterval + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TimeInterval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeInterval to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TimeInterval + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Aggregation. */ + interface IAggregation { + + /** Aggregation alignmentPeriod */ + alignmentPeriod?: (google.protobuf.IDuration|null); + + /** Aggregation perSeriesAligner */ + perSeriesAligner?: (google.monitoring.v3.Aggregation.Aligner|keyof typeof google.monitoring.v3.Aggregation.Aligner|null); + + /** Aggregation crossSeriesReducer */ + crossSeriesReducer?: (google.monitoring.v3.Aggregation.Reducer|keyof typeof google.monitoring.v3.Aggregation.Reducer|null); + + /** Aggregation groupByFields */ + groupByFields?: (string[]|null); + } + + /** Represents an Aggregation. */ + class Aggregation implements IAggregation { + + /** + * Constructs a new Aggregation. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IAggregation); + + /** Aggregation alignmentPeriod. */ + public alignmentPeriod?: (google.protobuf.IDuration|null); + + /** Aggregation perSeriesAligner. */ + public perSeriesAligner: (google.monitoring.v3.Aggregation.Aligner|keyof typeof google.monitoring.v3.Aggregation.Aligner); + + /** Aggregation crossSeriesReducer. */ + public crossSeriesReducer: (google.monitoring.v3.Aggregation.Reducer|keyof typeof google.monitoring.v3.Aggregation.Reducer); + + /** Aggregation groupByFields. */ + public groupByFields: string[]; + + /** + * Creates a new Aggregation instance using the specified properties. + * @param [properties] Properties to set + * @returns Aggregation instance + */ + public static create(properties?: google.monitoring.v3.IAggregation): google.monitoring.v3.Aggregation; + + /** + * Encodes the specified Aggregation message. Does not implicitly {@link google.monitoring.v3.Aggregation.verify|verify} messages. + * @param message Aggregation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IAggregation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Aggregation message, length delimited. Does not implicitly {@link google.monitoring.v3.Aggregation.verify|verify} messages. + * @param message Aggregation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IAggregation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Aggregation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Aggregation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Aggregation; + + /** + * Decodes an Aggregation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Aggregation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Aggregation; + + /** + * Verifies an Aggregation message. + * @param message Plain 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 Aggregation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Aggregation + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Aggregation; + + /** + * Creates a plain object from an Aggregation message. Also converts values to other types if specified. + * @param message Aggregation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Aggregation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Aggregation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Aggregation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Aggregation { + + /** Aligner enum. */ + enum Aligner { + ALIGN_NONE = 0, + ALIGN_DELTA = 1, + ALIGN_RATE = 2, + ALIGN_INTERPOLATE = 3, + ALIGN_NEXT_OLDER = 4, + ALIGN_MIN = 10, + ALIGN_MAX = 11, + ALIGN_MEAN = 12, + ALIGN_COUNT = 13, + ALIGN_SUM = 14, + ALIGN_STDDEV = 15, + ALIGN_COUNT_TRUE = 16, + ALIGN_COUNT_FALSE = 24, + ALIGN_FRACTION_TRUE = 17, + ALIGN_PERCENTILE_99 = 18, + ALIGN_PERCENTILE_95 = 19, + ALIGN_PERCENTILE_50 = 20, + ALIGN_PERCENTILE_05 = 21, + ALIGN_PERCENT_CHANGE = 23 + } + + /** Reducer enum. */ + enum Reducer { + REDUCE_NONE = 0, + REDUCE_MEAN = 1, + REDUCE_MIN = 2, + REDUCE_MAX = 3, + REDUCE_SUM = 4, + REDUCE_STDDEV = 5, + REDUCE_COUNT = 6, + REDUCE_COUNT_TRUE = 7, + REDUCE_COUNT_FALSE = 15, + REDUCE_FRACTION_TRUE = 8, + REDUCE_PERCENTILE_99 = 9, + REDUCE_PERCENTILE_95 = 10, + REDUCE_PERCENTILE_50 = 11, + REDUCE_PERCENTILE_05 = 12 + } + } + + /** ComparisonType enum. */ + enum ComparisonType { + COMPARISON_UNSPECIFIED = 0, + COMPARISON_GT = 1, + COMPARISON_GE = 2, + COMPARISON_LT = 3, + COMPARISON_LE = 4, + COMPARISON_EQ = 5, + COMPARISON_NE = 6 + } + + /** ServiceTier enum. */ + enum ServiceTier { + SERVICE_TIER_UNSPECIFIED = 0, + SERVICE_TIER_BASIC = 1, + SERVICE_TIER_PREMIUM = 2 + } + + /** Properties of a MutationRecord. */ + interface IMutationRecord { + + /** MutationRecord mutateTime */ + mutateTime?: (google.protobuf.ITimestamp|null); + + /** MutationRecord mutatedBy */ + mutatedBy?: (string|null); + } + + /** Represents a MutationRecord. */ + class MutationRecord implements IMutationRecord { + + /** + * Constructs a new MutationRecord. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IMutationRecord); + + /** MutationRecord mutateTime. */ + public mutateTime?: (google.protobuf.ITimestamp|null); + + /** MutationRecord mutatedBy. */ + public mutatedBy: string; + + /** + * Creates a new MutationRecord instance using the specified properties. + * @param [properties] Properties to set + * @returns MutationRecord instance + */ + public static create(properties?: google.monitoring.v3.IMutationRecord): google.monitoring.v3.MutationRecord; + + /** + * Encodes the specified MutationRecord message. Does not implicitly {@link google.monitoring.v3.MutationRecord.verify|verify} messages. + * @param message MutationRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IMutationRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MutationRecord message, length delimited. Does not implicitly {@link google.monitoring.v3.MutationRecord.verify|verify} messages. + * @param message MutationRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IMutationRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MutationRecord message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MutationRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.MutationRecord; + + /** + * Decodes a MutationRecord message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MutationRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.MutationRecord; + + /** + * Verifies a MutationRecord message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MutationRecord message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MutationRecord + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.MutationRecord; + + /** + * Creates a plain object from a MutationRecord message. Also converts values to other types if specified. + * @param message MutationRecord + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.MutationRecord, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MutationRecord to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MutationRecord + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents an AlertPolicyService */ + class AlertPolicyService extends $protobuf.rpc.Service { + + /** + * Constructs a new AlertPolicyService 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 AlertPolicyService 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): AlertPolicyService; + + /** + * Calls ListAlertPolicies. + * @param request ListAlertPoliciesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListAlertPoliciesResponse + */ + public listAlertPolicies(request: google.monitoring.v3.IListAlertPoliciesRequest, callback: google.monitoring.v3.AlertPolicyService.ListAlertPoliciesCallback): void; + + /** + * Calls ListAlertPolicies. + * @param request ListAlertPoliciesRequest message or plain object + * @returns Promise + */ + public listAlertPolicies(request: google.monitoring.v3.IListAlertPoliciesRequest): Promise; + + /** + * Calls GetAlertPolicy. + * @param request GetAlertPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AlertPolicy + */ + public getAlertPolicy(request: google.monitoring.v3.IGetAlertPolicyRequest, callback: google.monitoring.v3.AlertPolicyService.GetAlertPolicyCallback): void; + + /** + * Calls GetAlertPolicy. + * @param request GetAlertPolicyRequest message or plain object + * @returns Promise + */ + public getAlertPolicy(request: google.monitoring.v3.IGetAlertPolicyRequest): Promise; + + /** + * Calls CreateAlertPolicy. + * @param request CreateAlertPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AlertPolicy + */ + public createAlertPolicy(request: google.monitoring.v3.ICreateAlertPolicyRequest, callback: google.monitoring.v3.AlertPolicyService.CreateAlertPolicyCallback): void; + + /** + * Calls CreateAlertPolicy. + * @param request CreateAlertPolicyRequest message or plain object + * @returns Promise + */ + public createAlertPolicy(request: google.monitoring.v3.ICreateAlertPolicyRequest): Promise; + + /** + * Calls DeleteAlertPolicy. + * @param request DeleteAlertPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteAlertPolicy(request: google.monitoring.v3.IDeleteAlertPolicyRequest, callback: google.monitoring.v3.AlertPolicyService.DeleteAlertPolicyCallback): void; + + /** + * Calls DeleteAlertPolicy. + * @param request DeleteAlertPolicyRequest message or plain object + * @returns Promise + */ + public deleteAlertPolicy(request: google.monitoring.v3.IDeleteAlertPolicyRequest): Promise; + + /** + * Calls UpdateAlertPolicy. + * @param request UpdateAlertPolicyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AlertPolicy + */ + public updateAlertPolicy(request: google.monitoring.v3.IUpdateAlertPolicyRequest, callback: google.monitoring.v3.AlertPolicyService.UpdateAlertPolicyCallback): void; + + /** + * Calls UpdateAlertPolicy. + * @param request UpdateAlertPolicyRequest message or plain object + * @returns Promise + */ + public updateAlertPolicy(request: google.monitoring.v3.IUpdateAlertPolicyRequest): Promise; + } + + namespace AlertPolicyService { + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|listAlertPolicies}. + * @param error Error, if any + * @param [response] ListAlertPoliciesResponse + */ + type ListAlertPoliciesCallback = (error: (Error|null), response?: google.monitoring.v3.ListAlertPoliciesResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|getAlertPolicy}. + * @param error Error, if any + * @param [response] AlertPolicy + */ + type GetAlertPolicyCallback = (error: (Error|null), response?: google.monitoring.v3.AlertPolicy) => void; + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|createAlertPolicy}. + * @param error Error, if any + * @param [response] AlertPolicy + */ + type CreateAlertPolicyCallback = (error: (Error|null), response?: google.monitoring.v3.AlertPolicy) => void; + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|deleteAlertPolicy}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteAlertPolicyCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|updateAlertPolicy}. + * @param error Error, if any + * @param [response] AlertPolicy + */ + type UpdateAlertPolicyCallback = (error: (Error|null), response?: google.monitoring.v3.AlertPolicy) => void; + } + + /** Properties of a CreateAlertPolicyRequest. */ + interface ICreateAlertPolicyRequest { + + /** CreateAlertPolicyRequest name */ + name?: (string|null); + + /** CreateAlertPolicyRequest alertPolicy */ + alertPolicy?: (google.monitoring.v3.IAlertPolicy|null); + } + + /** Represents a CreateAlertPolicyRequest. */ + class CreateAlertPolicyRequest implements ICreateAlertPolicyRequest { + + /** + * Constructs a new CreateAlertPolicyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateAlertPolicyRequest); + + /** CreateAlertPolicyRequest name. */ + public name: string; + + /** CreateAlertPolicyRequest alertPolicy. */ + public alertPolicy?: (google.monitoring.v3.IAlertPolicy|null); + + /** + * Creates a new CreateAlertPolicyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateAlertPolicyRequest instance + */ + public static create(properties?: google.monitoring.v3.ICreateAlertPolicyRequest): google.monitoring.v3.CreateAlertPolicyRequest; + + /** + * Encodes the specified CreateAlertPolicyRequest message. Does not implicitly {@link google.monitoring.v3.CreateAlertPolicyRequest.verify|verify} messages. + * @param message CreateAlertPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateAlertPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateAlertPolicyRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateAlertPolicyRequest.verify|verify} messages. + * @param message CreateAlertPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateAlertPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateAlertPolicyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateAlertPolicyRequest; + + /** + * Decodes a CreateAlertPolicyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateAlertPolicyRequest; + + /** + * Verifies a CreateAlertPolicyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateAlertPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateAlertPolicyRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateAlertPolicyRequest; + + /** + * Creates a plain object from a CreateAlertPolicyRequest message. Also converts values to other types if specified. + * @param message CreateAlertPolicyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateAlertPolicyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateAlertPolicyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateAlertPolicyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetAlertPolicyRequest. */ + interface IGetAlertPolicyRequest { + + /** GetAlertPolicyRequest name */ + name?: (string|null); + } + + /** Represents a GetAlertPolicyRequest. */ + class GetAlertPolicyRequest implements IGetAlertPolicyRequest { + + /** + * Constructs a new GetAlertPolicyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetAlertPolicyRequest); + + /** GetAlertPolicyRequest name. */ + public name: string; + + /** + * Creates a new GetAlertPolicyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetAlertPolicyRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetAlertPolicyRequest): google.monitoring.v3.GetAlertPolicyRequest; + + /** + * Encodes the specified GetAlertPolicyRequest message. Does not implicitly {@link google.monitoring.v3.GetAlertPolicyRequest.verify|verify} messages. + * @param message GetAlertPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetAlertPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetAlertPolicyRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetAlertPolicyRequest.verify|verify} messages. + * @param message GetAlertPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetAlertPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetAlertPolicyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetAlertPolicyRequest; + + /** + * Decodes a GetAlertPolicyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetAlertPolicyRequest; + + /** + * Verifies a GetAlertPolicyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetAlertPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetAlertPolicyRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetAlertPolicyRequest; + + /** + * Creates a plain object from a GetAlertPolicyRequest message. Also converts values to other types if specified. + * @param message GetAlertPolicyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetAlertPolicyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetAlertPolicyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetAlertPolicyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListAlertPoliciesRequest. */ + interface IListAlertPoliciesRequest { + + /** ListAlertPoliciesRequest name */ + name?: (string|null); + + /** ListAlertPoliciesRequest filter */ + filter?: (string|null); + + /** ListAlertPoliciesRequest orderBy */ + orderBy?: (string|null); + + /** ListAlertPoliciesRequest pageSize */ + pageSize?: (number|null); + + /** ListAlertPoliciesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListAlertPoliciesRequest. */ + class ListAlertPoliciesRequest implements IListAlertPoliciesRequest { + + /** + * Constructs a new ListAlertPoliciesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListAlertPoliciesRequest); + + /** ListAlertPoliciesRequest name. */ + public name: string; + + /** ListAlertPoliciesRequest filter. */ + public filter: string; + + /** ListAlertPoliciesRequest orderBy. */ + public orderBy: string; + + /** ListAlertPoliciesRequest pageSize. */ + public pageSize: number; + + /** ListAlertPoliciesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListAlertPoliciesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAlertPoliciesRequest instance + */ + public static create(properties?: google.monitoring.v3.IListAlertPoliciesRequest): google.monitoring.v3.ListAlertPoliciesRequest; + + /** + * Encodes the specified ListAlertPoliciesRequest message. Does not implicitly {@link google.monitoring.v3.ListAlertPoliciesRequest.verify|verify} messages. + * @param message ListAlertPoliciesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListAlertPoliciesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAlertPoliciesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListAlertPoliciesRequest.verify|verify} messages. + * @param message ListAlertPoliciesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListAlertPoliciesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAlertPoliciesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAlertPoliciesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListAlertPoliciesRequest; + + /** + * Decodes a ListAlertPoliciesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAlertPoliciesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListAlertPoliciesRequest; + + /** + * Verifies a ListAlertPoliciesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListAlertPoliciesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAlertPoliciesRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListAlertPoliciesRequest; + + /** + * Creates a plain object from a ListAlertPoliciesRequest message. Also converts values to other types if specified. + * @param message ListAlertPoliciesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListAlertPoliciesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAlertPoliciesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListAlertPoliciesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListAlertPoliciesResponse. */ + interface IListAlertPoliciesResponse { + + /** ListAlertPoliciesResponse alertPolicies */ + alertPolicies?: (google.monitoring.v3.IAlertPolicy[]|null); + + /** ListAlertPoliciesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListAlertPoliciesResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListAlertPoliciesResponse. */ + class ListAlertPoliciesResponse implements IListAlertPoliciesResponse { + + /** + * Constructs a new ListAlertPoliciesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListAlertPoliciesResponse); + + /** ListAlertPoliciesResponse alertPolicies. */ + public alertPolicies: google.monitoring.v3.IAlertPolicy[]; + + /** ListAlertPoliciesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListAlertPoliciesResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListAlertPoliciesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAlertPoliciesResponse instance + */ + public static create(properties?: google.monitoring.v3.IListAlertPoliciesResponse): google.monitoring.v3.ListAlertPoliciesResponse; + + /** + * Encodes the specified ListAlertPoliciesResponse message. Does not implicitly {@link google.monitoring.v3.ListAlertPoliciesResponse.verify|verify} messages. + * @param message ListAlertPoliciesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListAlertPoliciesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAlertPoliciesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListAlertPoliciesResponse.verify|verify} messages. + * @param message ListAlertPoliciesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListAlertPoliciesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAlertPoliciesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAlertPoliciesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListAlertPoliciesResponse; + + /** + * Decodes a ListAlertPoliciesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAlertPoliciesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListAlertPoliciesResponse; + + /** + * Verifies a ListAlertPoliciesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListAlertPoliciesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAlertPoliciesResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListAlertPoliciesResponse; + + /** + * Creates a plain object from a ListAlertPoliciesResponse message. Also converts values to other types if specified. + * @param message ListAlertPoliciesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListAlertPoliciesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAlertPoliciesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListAlertPoliciesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateAlertPolicyRequest. */ + interface IUpdateAlertPolicyRequest { + + /** UpdateAlertPolicyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateAlertPolicyRequest alertPolicy */ + alertPolicy?: (google.monitoring.v3.IAlertPolicy|null); + } + + /** Represents an UpdateAlertPolicyRequest. */ + class UpdateAlertPolicyRequest implements IUpdateAlertPolicyRequest { + + /** + * Constructs a new UpdateAlertPolicyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IUpdateAlertPolicyRequest); + + /** UpdateAlertPolicyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateAlertPolicyRequest alertPolicy. */ + public alertPolicy?: (google.monitoring.v3.IAlertPolicy|null); + + /** + * Creates a new UpdateAlertPolicyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateAlertPolicyRequest instance + */ + public static create(properties?: google.monitoring.v3.IUpdateAlertPolicyRequest): google.monitoring.v3.UpdateAlertPolicyRequest; + + /** + * Encodes the specified UpdateAlertPolicyRequest message. Does not implicitly {@link google.monitoring.v3.UpdateAlertPolicyRequest.verify|verify} messages. + * @param message UpdateAlertPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IUpdateAlertPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateAlertPolicyRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateAlertPolicyRequest.verify|verify} messages. + * @param message UpdateAlertPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IUpdateAlertPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateAlertPolicyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UpdateAlertPolicyRequest; + + /** + * Decodes an UpdateAlertPolicyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UpdateAlertPolicyRequest; + + /** + * Verifies an UpdateAlertPolicyRequest message. + * @param message Plain 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 UpdateAlertPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateAlertPolicyRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UpdateAlertPolicyRequest; + + /** + * Creates a plain object from an UpdateAlertPolicyRequest message. Also converts values to other types if specified. + * @param message UpdateAlertPolicyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UpdateAlertPolicyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateAlertPolicyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateAlertPolicyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteAlertPolicyRequest. */ + interface IDeleteAlertPolicyRequest { + + /** DeleteAlertPolicyRequest name */ + name?: (string|null); + } + + /** Represents a DeleteAlertPolicyRequest. */ + class DeleteAlertPolicyRequest implements IDeleteAlertPolicyRequest { + + /** + * Constructs a new DeleteAlertPolicyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDeleteAlertPolicyRequest); + + /** DeleteAlertPolicyRequest name. */ + public name: string; + + /** + * Creates a new DeleteAlertPolicyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteAlertPolicyRequest instance + */ + public static create(properties?: google.monitoring.v3.IDeleteAlertPolicyRequest): google.monitoring.v3.DeleteAlertPolicyRequest; + + /** + * Encodes the specified DeleteAlertPolicyRequest message. Does not implicitly {@link google.monitoring.v3.DeleteAlertPolicyRequest.verify|verify} messages. + * @param message DeleteAlertPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDeleteAlertPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteAlertPolicyRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteAlertPolicyRequest.verify|verify} messages. + * @param message DeleteAlertPolicyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDeleteAlertPolicyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteAlertPolicyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DeleteAlertPolicyRequest; + + /** + * Decodes a DeleteAlertPolicyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DeleteAlertPolicyRequest; + + /** + * Verifies a DeleteAlertPolicyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteAlertPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteAlertPolicyRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DeleteAlertPolicyRequest; + + /** + * Creates a plain object from a DeleteAlertPolicyRequest message. Also converts values to other types if specified. + * @param message DeleteAlertPolicyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DeleteAlertPolicyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteAlertPolicyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteAlertPolicyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DroppedLabels. */ + interface IDroppedLabels { + + /** DroppedLabels label */ + label?: ({ [k: string]: string }|null); + } + + /** Represents a DroppedLabels. */ + class DroppedLabels implements IDroppedLabels { + + /** + * Constructs a new DroppedLabels. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDroppedLabels); + + /** DroppedLabels label. */ + public label: { [k: string]: string }; + + /** + * Creates a new DroppedLabels instance using the specified properties. + * @param [properties] Properties to set + * @returns DroppedLabels instance + */ + public static create(properties?: google.monitoring.v3.IDroppedLabels): google.monitoring.v3.DroppedLabels; + + /** + * Encodes the specified DroppedLabels message. Does not implicitly {@link google.monitoring.v3.DroppedLabels.verify|verify} messages. + * @param message DroppedLabels message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDroppedLabels, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DroppedLabels message, length delimited. Does not implicitly {@link google.monitoring.v3.DroppedLabels.verify|verify} messages. + * @param message DroppedLabels message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDroppedLabels, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DroppedLabels message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DroppedLabels + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DroppedLabels; + + /** + * Decodes a DroppedLabels message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DroppedLabels + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DroppedLabels; + + /** + * Verifies a DroppedLabels message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DroppedLabels message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DroppedLabels + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DroppedLabels; + + /** + * Creates a plain object from a DroppedLabels message. Also converts values to other types if specified. + * @param message DroppedLabels + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DroppedLabels, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DroppedLabels to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DroppedLabels + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Group. */ + interface IGroup { + + /** Group name */ + name?: (string|null); + + /** Group displayName */ + displayName?: (string|null); + + /** Group parentName */ + parentName?: (string|null); + + /** Group filter */ + filter?: (string|null); + + /** Group isCluster */ + isCluster?: (boolean|null); + } + + /** Represents a Group. */ + class Group implements IGroup { + + /** + * Constructs a new Group. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGroup); + + /** Group name. */ + public name: string; + + /** Group displayName. */ + public displayName: string; + + /** Group parentName. */ + public parentName: string; + + /** Group filter. */ + public filter: string; + + /** Group isCluster. */ + public isCluster: boolean; + + /** + * Creates a new Group instance using the specified properties. + * @param [properties] Properties to set + * @returns Group instance + */ + public static create(properties?: google.monitoring.v3.IGroup): google.monitoring.v3.Group; + + /** + * Encodes the specified Group message. Does not implicitly {@link google.monitoring.v3.Group.verify|verify} messages. + * @param message Group message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGroup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Group message, length delimited. Does not implicitly {@link google.monitoring.v3.Group.verify|verify} messages. + * @param message Group message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGroup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Group message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Group + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Group; + + /** + * Decodes a Group message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Group + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Group; + + /** + * Verifies a Group message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Group message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Group + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Group; + + /** + * Creates a plain object from a Group message. Also converts values to other types if specified. + * @param message Group + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Group, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Group to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Group + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a GroupService */ + class GroupService extends $protobuf.rpc.Service { + + /** + * Constructs a new GroupService 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 GroupService 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): GroupService; + + /** + * Calls ListGroups. + * @param request ListGroupsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListGroupsResponse + */ + public listGroups(request: google.monitoring.v3.IListGroupsRequest, callback: google.monitoring.v3.GroupService.ListGroupsCallback): void; + + /** + * Calls ListGroups. + * @param request ListGroupsRequest message or plain object + * @returns Promise + */ + public listGroups(request: google.monitoring.v3.IListGroupsRequest): Promise; + + /** + * Calls GetGroup. + * @param request GetGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Group + */ + public getGroup(request: google.monitoring.v3.IGetGroupRequest, callback: google.monitoring.v3.GroupService.GetGroupCallback): void; + + /** + * Calls GetGroup. + * @param request GetGroupRequest message or plain object + * @returns Promise + */ + public getGroup(request: google.monitoring.v3.IGetGroupRequest): Promise; + + /** + * Calls CreateGroup. + * @param request CreateGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Group + */ + public createGroup(request: google.monitoring.v3.ICreateGroupRequest, callback: google.monitoring.v3.GroupService.CreateGroupCallback): void; + + /** + * Calls CreateGroup. + * @param request CreateGroupRequest message or plain object + * @returns Promise + */ + public createGroup(request: google.monitoring.v3.ICreateGroupRequest): Promise; + + /** + * Calls UpdateGroup. + * @param request UpdateGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Group + */ + public updateGroup(request: google.monitoring.v3.IUpdateGroupRequest, callback: google.monitoring.v3.GroupService.UpdateGroupCallback): void; + + /** + * Calls UpdateGroup. + * @param request UpdateGroupRequest message or plain object + * @returns Promise + */ + public updateGroup(request: google.monitoring.v3.IUpdateGroupRequest): Promise; + + /** + * Calls DeleteGroup. + * @param request DeleteGroupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteGroup(request: google.monitoring.v3.IDeleteGroupRequest, callback: google.monitoring.v3.GroupService.DeleteGroupCallback): void; + + /** + * Calls DeleteGroup. + * @param request DeleteGroupRequest message or plain object + * @returns Promise + */ + public deleteGroup(request: google.monitoring.v3.IDeleteGroupRequest): Promise; + + /** + * Calls ListGroupMembers. + * @param request ListGroupMembersRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListGroupMembersResponse + */ + public listGroupMembers(request: google.monitoring.v3.IListGroupMembersRequest, callback: google.monitoring.v3.GroupService.ListGroupMembersCallback): void; + + /** + * Calls ListGroupMembers. + * @param request ListGroupMembersRequest message or plain object + * @returns Promise + */ + public listGroupMembers(request: google.monitoring.v3.IListGroupMembersRequest): Promise; + } + + namespace GroupService { + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|listGroups}. + * @param error Error, if any + * @param [response] ListGroupsResponse + */ + type ListGroupsCallback = (error: (Error|null), response?: google.monitoring.v3.ListGroupsResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|getGroup}. + * @param error Error, if any + * @param [response] Group + */ + type GetGroupCallback = (error: (Error|null), response?: google.monitoring.v3.Group) => void; + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|createGroup}. + * @param error Error, if any + * @param [response] Group + */ + type CreateGroupCallback = (error: (Error|null), response?: google.monitoring.v3.Group) => void; + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|updateGroup}. + * @param error Error, if any + * @param [response] Group + */ + type UpdateGroupCallback = (error: (Error|null), response?: google.monitoring.v3.Group) => void; + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|deleteGroup}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteGroupCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|listGroupMembers}. + * @param error Error, if any + * @param [response] ListGroupMembersResponse + */ + type ListGroupMembersCallback = (error: (Error|null), response?: google.monitoring.v3.ListGroupMembersResponse) => void; + } + + /** Properties of a ListGroupsRequest. */ + interface IListGroupsRequest { + + /** ListGroupsRequest name */ + name?: (string|null); + + /** ListGroupsRequest childrenOfGroup */ + childrenOfGroup?: (string|null); + + /** ListGroupsRequest ancestorsOfGroup */ + ancestorsOfGroup?: (string|null); + + /** ListGroupsRequest descendantsOfGroup */ + descendantsOfGroup?: (string|null); + + /** ListGroupsRequest pageSize */ + pageSize?: (number|null); + + /** ListGroupsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListGroupsRequest. */ + class ListGroupsRequest implements IListGroupsRequest { + + /** + * Constructs a new ListGroupsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListGroupsRequest); + + /** ListGroupsRequest name. */ + public name: string; + + /** ListGroupsRequest childrenOfGroup. */ + public childrenOfGroup?: (string|null); + + /** ListGroupsRequest ancestorsOfGroup. */ + public ancestorsOfGroup?: (string|null); + + /** ListGroupsRequest descendantsOfGroup. */ + public descendantsOfGroup?: (string|null); + + /** ListGroupsRequest pageSize. */ + public pageSize: number; + + /** ListGroupsRequest pageToken. */ + public pageToken: string; + + /** ListGroupsRequest filter. */ + public filter?: ("childrenOfGroup"|"ancestorsOfGroup"|"descendantsOfGroup"); + + /** + * Creates a new ListGroupsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGroupsRequest instance + */ + public static create(properties?: google.monitoring.v3.IListGroupsRequest): google.monitoring.v3.ListGroupsRequest; + + /** + * Encodes the specified ListGroupsRequest message. Does not implicitly {@link google.monitoring.v3.ListGroupsRequest.verify|verify} messages. + * @param message ListGroupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListGroupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGroupsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListGroupsRequest.verify|verify} messages. + * @param message ListGroupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListGroupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGroupsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListGroupsRequest; + + /** + * Decodes a ListGroupsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListGroupsRequest; + + /** + * Verifies a ListGroupsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGroupsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGroupsRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListGroupsRequest; + + /** + * Creates a plain object from a ListGroupsRequest message. Also converts values to other types if specified. + * @param message ListGroupsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListGroupsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGroupsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListGroupsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListGroupsResponse. */ + interface IListGroupsResponse { + + /** ListGroupsResponse group */ + group?: (google.monitoring.v3.IGroup[]|null); + + /** ListGroupsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListGroupsResponse. */ + class ListGroupsResponse implements IListGroupsResponse { + + /** + * Constructs a new ListGroupsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListGroupsResponse); + + /** ListGroupsResponse group. */ + public group: google.monitoring.v3.IGroup[]; + + /** ListGroupsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListGroupsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGroupsResponse instance + */ + public static create(properties?: google.monitoring.v3.IListGroupsResponse): google.monitoring.v3.ListGroupsResponse; + + /** + * Encodes the specified ListGroupsResponse message. Does not implicitly {@link google.monitoring.v3.ListGroupsResponse.verify|verify} messages. + * @param message ListGroupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListGroupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGroupsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListGroupsResponse.verify|verify} messages. + * @param message ListGroupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListGroupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGroupsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListGroupsResponse; + + /** + * Decodes a ListGroupsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListGroupsResponse; + + /** + * Verifies a ListGroupsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGroupsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGroupsResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListGroupsResponse; + + /** + * Creates a plain object from a ListGroupsResponse message. Also converts values to other types if specified. + * @param message ListGroupsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListGroupsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGroupsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListGroupsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetGroupRequest. */ + interface IGetGroupRequest { + + /** GetGroupRequest name */ + name?: (string|null); + } + + /** Represents a GetGroupRequest. */ + class GetGroupRequest implements IGetGroupRequest { + + /** + * Constructs a new GetGroupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetGroupRequest); + + /** GetGroupRequest name. */ + public name: string; + + /** + * Creates a new GetGroupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetGroupRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetGroupRequest): google.monitoring.v3.GetGroupRequest; + + /** + * Encodes the specified GetGroupRequest message. Does not implicitly {@link google.monitoring.v3.GetGroupRequest.verify|verify} messages. + * @param message GetGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetGroupRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetGroupRequest.verify|verify} messages. + * @param message GetGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetGroupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetGroupRequest; + + /** + * Decodes a GetGroupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetGroupRequest; + + /** + * Verifies a GetGroupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetGroupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetGroupRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetGroupRequest; + + /** + * Creates a plain object from a GetGroupRequest message. Also converts values to other types if specified. + * @param message GetGroupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetGroupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetGroupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetGroupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateGroupRequest. */ + interface ICreateGroupRequest { + + /** CreateGroupRequest name */ + name?: (string|null); + + /** CreateGroupRequest group */ + group?: (google.monitoring.v3.IGroup|null); + + /** CreateGroupRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents a CreateGroupRequest. */ + class CreateGroupRequest implements ICreateGroupRequest { + + /** + * Constructs a new CreateGroupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateGroupRequest); + + /** CreateGroupRequest name. */ + public name: string; + + /** CreateGroupRequest group. */ + public group?: (google.monitoring.v3.IGroup|null); + + /** CreateGroupRequest validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new CreateGroupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateGroupRequest instance + */ + public static create(properties?: google.monitoring.v3.ICreateGroupRequest): google.monitoring.v3.CreateGroupRequest; + + /** + * Encodes the specified CreateGroupRequest message. Does not implicitly {@link google.monitoring.v3.CreateGroupRequest.verify|verify} messages. + * @param message CreateGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateGroupRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateGroupRequest.verify|verify} messages. + * @param message CreateGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateGroupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateGroupRequest; + + /** + * Decodes a CreateGroupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateGroupRequest; + + /** + * Verifies a CreateGroupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateGroupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateGroupRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateGroupRequest; + + /** + * Creates a plain object from a CreateGroupRequest message. Also converts values to other types if specified. + * @param message CreateGroupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateGroupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateGroupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateGroupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateGroupRequest. */ + interface IUpdateGroupRequest { + + /** UpdateGroupRequest group */ + group?: (google.monitoring.v3.IGroup|null); + + /** UpdateGroupRequest validateOnly */ + validateOnly?: (boolean|null); + } + + /** Represents an UpdateGroupRequest. */ + class UpdateGroupRequest implements IUpdateGroupRequest { + + /** + * Constructs a new UpdateGroupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IUpdateGroupRequest); + + /** UpdateGroupRequest group. */ + public group?: (google.monitoring.v3.IGroup|null); + + /** UpdateGroupRequest validateOnly. */ + public validateOnly: boolean; + + /** + * Creates a new UpdateGroupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateGroupRequest instance + */ + public static create(properties?: google.monitoring.v3.IUpdateGroupRequest): google.monitoring.v3.UpdateGroupRequest; + + /** + * Encodes the specified UpdateGroupRequest message. Does not implicitly {@link google.monitoring.v3.UpdateGroupRequest.verify|verify} messages. + * @param message UpdateGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IUpdateGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateGroupRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateGroupRequest.verify|verify} messages. + * @param message UpdateGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IUpdateGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateGroupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UpdateGroupRequest; + + /** + * Decodes an UpdateGroupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UpdateGroupRequest; + + /** + * Verifies an UpdateGroupRequest message. + * @param message Plain 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 UpdateGroupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateGroupRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UpdateGroupRequest; + + /** + * Creates a plain object from an UpdateGroupRequest message. Also converts values to other types if specified. + * @param message UpdateGroupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UpdateGroupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateGroupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateGroupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteGroupRequest. */ + interface IDeleteGroupRequest { + + /** DeleteGroupRequest name */ + name?: (string|null); + + /** DeleteGroupRequest recursive */ + recursive?: (boolean|null); + } + + /** Represents a DeleteGroupRequest. */ + class DeleteGroupRequest implements IDeleteGroupRequest { + + /** + * Constructs a new DeleteGroupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDeleteGroupRequest); + + /** DeleteGroupRequest name. */ + public name: string; + + /** DeleteGroupRequest recursive. */ + public recursive: boolean; + + /** + * Creates a new DeleteGroupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteGroupRequest instance + */ + public static create(properties?: google.monitoring.v3.IDeleteGroupRequest): google.monitoring.v3.DeleteGroupRequest; + + /** + * Encodes the specified DeleteGroupRequest message. Does not implicitly {@link google.monitoring.v3.DeleteGroupRequest.verify|verify} messages. + * @param message DeleteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDeleteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteGroupRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteGroupRequest.verify|verify} messages. + * @param message DeleteGroupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDeleteGroupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteGroupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DeleteGroupRequest; + + /** + * Decodes a DeleteGroupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DeleteGroupRequest; + + /** + * Verifies a DeleteGroupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteGroupRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DeleteGroupRequest; + + /** + * Creates a plain object from a DeleteGroupRequest message. Also converts values to other types if specified. + * @param message DeleteGroupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DeleteGroupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteGroupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteGroupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListGroupMembersRequest. */ + interface IListGroupMembersRequest { + + /** ListGroupMembersRequest name */ + name?: (string|null); + + /** ListGroupMembersRequest pageSize */ + pageSize?: (number|null); + + /** ListGroupMembersRequest pageToken */ + pageToken?: (string|null); + + /** ListGroupMembersRequest filter */ + filter?: (string|null); + + /** ListGroupMembersRequest interval */ + interval?: (google.monitoring.v3.ITimeInterval|null); + } + + /** Represents a ListGroupMembersRequest. */ + class ListGroupMembersRequest implements IListGroupMembersRequest { + + /** + * Constructs a new ListGroupMembersRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListGroupMembersRequest); + + /** ListGroupMembersRequest name. */ + public name: string; + + /** ListGroupMembersRequest pageSize. */ + public pageSize: number; + + /** ListGroupMembersRequest pageToken. */ + public pageToken: string; + + /** ListGroupMembersRequest filter. */ + public filter: string; + + /** ListGroupMembersRequest interval. */ + public interval?: (google.monitoring.v3.ITimeInterval|null); + + /** + * Creates a new ListGroupMembersRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGroupMembersRequest instance + */ + public static create(properties?: google.monitoring.v3.IListGroupMembersRequest): google.monitoring.v3.ListGroupMembersRequest; + + /** + * Encodes the specified ListGroupMembersRequest message. Does not implicitly {@link google.monitoring.v3.ListGroupMembersRequest.verify|verify} messages. + * @param message ListGroupMembersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListGroupMembersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGroupMembersRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListGroupMembersRequest.verify|verify} messages. + * @param message ListGroupMembersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListGroupMembersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGroupMembersRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGroupMembersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListGroupMembersRequest; + + /** + * Decodes a ListGroupMembersRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGroupMembersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListGroupMembersRequest; + + /** + * Verifies a ListGroupMembersRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGroupMembersRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGroupMembersRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListGroupMembersRequest; + + /** + * Creates a plain object from a ListGroupMembersRequest message. Also converts values to other types if specified. + * @param message ListGroupMembersRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListGroupMembersRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGroupMembersRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListGroupMembersRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListGroupMembersResponse. */ + interface IListGroupMembersResponse { + + /** ListGroupMembersResponse members */ + members?: (google.api.IMonitoredResource[]|null); + + /** ListGroupMembersResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListGroupMembersResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListGroupMembersResponse. */ + class ListGroupMembersResponse implements IListGroupMembersResponse { + + /** + * Constructs a new ListGroupMembersResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListGroupMembersResponse); + + /** ListGroupMembersResponse members. */ + public members: google.api.IMonitoredResource[]; + + /** ListGroupMembersResponse nextPageToken. */ + public nextPageToken: string; + + /** ListGroupMembersResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListGroupMembersResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListGroupMembersResponse instance + */ + public static create(properties?: google.monitoring.v3.IListGroupMembersResponse): google.monitoring.v3.ListGroupMembersResponse; + + /** + * Encodes the specified ListGroupMembersResponse message. Does not implicitly {@link google.monitoring.v3.ListGroupMembersResponse.verify|verify} messages. + * @param message ListGroupMembersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListGroupMembersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListGroupMembersResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListGroupMembersResponse.verify|verify} messages. + * @param message ListGroupMembersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListGroupMembersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListGroupMembersResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListGroupMembersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListGroupMembersResponse; + + /** + * Decodes a ListGroupMembersResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListGroupMembersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListGroupMembersResponse; + + /** + * Verifies a ListGroupMembersResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListGroupMembersResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListGroupMembersResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListGroupMembersResponse; + + /** + * Creates a plain object from a ListGroupMembersResponse message. Also converts values to other types if specified. + * @param message ListGroupMembersResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListGroupMembersResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListGroupMembersResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListGroupMembersResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Point. */ + interface IPoint { + + /** Point interval */ + interval?: (google.monitoring.v3.ITimeInterval|null); + + /** Point value */ + value?: (google.monitoring.v3.ITypedValue|null); + } + + /** Represents a Point. */ + class Point implements IPoint { + + /** + * Constructs a new Point. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IPoint); + + /** Point interval. */ + public interval?: (google.monitoring.v3.ITimeInterval|null); + + /** Point value. */ + public value?: (google.monitoring.v3.ITypedValue|null); + + /** + * Creates a new Point instance using the specified properties. + * @param [properties] Properties to set + * @returns Point instance + */ + public static create(properties?: google.monitoring.v3.IPoint): google.monitoring.v3.Point; + + /** + * Encodes the specified Point message. Does not implicitly {@link google.monitoring.v3.Point.verify|verify} messages. + * @param message Point message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IPoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Point message, length delimited. Does not implicitly {@link google.monitoring.v3.Point.verify|verify} messages. + * @param message Point message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IPoint, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Point message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Point + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Point; + + /** + * Decodes a Point message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Point + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Point; + + /** + * Verifies a Point message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Point message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Point + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Point; + + /** + * Creates a plain object from a Point message. Also converts values to other types if specified. + * @param message Point + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Point, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Point to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Point + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TimeSeries. */ + interface ITimeSeries { + + /** TimeSeries metric */ + metric?: (google.api.IMetric|null); + + /** TimeSeries resource */ + resource?: (google.api.IMonitoredResource|null); + + /** TimeSeries metadata */ + metadata?: (google.api.IMonitoredResourceMetadata|null); + + /** TimeSeries metricKind */ + metricKind?: (google.api.MetricDescriptor.MetricKind|keyof typeof google.api.MetricDescriptor.MetricKind|null); + + /** TimeSeries valueType */ + valueType?: (google.api.MetricDescriptor.ValueType|keyof typeof google.api.MetricDescriptor.ValueType|null); + + /** TimeSeries points */ + points?: (google.monitoring.v3.IPoint[]|null); + + /** TimeSeries unit */ + unit?: (string|null); + } + + /** Represents a TimeSeries. */ + class TimeSeries implements ITimeSeries { + + /** + * Constructs a new TimeSeries. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ITimeSeries); + + /** TimeSeries metric. */ + public metric?: (google.api.IMetric|null); + + /** TimeSeries resource. */ + public resource?: (google.api.IMonitoredResource|null); + + /** TimeSeries metadata. */ + public metadata?: (google.api.IMonitoredResourceMetadata|null); + + /** TimeSeries metricKind. */ + public metricKind: (google.api.MetricDescriptor.MetricKind|keyof typeof google.api.MetricDescriptor.MetricKind); + + /** TimeSeries valueType. */ + public valueType: (google.api.MetricDescriptor.ValueType|keyof typeof google.api.MetricDescriptor.ValueType); + + /** TimeSeries points. */ + public points: google.monitoring.v3.IPoint[]; + + /** TimeSeries unit. */ + public unit: string; + + /** + * Creates a new TimeSeries instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeSeries instance + */ + public static create(properties?: google.monitoring.v3.ITimeSeries): google.monitoring.v3.TimeSeries; + + /** + * Encodes the specified TimeSeries message. Does not implicitly {@link google.monitoring.v3.TimeSeries.verify|verify} messages. + * @param message TimeSeries message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ITimeSeries, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeSeries message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeries.verify|verify} messages. + * @param message TimeSeries message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ITimeSeries, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeSeries message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeSeries + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TimeSeries; + + /** + * Decodes a TimeSeries message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeSeries + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TimeSeries; + + /** + * Verifies a TimeSeries message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeSeries message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeSeries + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TimeSeries; + + /** + * Creates a plain object from a TimeSeries message. Also converts values to other types if specified. + * @param message TimeSeries + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TimeSeries, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeSeries to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TimeSeries + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TimeSeriesDescriptor. */ + interface ITimeSeriesDescriptor { + + /** TimeSeriesDescriptor labelDescriptors */ + labelDescriptors?: (google.api.ILabelDescriptor[]|null); + + /** TimeSeriesDescriptor pointDescriptors */ + pointDescriptors?: (google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor[]|null); + } + + /** Represents a TimeSeriesDescriptor. */ + class TimeSeriesDescriptor implements ITimeSeriesDescriptor { + + /** + * Constructs a new TimeSeriesDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ITimeSeriesDescriptor); + + /** TimeSeriesDescriptor labelDescriptors. */ + public labelDescriptors: google.api.ILabelDescriptor[]; + + /** TimeSeriesDescriptor pointDescriptors. */ + public pointDescriptors: google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor[]; + + /** + * Creates a new TimeSeriesDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeSeriesDescriptor instance + */ + public static create(properties?: google.monitoring.v3.ITimeSeriesDescriptor): google.monitoring.v3.TimeSeriesDescriptor; + + /** + * Encodes the specified TimeSeriesDescriptor message. Does not implicitly {@link google.monitoring.v3.TimeSeriesDescriptor.verify|verify} messages. + * @param message TimeSeriesDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ITimeSeriesDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeSeriesDescriptor message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesDescriptor.verify|verify} messages. + * @param message TimeSeriesDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ITimeSeriesDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeSeriesDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeSeriesDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TimeSeriesDescriptor; + + /** + * Decodes a TimeSeriesDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeSeriesDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TimeSeriesDescriptor; + + /** + * Verifies a TimeSeriesDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeSeriesDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeSeriesDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TimeSeriesDescriptor; + + /** + * Creates a plain object from a TimeSeriesDescriptor message. Also converts values to other types if specified. + * @param message TimeSeriesDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TimeSeriesDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeSeriesDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TimeSeriesDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TimeSeriesDescriptor { + + /** Properties of a ValueDescriptor. */ + interface IValueDescriptor { + + /** ValueDescriptor key */ + key?: (string|null); + + /** ValueDescriptor valueType */ + valueType?: (google.api.MetricDescriptor.ValueType|keyof typeof google.api.MetricDescriptor.ValueType|null); + + /** ValueDescriptor metricKind */ + metricKind?: (google.api.MetricDescriptor.MetricKind|keyof typeof google.api.MetricDescriptor.MetricKind|null); + + /** ValueDescriptor unit */ + unit?: (string|null); + } + + /** Represents a ValueDescriptor. */ + class ValueDescriptor implements IValueDescriptor { + + /** + * Constructs a new ValueDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor); + + /** ValueDescriptor key. */ + public key: string; + + /** ValueDescriptor valueType. */ + public valueType: (google.api.MetricDescriptor.ValueType|keyof typeof google.api.MetricDescriptor.ValueType); + + /** ValueDescriptor metricKind. */ + public metricKind: (google.api.MetricDescriptor.MetricKind|keyof typeof google.api.MetricDescriptor.MetricKind); + + /** ValueDescriptor unit. */ + public unit: string; + + /** + * Creates a new ValueDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ValueDescriptor instance + */ + public static create(properties?: google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor): google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor; + + /** + * Encodes the specified ValueDescriptor message. Does not implicitly {@link google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.verify|verify} messages. + * @param message ValueDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ValueDescriptor message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.verify|verify} messages. + * @param message ValueDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValueDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ValueDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor; + + /** + * Decodes a ValueDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ValueDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor; + + /** + * Verifies a ValueDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ValueDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ValueDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor; + + /** + * Creates a plain object from a ValueDescriptor message. Also converts values to other types if specified. + * @param message ValueDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ValueDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ValueDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a TimeSeriesData. */ + interface ITimeSeriesData { + + /** TimeSeriesData labelValues */ + labelValues?: (google.monitoring.v3.ILabelValue[]|null); + + /** TimeSeriesData pointData */ + pointData?: (google.monitoring.v3.TimeSeriesData.IPointData[]|null); + } + + /** Represents a TimeSeriesData. */ + class TimeSeriesData implements ITimeSeriesData { + + /** + * Constructs a new TimeSeriesData. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ITimeSeriesData); + + /** TimeSeriesData labelValues. */ + public labelValues: google.monitoring.v3.ILabelValue[]; + + /** TimeSeriesData pointData. */ + public pointData: google.monitoring.v3.TimeSeriesData.IPointData[]; + + /** + * Creates a new TimeSeriesData instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeSeriesData instance + */ + public static create(properties?: google.monitoring.v3.ITimeSeriesData): google.monitoring.v3.TimeSeriesData; + + /** + * Encodes the specified TimeSeriesData message. Does not implicitly {@link google.monitoring.v3.TimeSeriesData.verify|verify} messages. + * @param message TimeSeriesData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ITimeSeriesData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeSeriesData message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesData.verify|verify} messages. + * @param message TimeSeriesData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ITimeSeriesData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeSeriesData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeSeriesData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TimeSeriesData; + + /** + * Decodes a TimeSeriesData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeSeriesData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TimeSeriesData; + + /** + * Verifies a TimeSeriesData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeSeriesData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeSeriesData + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TimeSeriesData; + + /** + * Creates a plain object from a TimeSeriesData message. Also converts values to other types if specified. + * @param message TimeSeriesData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TimeSeriesData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeSeriesData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TimeSeriesData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TimeSeriesData { + + /** Properties of a PointData. */ + interface IPointData { + + /** PointData values */ + values?: (google.monitoring.v3.ITypedValue[]|null); + + /** PointData timeInterval */ + timeInterval?: (google.monitoring.v3.ITimeInterval|null); + } + + /** Represents a PointData. */ + class PointData implements IPointData { + + /** + * Constructs a new PointData. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.TimeSeriesData.IPointData); + + /** PointData values. */ + public values: google.monitoring.v3.ITypedValue[]; + + /** PointData timeInterval. */ + public timeInterval?: (google.monitoring.v3.ITimeInterval|null); + + /** + * Creates a new PointData instance using the specified properties. + * @param [properties] Properties to set + * @returns PointData instance + */ + public static create(properties?: google.monitoring.v3.TimeSeriesData.IPointData): google.monitoring.v3.TimeSeriesData.PointData; + + /** + * Encodes the specified PointData message. Does not implicitly {@link google.monitoring.v3.TimeSeriesData.PointData.verify|verify} messages. + * @param message PointData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.TimeSeriesData.IPointData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PointData message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesData.PointData.verify|verify} messages. + * @param message PointData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.TimeSeriesData.IPointData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PointData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PointData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TimeSeriesData.PointData; + + /** + * Decodes a PointData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PointData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TimeSeriesData.PointData; + + /** + * Verifies a PointData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PointData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PointData + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TimeSeriesData.PointData; + + /** + * Creates a plain object from a PointData message. Also converts values to other types if specified. + * @param message PointData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TimeSeriesData.PointData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PointData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PointData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a LabelValue. */ + interface ILabelValue { + + /** LabelValue boolValue */ + boolValue?: (boolean|null); + + /** LabelValue int64Value */ + int64Value?: (number|Long|string|null); + + /** LabelValue stringValue */ + stringValue?: (string|null); + } + + /** Represents a LabelValue. */ + class LabelValue implements ILabelValue { + + /** + * Constructs a new LabelValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ILabelValue); + + /** LabelValue boolValue. */ + public boolValue?: (boolean|null); + + /** LabelValue int64Value. */ + public int64Value?: (number|Long|string|null); + + /** LabelValue stringValue. */ + public stringValue?: (string|null); + + /** LabelValue value. */ + public value?: ("boolValue"|"int64Value"|"stringValue"); + + /** + * Creates a new LabelValue instance using the specified properties. + * @param [properties] Properties to set + * @returns LabelValue instance + */ + public static create(properties?: google.monitoring.v3.ILabelValue): google.monitoring.v3.LabelValue; + + /** + * Encodes the specified LabelValue message. Does not implicitly {@link google.monitoring.v3.LabelValue.verify|verify} messages. + * @param message LabelValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ILabelValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LabelValue message, length delimited. Does not implicitly {@link google.monitoring.v3.LabelValue.verify|verify} messages. + * @param message LabelValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ILabelValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LabelValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LabelValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.LabelValue; + + /** + * Decodes a LabelValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LabelValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.LabelValue; + + /** + * Verifies a LabelValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LabelValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LabelValue + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.LabelValue; + + /** + * Creates a plain object from a LabelValue message. Also converts values to other types if specified. + * @param message LabelValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.LabelValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LabelValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LabelValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryError. */ + interface IQueryError { + + /** QueryError locator */ + locator?: (google.monitoring.v3.ITextLocator|null); + + /** QueryError message */ + message?: (string|null); + } + + /** Represents a QueryError. */ + class QueryError implements IQueryError { + + /** + * Constructs a new QueryError. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IQueryError); + + /** QueryError locator. */ + public locator?: (google.monitoring.v3.ITextLocator|null); + + /** QueryError message. */ + public message: string; + + /** + * Creates a new QueryError instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryError instance + */ + public static create(properties?: google.monitoring.v3.IQueryError): google.monitoring.v3.QueryError; + + /** + * Encodes the specified QueryError message. Does not implicitly {@link google.monitoring.v3.QueryError.verify|verify} messages. + * @param message QueryError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IQueryError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryError message, length delimited. Does not implicitly {@link google.monitoring.v3.QueryError.verify|verify} messages. + * @param message QueryError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IQueryError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.QueryError; + + /** + * Decodes a QueryError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.QueryError; + + /** + * Verifies a QueryError message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryError + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.QueryError; + + /** + * Creates a plain object from a QueryError message. Also converts values to other types if specified. + * @param message QueryError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.QueryError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TextLocator. */ + interface ITextLocator { + + /** TextLocator source */ + source?: (string|null); + + /** TextLocator startPosition */ + startPosition?: (google.monitoring.v3.TextLocator.IPosition|null); + + /** TextLocator endPosition */ + endPosition?: (google.monitoring.v3.TextLocator.IPosition|null); + + /** TextLocator nestedLocator */ + nestedLocator?: (google.monitoring.v3.ITextLocator|null); + + /** TextLocator nestingReason */ + nestingReason?: (string|null); + } + + /** Represents a TextLocator. */ + class TextLocator implements ITextLocator { + + /** + * Constructs a new TextLocator. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ITextLocator); + + /** TextLocator source. */ + public source: string; + + /** TextLocator startPosition. */ + public startPosition?: (google.monitoring.v3.TextLocator.IPosition|null); + + /** TextLocator endPosition. */ + public endPosition?: (google.monitoring.v3.TextLocator.IPosition|null); + + /** TextLocator nestedLocator. */ + public nestedLocator?: (google.monitoring.v3.ITextLocator|null); + + /** TextLocator nestingReason. */ + public nestingReason: string; + + /** + * Creates a new TextLocator instance using the specified properties. + * @param [properties] Properties to set + * @returns TextLocator instance + */ + public static create(properties?: google.monitoring.v3.ITextLocator): google.monitoring.v3.TextLocator; + + /** + * Encodes the specified TextLocator message. Does not implicitly {@link google.monitoring.v3.TextLocator.verify|verify} messages. + * @param message TextLocator message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ITextLocator, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextLocator message, length delimited. Does not implicitly {@link google.monitoring.v3.TextLocator.verify|verify} messages. + * @param message TextLocator message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ITextLocator, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextLocator message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextLocator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TextLocator; + + /** + * Decodes a TextLocator message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextLocator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TextLocator; + + /** + * Verifies a TextLocator message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextLocator message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextLocator + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TextLocator; + + /** + * Creates a plain object from a TextLocator message. Also converts values to other types if specified. + * @param message TextLocator + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TextLocator, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextLocator to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextLocator + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TextLocator { + + /** Properties of a Position. */ + interface IPosition { + + /** Position line */ + line?: (number|null); + + /** Position column */ + column?: (number|null); + } + + /** Represents a Position. */ + class Position implements IPosition { + + /** + * Constructs a new Position. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.TextLocator.IPosition); + + /** Position line. */ + public line: number; + + /** Position column. */ + public column: number; + + /** + * Creates a new Position instance using the specified properties. + * @param [properties] Properties to set + * @returns Position instance + */ + public static create(properties?: google.monitoring.v3.TextLocator.IPosition): google.monitoring.v3.TextLocator.Position; + + /** + * Encodes the specified Position message. Does not implicitly {@link google.monitoring.v3.TextLocator.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.TextLocator.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.monitoring.v3.TextLocator.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.TextLocator.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Position message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TextLocator.Position; + + /** + * Decodes a Position message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TextLocator.Position; + + /** + * Verifies a Position message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Position message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Position + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TextLocator.Position; + + /** + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @param message Position + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TextLocator.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Position to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Position + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Represents a MetricService */ + class MetricService extends $protobuf.rpc.Service { + + /** + * Constructs a new MetricService 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 MetricService 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): MetricService; + + /** + * Calls ListMonitoredResourceDescriptors. + * @param request ListMonitoredResourceDescriptorsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListMonitoredResourceDescriptorsResponse + */ + public listMonitoredResourceDescriptors(request: google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, callback: google.monitoring.v3.MetricService.ListMonitoredResourceDescriptorsCallback): void; + + /** + * Calls ListMonitoredResourceDescriptors. + * @param request ListMonitoredResourceDescriptorsRequest message or plain object + * @returns Promise + */ + public listMonitoredResourceDescriptors(request: google.monitoring.v3.IListMonitoredResourceDescriptorsRequest): Promise; + + /** + * Calls GetMonitoredResourceDescriptor. + * @param request GetMonitoredResourceDescriptorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and MonitoredResourceDescriptor + */ + public getMonitoredResourceDescriptor(request: google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, callback: google.monitoring.v3.MetricService.GetMonitoredResourceDescriptorCallback): void; + + /** + * Calls GetMonitoredResourceDescriptor. + * @param request GetMonitoredResourceDescriptorRequest message or plain object + * @returns Promise + */ + public getMonitoredResourceDescriptor(request: google.monitoring.v3.IGetMonitoredResourceDescriptorRequest): Promise; + + /** + * Calls ListMetricDescriptors. + * @param request ListMetricDescriptorsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListMetricDescriptorsResponse + */ + public listMetricDescriptors(request: google.monitoring.v3.IListMetricDescriptorsRequest, callback: google.monitoring.v3.MetricService.ListMetricDescriptorsCallback): void; + + /** + * Calls ListMetricDescriptors. + * @param request ListMetricDescriptorsRequest message or plain object + * @returns Promise + */ + public listMetricDescriptors(request: google.monitoring.v3.IListMetricDescriptorsRequest): Promise; + + /** + * Calls GetMetricDescriptor. + * @param request GetMetricDescriptorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and MetricDescriptor + */ + public getMetricDescriptor(request: google.monitoring.v3.IGetMetricDescriptorRequest, callback: google.monitoring.v3.MetricService.GetMetricDescriptorCallback): void; + + /** + * Calls GetMetricDescriptor. + * @param request GetMetricDescriptorRequest message or plain object + * @returns Promise + */ + public getMetricDescriptor(request: google.monitoring.v3.IGetMetricDescriptorRequest): Promise; + + /** + * Calls CreateMetricDescriptor. + * @param request CreateMetricDescriptorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and MetricDescriptor + */ + public createMetricDescriptor(request: google.monitoring.v3.ICreateMetricDescriptorRequest, callback: google.monitoring.v3.MetricService.CreateMetricDescriptorCallback): void; + + /** + * Calls CreateMetricDescriptor. + * @param request CreateMetricDescriptorRequest message or plain object + * @returns Promise + */ + public createMetricDescriptor(request: google.monitoring.v3.ICreateMetricDescriptorRequest): Promise; + + /** + * Calls DeleteMetricDescriptor. + * @param request DeleteMetricDescriptorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteMetricDescriptor(request: google.monitoring.v3.IDeleteMetricDescriptorRequest, callback: google.monitoring.v3.MetricService.DeleteMetricDescriptorCallback): void; + + /** + * Calls DeleteMetricDescriptor. + * @param request DeleteMetricDescriptorRequest message or plain object + * @returns Promise + */ + public deleteMetricDescriptor(request: google.monitoring.v3.IDeleteMetricDescriptorRequest): Promise; + + /** + * Calls ListTimeSeries. + * @param request ListTimeSeriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListTimeSeriesResponse + */ + public listTimeSeries(request: google.monitoring.v3.IListTimeSeriesRequest, callback: google.monitoring.v3.MetricService.ListTimeSeriesCallback): void; + + /** + * Calls ListTimeSeries. + * @param request ListTimeSeriesRequest message or plain object + * @returns Promise + */ + public listTimeSeries(request: google.monitoring.v3.IListTimeSeriesRequest): Promise; + + /** + * Calls CreateTimeSeries. + * @param request CreateTimeSeriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public createTimeSeries(request: google.monitoring.v3.ICreateTimeSeriesRequest, callback: google.monitoring.v3.MetricService.CreateTimeSeriesCallback): void; + + /** + * Calls CreateTimeSeries. + * @param request CreateTimeSeriesRequest message or plain object + * @returns Promise + */ + public createTimeSeries(request: google.monitoring.v3.ICreateTimeSeriesRequest): Promise; + } + + namespace MetricService { + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|listMonitoredResourceDescriptors}. + * @param error Error, if any + * @param [response] ListMonitoredResourceDescriptorsResponse + */ + type ListMonitoredResourceDescriptorsCallback = (error: (Error|null), response?: google.monitoring.v3.ListMonitoredResourceDescriptorsResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|getMonitoredResourceDescriptor}. + * @param error Error, if any + * @param [response] MonitoredResourceDescriptor + */ + type GetMonitoredResourceDescriptorCallback = (error: (Error|null), response?: google.api.MonitoredResourceDescriptor) => void; + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|listMetricDescriptors}. + * @param error Error, if any + * @param [response] ListMetricDescriptorsResponse + */ + type ListMetricDescriptorsCallback = (error: (Error|null), response?: google.monitoring.v3.ListMetricDescriptorsResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|getMetricDescriptor}. + * @param error Error, if any + * @param [response] MetricDescriptor + */ + type GetMetricDescriptorCallback = (error: (Error|null), response?: google.api.MetricDescriptor) => void; + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|createMetricDescriptor}. + * @param error Error, if any + * @param [response] MetricDescriptor + */ + type CreateMetricDescriptorCallback = (error: (Error|null), response?: google.api.MetricDescriptor) => void; + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|deleteMetricDescriptor}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteMetricDescriptorCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|listTimeSeries}. + * @param error Error, if any + * @param [response] ListTimeSeriesResponse + */ + type ListTimeSeriesCallback = (error: (Error|null), response?: google.monitoring.v3.ListTimeSeriesResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|createTimeSeries}. + * @param error Error, if any + * @param [response] Empty + */ + type CreateTimeSeriesCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a ListMonitoredResourceDescriptorsRequest. */ + interface IListMonitoredResourceDescriptorsRequest { + + /** ListMonitoredResourceDescriptorsRequest name */ + name?: (string|null); + + /** ListMonitoredResourceDescriptorsRequest filter */ + filter?: (string|null); + + /** ListMonitoredResourceDescriptorsRequest pageSize */ + pageSize?: (number|null); + + /** ListMonitoredResourceDescriptorsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListMonitoredResourceDescriptorsRequest. */ + class ListMonitoredResourceDescriptorsRequest implements IListMonitoredResourceDescriptorsRequest { + + /** + * Constructs a new ListMonitoredResourceDescriptorsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListMonitoredResourceDescriptorsRequest); + + /** ListMonitoredResourceDescriptorsRequest name. */ + public name: string; + + /** ListMonitoredResourceDescriptorsRequest filter. */ + public filter: string; + + /** ListMonitoredResourceDescriptorsRequest pageSize. */ + public pageSize: number; + + /** ListMonitoredResourceDescriptorsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListMonitoredResourceDescriptorsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMonitoredResourceDescriptorsRequest instance + */ + public static create(properties?: google.monitoring.v3.IListMonitoredResourceDescriptorsRequest): google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsRequest message. Does not implicitly {@link google.monitoring.v3.ListMonitoredResourceDescriptorsRequest.verify|verify} messages. + * @param message ListMonitoredResourceDescriptorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListMonitoredResourceDescriptorsRequest.verify|verify} messages. + * @param message ListMonitoredResourceDescriptorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMonitoredResourceDescriptorsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMonitoredResourceDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; + + /** + * Decodes a ListMonitoredResourceDescriptorsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMonitoredResourceDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; + + /** + * Verifies a ListMonitoredResourceDescriptorsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMonitoredResourceDescriptorsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMonitoredResourceDescriptorsRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; + + /** + * Creates a plain object from a ListMonitoredResourceDescriptorsRequest message. Also converts values to other types if specified. + * @param message ListMonitoredResourceDescriptorsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListMonitoredResourceDescriptorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMonitoredResourceDescriptorsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMonitoredResourceDescriptorsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMonitoredResourceDescriptorsResponse. */ + interface IListMonitoredResourceDescriptorsResponse { + + /** ListMonitoredResourceDescriptorsResponse resourceDescriptors */ + resourceDescriptors?: (google.api.IMonitoredResourceDescriptor[]|null); + + /** ListMonitoredResourceDescriptorsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListMonitoredResourceDescriptorsResponse. */ + class ListMonitoredResourceDescriptorsResponse implements IListMonitoredResourceDescriptorsResponse { + + /** + * Constructs a new ListMonitoredResourceDescriptorsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListMonitoredResourceDescriptorsResponse); + + /** ListMonitoredResourceDescriptorsResponse resourceDescriptors. */ + public resourceDescriptors: google.api.IMonitoredResourceDescriptor[]; + + /** ListMonitoredResourceDescriptorsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListMonitoredResourceDescriptorsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMonitoredResourceDescriptorsResponse instance + */ + public static create(properties?: google.monitoring.v3.IListMonitoredResourceDescriptorsResponse): google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsResponse message. Does not implicitly {@link google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.verify|verify} messages. + * @param message ListMonitoredResourceDescriptorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListMonitoredResourceDescriptorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.verify|verify} messages. + * @param message ListMonitoredResourceDescriptorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListMonitoredResourceDescriptorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMonitoredResourceDescriptorsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMonitoredResourceDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; + + /** + * Decodes a ListMonitoredResourceDescriptorsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMonitoredResourceDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; + + /** + * Verifies a ListMonitoredResourceDescriptorsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMonitoredResourceDescriptorsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMonitoredResourceDescriptorsResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; + + /** + * Creates a plain object from a ListMonitoredResourceDescriptorsResponse message. Also converts values to other types if specified. + * @param message ListMonitoredResourceDescriptorsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListMonitoredResourceDescriptorsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMonitoredResourceDescriptorsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMonitoredResourceDescriptorsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetMonitoredResourceDescriptorRequest. */ + interface IGetMonitoredResourceDescriptorRequest { + + /** GetMonitoredResourceDescriptorRequest name */ + name?: (string|null); + } + + /** Represents a GetMonitoredResourceDescriptorRequest. */ + class GetMonitoredResourceDescriptorRequest implements IGetMonitoredResourceDescriptorRequest { + + /** + * Constructs a new GetMonitoredResourceDescriptorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetMonitoredResourceDescriptorRequest); + + /** GetMonitoredResourceDescriptorRequest name. */ + public name: string; + + /** + * Creates a new GetMonitoredResourceDescriptorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetMonitoredResourceDescriptorRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetMonitoredResourceDescriptorRequest): google.monitoring.v3.GetMonitoredResourceDescriptorRequest; + + /** + * Encodes the specified GetMonitoredResourceDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.GetMonitoredResourceDescriptorRequest.verify|verify} messages. + * @param message GetMonitoredResourceDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetMonitoredResourceDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetMonitoredResourceDescriptorRequest.verify|verify} messages. + * @param message GetMonitoredResourceDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetMonitoredResourceDescriptorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetMonitoredResourceDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetMonitoredResourceDescriptorRequest; + + /** + * Decodes a GetMonitoredResourceDescriptorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetMonitoredResourceDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetMonitoredResourceDescriptorRequest; + + /** + * Verifies a GetMonitoredResourceDescriptorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetMonitoredResourceDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetMonitoredResourceDescriptorRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetMonitoredResourceDescriptorRequest; + + /** + * Creates a plain object from a GetMonitoredResourceDescriptorRequest message. Also converts values to other types if specified. + * @param message GetMonitoredResourceDescriptorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetMonitoredResourceDescriptorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetMonitoredResourceDescriptorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetMonitoredResourceDescriptorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMetricDescriptorsRequest. */ + interface IListMetricDescriptorsRequest { + + /** ListMetricDescriptorsRequest name */ + name?: (string|null); + + /** ListMetricDescriptorsRequest filter */ + filter?: (string|null); + + /** ListMetricDescriptorsRequest pageSize */ + pageSize?: (number|null); + + /** ListMetricDescriptorsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListMetricDescriptorsRequest. */ + class ListMetricDescriptorsRequest implements IListMetricDescriptorsRequest { + + /** + * Constructs a new ListMetricDescriptorsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListMetricDescriptorsRequest); + + /** ListMetricDescriptorsRequest name. */ + public name: string; + + /** ListMetricDescriptorsRequest filter. */ + public filter: string; + + /** ListMetricDescriptorsRequest pageSize. */ + public pageSize: number; + + /** ListMetricDescriptorsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListMetricDescriptorsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMetricDescriptorsRequest instance + */ + public static create(properties?: google.monitoring.v3.IListMetricDescriptorsRequest): google.monitoring.v3.ListMetricDescriptorsRequest; + + /** + * Encodes the specified ListMetricDescriptorsRequest message. Does not implicitly {@link google.monitoring.v3.ListMetricDescriptorsRequest.verify|verify} messages. + * @param message ListMetricDescriptorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListMetricDescriptorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMetricDescriptorsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListMetricDescriptorsRequest.verify|verify} messages. + * @param message ListMetricDescriptorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListMetricDescriptorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMetricDescriptorsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMetricDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListMetricDescriptorsRequest; + + /** + * Decodes a ListMetricDescriptorsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMetricDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListMetricDescriptorsRequest; + + /** + * Verifies a ListMetricDescriptorsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMetricDescriptorsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMetricDescriptorsRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListMetricDescriptorsRequest; + + /** + * Creates a plain object from a ListMetricDescriptorsRequest message. Also converts values to other types if specified. + * @param message ListMetricDescriptorsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListMetricDescriptorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMetricDescriptorsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMetricDescriptorsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMetricDescriptorsResponse. */ + interface IListMetricDescriptorsResponse { + + /** ListMetricDescriptorsResponse metricDescriptors */ + metricDescriptors?: (google.api.IMetricDescriptor[]|null); + + /** ListMetricDescriptorsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListMetricDescriptorsResponse. */ + class ListMetricDescriptorsResponse implements IListMetricDescriptorsResponse { + + /** + * Constructs a new ListMetricDescriptorsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListMetricDescriptorsResponse); + + /** ListMetricDescriptorsResponse metricDescriptors. */ + public metricDescriptors: google.api.IMetricDescriptor[]; + + /** ListMetricDescriptorsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListMetricDescriptorsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMetricDescriptorsResponse instance + */ + public static create(properties?: google.monitoring.v3.IListMetricDescriptorsResponse): google.monitoring.v3.ListMetricDescriptorsResponse; + + /** + * Encodes the specified ListMetricDescriptorsResponse message. Does not implicitly {@link google.monitoring.v3.ListMetricDescriptorsResponse.verify|verify} messages. + * @param message ListMetricDescriptorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListMetricDescriptorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMetricDescriptorsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListMetricDescriptorsResponse.verify|verify} messages. + * @param message ListMetricDescriptorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListMetricDescriptorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMetricDescriptorsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMetricDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListMetricDescriptorsResponse; + + /** + * Decodes a ListMetricDescriptorsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMetricDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListMetricDescriptorsResponse; + + /** + * Verifies a ListMetricDescriptorsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMetricDescriptorsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMetricDescriptorsResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListMetricDescriptorsResponse; + + /** + * Creates a plain object from a ListMetricDescriptorsResponse message. Also converts values to other types if specified. + * @param message ListMetricDescriptorsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListMetricDescriptorsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMetricDescriptorsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMetricDescriptorsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetMetricDescriptorRequest. */ + interface IGetMetricDescriptorRequest { + + /** GetMetricDescriptorRequest name */ + name?: (string|null); + } + + /** Represents a GetMetricDescriptorRequest. */ + class GetMetricDescriptorRequest implements IGetMetricDescriptorRequest { + + /** + * Constructs a new GetMetricDescriptorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetMetricDescriptorRequest); + + /** GetMetricDescriptorRequest name. */ + public name: string; + + /** + * Creates a new GetMetricDescriptorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetMetricDescriptorRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetMetricDescriptorRequest): google.monitoring.v3.GetMetricDescriptorRequest; + + /** + * Encodes the specified GetMetricDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.GetMetricDescriptorRequest.verify|verify} messages. + * @param message GetMetricDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetMetricDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetMetricDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetMetricDescriptorRequest.verify|verify} messages. + * @param message GetMetricDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetMetricDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetMetricDescriptorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetMetricDescriptorRequest; + + /** + * Decodes a GetMetricDescriptorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetMetricDescriptorRequest; + + /** + * Verifies a GetMetricDescriptorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetMetricDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetMetricDescriptorRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetMetricDescriptorRequest; + + /** + * Creates a plain object from a GetMetricDescriptorRequest message. Also converts values to other types if specified. + * @param message GetMetricDescriptorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetMetricDescriptorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetMetricDescriptorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetMetricDescriptorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateMetricDescriptorRequest. */ + interface ICreateMetricDescriptorRequest { + + /** CreateMetricDescriptorRequest name */ + name?: (string|null); + + /** CreateMetricDescriptorRequest metricDescriptor */ + metricDescriptor?: (google.api.IMetricDescriptor|null); + } + + /** Represents a CreateMetricDescriptorRequest. */ + class CreateMetricDescriptorRequest implements ICreateMetricDescriptorRequest { + + /** + * Constructs a new CreateMetricDescriptorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateMetricDescriptorRequest); + + /** CreateMetricDescriptorRequest name. */ + public name: string; + + /** CreateMetricDescriptorRequest metricDescriptor. */ + public metricDescriptor?: (google.api.IMetricDescriptor|null); + + /** + * Creates a new CreateMetricDescriptorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateMetricDescriptorRequest instance + */ + public static create(properties?: google.monitoring.v3.ICreateMetricDescriptorRequest): google.monitoring.v3.CreateMetricDescriptorRequest; + + /** + * Encodes the specified CreateMetricDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.CreateMetricDescriptorRequest.verify|verify} messages. + * @param message CreateMetricDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateMetricDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateMetricDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateMetricDescriptorRequest.verify|verify} messages. + * @param message CreateMetricDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateMetricDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateMetricDescriptorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateMetricDescriptorRequest; + + /** + * Decodes a CreateMetricDescriptorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateMetricDescriptorRequest; + + /** + * Verifies a CreateMetricDescriptorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateMetricDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateMetricDescriptorRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateMetricDescriptorRequest; + + /** + * Creates a plain object from a CreateMetricDescriptorRequest message. Also converts values to other types if specified. + * @param message CreateMetricDescriptorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateMetricDescriptorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateMetricDescriptorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateMetricDescriptorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteMetricDescriptorRequest. */ + interface IDeleteMetricDescriptorRequest { + + /** DeleteMetricDescriptorRequest name */ + name?: (string|null); + } + + /** Represents a DeleteMetricDescriptorRequest. */ + class DeleteMetricDescriptorRequest implements IDeleteMetricDescriptorRequest { + + /** + * Constructs a new DeleteMetricDescriptorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDeleteMetricDescriptorRequest); + + /** DeleteMetricDescriptorRequest name. */ + public name: string; + + /** + * Creates a new DeleteMetricDescriptorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteMetricDescriptorRequest instance + */ + public static create(properties?: google.monitoring.v3.IDeleteMetricDescriptorRequest): google.monitoring.v3.DeleteMetricDescriptorRequest; + + /** + * Encodes the specified DeleteMetricDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.DeleteMetricDescriptorRequest.verify|verify} messages. + * @param message DeleteMetricDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDeleteMetricDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteMetricDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteMetricDescriptorRequest.verify|verify} messages. + * @param message DeleteMetricDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDeleteMetricDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteMetricDescriptorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DeleteMetricDescriptorRequest; + + /** + * Decodes a DeleteMetricDescriptorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DeleteMetricDescriptorRequest; + + /** + * Verifies a DeleteMetricDescriptorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteMetricDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteMetricDescriptorRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DeleteMetricDescriptorRequest; + + /** + * Creates a plain object from a DeleteMetricDescriptorRequest message. Also converts values to other types if specified. + * @param message DeleteMetricDescriptorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DeleteMetricDescriptorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteMetricDescriptorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteMetricDescriptorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListTimeSeriesRequest. */ + interface IListTimeSeriesRequest { + + /** ListTimeSeriesRequest name */ + name?: (string|null); + + /** ListTimeSeriesRequest filter */ + filter?: (string|null); + + /** ListTimeSeriesRequest interval */ + interval?: (google.monitoring.v3.ITimeInterval|null); + + /** ListTimeSeriesRequest aggregation */ + aggregation?: (google.monitoring.v3.IAggregation|null); + + /** ListTimeSeriesRequest secondaryAggregation */ + secondaryAggregation?: (google.monitoring.v3.IAggregation|null); + + /** ListTimeSeriesRequest orderBy */ + orderBy?: (string|null); + + /** ListTimeSeriesRequest view */ + view?: (google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView|keyof typeof google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView|null); + + /** ListTimeSeriesRequest pageSize */ + pageSize?: (number|null); + + /** ListTimeSeriesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListTimeSeriesRequest. */ + class ListTimeSeriesRequest implements IListTimeSeriesRequest { + + /** + * Constructs a new ListTimeSeriesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListTimeSeriesRequest); + + /** ListTimeSeriesRequest name. */ + public name: string; + + /** ListTimeSeriesRequest filter. */ + public filter: string; + + /** ListTimeSeriesRequest interval. */ + public interval?: (google.monitoring.v3.ITimeInterval|null); + + /** ListTimeSeriesRequest aggregation. */ + public aggregation?: (google.monitoring.v3.IAggregation|null); + + /** ListTimeSeriesRequest secondaryAggregation. */ + public secondaryAggregation?: (google.monitoring.v3.IAggregation|null); + + /** ListTimeSeriesRequest orderBy. */ + public orderBy: string; + + /** ListTimeSeriesRequest view. */ + public view: (google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView|keyof typeof google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView); + + /** ListTimeSeriesRequest pageSize. */ + public pageSize: number; + + /** ListTimeSeriesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListTimeSeriesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListTimeSeriesRequest instance + */ + public static create(properties?: google.monitoring.v3.IListTimeSeriesRequest): google.monitoring.v3.ListTimeSeriesRequest; + + /** + * Encodes the specified ListTimeSeriesRequest message. Does not implicitly {@link google.monitoring.v3.ListTimeSeriesRequest.verify|verify} messages. + * @param message ListTimeSeriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListTimeSeriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListTimeSeriesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListTimeSeriesRequest.verify|verify} messages. + * @param message ListTimeSeriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListTimeSeriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListTimeSeriesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListTimeSeriesRequest; + + /** + * Decodes a ListTimeSeriesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListTimeSeriesRequest; + + /** + * Verifies a ListTimeSeriesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListTimeSeriesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListTimeSeriesRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListTimeSeriesRequest; + + /** + * Creates a plain object from a ListTimeSeriesRequest message. Also converts values to other types if specified. + * @param message ListTimeSeriesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListTimeSeriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListTimeSeriesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListTimeSeriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ListTimeSeriesRequest { + + /** TimeSeriesView enum. */ + enum TimeSeriesView { + FULL = 0, + HEADERS = 1 + } + } + + /** Properties of a ListTimeSeriesResponse. */ + interface IListTimeSeriesResponse { + + /** ListTimeSeriesResponse timeSeries */ + timeSeries?: (google.monitoring.v3.ITimeSeries[]|null); + + /** ListTimeSeriesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListTimeSeriesResponse executionErrors */ + executionErrors?: (google.rpc.IStatus[]|null); + + /** ListTimeSeriesResponse unit */ + unit?: (string|null); + } + + /** Represents a ListTimeSeriesResponse. */ + class ListTimeSeriesResponse implements IListTimeSeriesResponse { + + /** + * Constructs a new ListTimeSeriesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListTimeSeriesResponse); + + /** ListTimeSeriesResponse timeSeries. */ + public timeSeries: google.monitoring.v3.ITimeSeries[]; + + /** ListTimeSeriesResponse nextPageToken. */ + public nextPageToken: string; + + /** ListTimeSeriesResponse executionErrors. */ + public executionErrors: google.rpc.IStatus[]; + + /** ListTimeSeriesResponse unit. */ + public unit: string; + + /** + * Creates a new ListTimeSeriesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListTimeSeriesResponse instance + */ + public static create(properties?: google.monitoring.v3.IListTimeSeriesResponse): google.monitoring.v3.ListTimeSeriesResponse; + + /** + * Encodes the specified ListTimeSeriesResponse message. Does not implicitly {@link google.monitoring.v3.ListTimeSeriesResponse.verify|verify} messages. + * @param message ListTimeSeriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListTimeSeriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListTimeSeriesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListTimeSeriesResponse.verify|verify} messages. + * @param message ListTimeSeriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListTimeSeriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListTimeSeriesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListTimeSeriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListTimeSeriesResponse; + + /** + * Decodes a ListTimeSeriesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListTimeSeriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListTimeSeriesResponse; + + /** + * Verifies a ListTimeSeriesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListTimeSeriesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListTimeSeriesResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListTimeSeriesResponse; + + /** + * Creates a plain object from a ListTimeSeriesResponse message. Also converts values to other types if specified. + * @param message ListTimeSeriesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListTimeSeriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListTimeSeriesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListTimeSeriesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateTimeSeriesRequest. */ + interface ICreateTimeSeriesRequest { + + /** CreateTimeSeriesRequest name */ + name?: (string|null); + + /** CreateTimeSeriesRequest timeSeries */ + timeSeries?: (google.monitoring.v3.ITimeSeries[]|null); + } + + /** Represents a CreateTimeSeriesRequest. */ + class CreateTimeSeriesRequest implements ICreateTimeSeriesRequest { + + /** + * Constructs a new CreateTimeSeriesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateTimeSeriesRequest); + + /** CreateTimeSeriesRequest name. */ + public name: string; + + /** CreateTimeSeriesRequest timeSeries. */ + public timeSeries: google.monitoring.v3.ITimeSeries[]; + + /** + * Creates a new CreateTimeSeriesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateTimeSeriesRequest instance + */ + public static create(properties?: google.monitoring.v3.ICreateTimeSeriesRequest): google.monitoring.v3.CreateTimeSeriesRequest; + + /** + * Encodes the specified CreateTimeSeriesRequest message. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesRequest.verify|verify} messages. + * @param message CreateTimeSeriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateTimeSeriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateTimeSeriesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesRequest.verify|verify} messages. + * @param message CreateTimeSeriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateTimeSeriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateTimeSeriesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateTimeSeriesRequest; + + /** + * Decodes a CreateTimeSeriesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateTimeSeriesRequest; + + /** + * Verifies a CreateTimeSeriesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateTimeSeriesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateTimeSeriesRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateTimeSeriesRequest; + + /** + * Creates a plain object from a CreateTimeSeriesRequest message. Also converts values to other types if specified. + * @param message CreateTimeSeriesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateTimeSeriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateTimeSeriesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateTimeSeriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateTimeSeriesError. */ + interface ICreateTimeSeriesError { + + /** CreateTimeSeriesError timeSeries */ + timeSeries?: (google.monitoring.v3.ITimeSeries|null); + + /** CreateTimeSeriesError status */ + status?: (google.rpc.IStatus|null); + } + + /** Represents a CreateTimeSeriesError. */ + class CreateTimeSeriesError implements ICreateTimeSeriesError { + + /** + * Constructs a new CreateTimeSeriesError. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateTimeSeriesError); + + /** CreateTimeSeriesError timeSeries. */ + public timeSeries?: (google.monitoring.v3.ITimeSeries|null); + + /** CreateTimeSeriesError status. */ + public status?: (google.rpc.IStatus|null); + + /** + * Creates a new CreateTimeSeriesError instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateTimeSeriesError instance + */ + public static create(properties?: google.monitoring.v3.ICreateTimeSeriesError): google.monitoring.v3.CreateTimeSeriesError; + + /** + * Encodes the specified CreateTimeSeriesError message. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesError.verify|verify} messages. + * @param message CreateTimeSeriesError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateTimeSeriesError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateTimeSeriesError message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesError.verify|verify} messages. + * @param message CreateTimeSeriesError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateTimeSeriesError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateTimeSeriesError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateTimeSeriesError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateTimeSeriesError; + + /** + * Decodes a CreateTimeSeriesError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateTimeSeriesError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateTimeSeriesError; + + /** + * Verifies a CreateTimeSeriesError message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateTimeSeriesError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateTimeSeriesError + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateTimeSeriesError; + + /** + * Creates a plain object from a CreateTimeSeriesError message. Also converts values to other types if specified. + * @param message CreateTimeSeriesError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateTimeSeriesError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateTimeSeriesError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateTimeSeriesError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateTimeSeriesSummary. */ + interface ICreateTimeSeriesSummary { + + /** CreateTimeSeriesSummary totalPointCount */ + totalPointCount?: (number|null); + + /** CreateTimeSeriesSummary successPointCount */ + successPointCount?: (number|null); + + /** CreateTimeSeriesSummary errors */ + errors?: (google.monitoring.v3.CreateTimeSeriesSummary.IError[]|null); + } + + /** Represents a CreateTimeSeriesSummary. */ + class CreateTimeSeriesSummary implements ICreateTimeSeriesSummary { + + /** + * Constructs a new CreateTimeSeriesSummary. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateTimeSeriesSummary); + + /** CreateTimeSeriesSummary totalPointCount. */ + public totalPointCount: number; + + /** CreateTimeSeriesSummary successPointCount. */ + public successPointCount: number; + + /** CreateTimeSeriesSummary errors. */ + public errors: google.monitoring.v3.CreateTimeSeriesSummary.IError[]; + + /** + * Creates a new CreateTimeSeriesSummary instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateTimeSeriesSummary instance + */ + public static create(properties?: google.monitoring.v3.ICreateTimeSeriesSummary): google.monitoring.v3.CreateTimeSeriesSummary; + + /** + * Encodes the specified CreateTimeSeriesSummary message. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesSummary.verify|verify} messages. + * @param message CreateTimeSeriesSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateTimeSeriesSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateTimeSeriesSummary message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesSummary.verify|verify} messages. + * @param message CreateTimeSeriesSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateTimeSeriesSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateTimeSeriesSummary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateTimeSeriesSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateTimeSeriesSummary; + + /** + * Decodes a CreateTimeSeriesSummary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateTimeSeriesSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateTimeSeriesSummary; + + /** + * Verifies a CreateTimeSeriesSummary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateTimeSeriesSummary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateTimeSeriesSummary + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateTimeSeriesSummary; + + /** + * Creates a plain object from a CreateTimeSeriesSummary message. Also converts values to other types if specified. + * @param message CreateTimeSeriesSummary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateTimeSeriesSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateTimeSeriesSummary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateTimeSeriesSummary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CreateTimeSeriesSummary { + + /** Properties of an Error. */ + interface IError { + + /** Error status */ + status?: (google.rpc.IStatus|null); + + /** Error pointCount */ + pointCount?: (number|null); + } + + /** Represents an Error. */ + class Error implements IError { + + /** + * Constructs a new Error. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.CreateTimeSeriesSummary.IError); + + /** Error status. */ + public status?: (google.rpc.IStatus|null); + + /** Error pointCount. */ + public pointCount: number; + + /** + * Creates a new Error instance using the specified properties. + * @param [properties] Properties to set + * @returns Error instance + */ + public static create(properties?: google.monitoring.v3.CreateTimeSeriesSummary.IError): google.monitoring.v3.CreateTimeSeriesSummary.Error; + + /** + * Encodes the specified Error message. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesSummary.Error.verify|verify} messages. + * @param message Error message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.CreateTimeSeriesSummary.IError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Error message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesSummary.Error.verify|verify} messages. + * @param message Error message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.CreateTimeSeriesSummary.IError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Error message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Error + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateTimeSeriesSummary.Error; + + /** + * Decodes an Error message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Error + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateTimeSeriesSummary.Error; + + /** + * Verifies an Error message. + * @param message Plain 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 Error message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Error + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateTimeSeriesSummary.Error; + + /** + * Creates a plain object from an Error message. Also converts values to other types if specified. + * @param message Error + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateTimeSeriesSummary.Error, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Error to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Error + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a QueryTimeSeriesRequest. */ + interface IQueryTimeSeriesRequest { + + /** QueryTimeSeriesRequest name */ + name?: (string|null); + + /** QueryTimeSeriesRequest query */ + query?: (string|null); + + /** QueryTimeSeriesRequest pageSize */ + pageSize?: (number|null); + + /** QueryTimeSeriesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a QueryTimeSeriesRequest. */ + class QueryTimeSeriesRequest implements IQueryTimeSeriesRequest { + + /** + * Constructs a new QueryTimeSeriesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IQueryTimeSeriesRequest); + + /** QueryTimeSeriesRequest name. */ + public name: string; + + /** QueryTimeSeriesRequest query. */ + public query: string; + + /** QueryTimeSeriesRequest pageSize. */ + public pageSize: number; + + /** QueryTimeSeriesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new QueryTimeSeriesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTimeSeriesRequest instance + */ + public static create(properties?: google.monitoring.v3.IQueryTimeSeriesRequest): google.monitoring.v3.QueryTimeSeriesRequest; + + /** + * Encodes the specified QueryTimeSeriesRequest message. Does not implicitly {@link google.monitoring.v3.QueryTimeSeriesRequest.verify|verify} messages. + * @param message QueryTimeSeriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IQueryTimeSeriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryTimeSeriesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.QueryTimeSeriesRequest.verify|verify} messages. + * @param message QueryTimeSeriesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IQueryTimeSeriesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryTimeSeriesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.QueryTimeSeriesRequest; + + /** + * Decodes a QueryTimeSeriesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.QueryTimeSeriesRequest; + + /** + * Verifies a QueryTimeSeriesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryTimeSeriesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTimeSeriesRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.QueryTimeSeriesRequest; + + /** + * Creates a plain object from a QueryTimeSeriesRequest message. Also converts values to other types if specified. + * @param message QueryTimeSeriesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.QueryTimeSeriesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryTimeSeriesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryTimeSeriesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryTimeSeriesResponse. */ + interface IQueryTimeSeriesResponse { + + /** QueryTimeSeriesResponse timeSeriesDescriptor */ + timeSeriesDescriptor?: (google.monitoring.v3.ITimeSeriesDescriptor|null); + + /** QueryTimeSeriesResponse timeSeriesData */ + timeSeriesData?: (google.monitoring.v3.ITimeSeriesData[]|null); + + /** QueryTimeSeriesResponse nextPageToken */ + nextPageToken?: (string|null); + + /** QueryTimeSeriesResponse partialErrors */ + partialErrors?: (google.rpc.IStatus[]|null); + } + + /** Represents a QueryTimeSeriesResponse. */ + class QueryTimeSeriesResponse implements IQueryTimeSeriesResponse { + + /** + * Constructs a new QueryTimeSeriesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IQueryTimeSeriesResponse); + + /** QueryTimeSeriesResponse timeSeriesDescriptor. */ + public timeSeriesDescriptor?: (google.monitoring.v3.ITimeSeriesDescriptor|null); + + /** QueryTimeSeriesResponse timeSeriesData. */ + public timeSeriesData: google.monitoring.v3.ITimeSeriesData[]; + + /** QueryTimeSeriesResponse nextPageToken. */ + public nextPageToken: string; + + /** QueryTimeSeriesResponse partialErrors. */ + public partialErrors: google.rpc.IStatus[]; + + /** + * Creates a new QueryTimeSeriesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryTimeSeriesResponse instance + */ + public static create(properties?: google.monitoring.v3.IQueryTimeSeriesResponse): google.monitoring.v3.QueryTimeSeriesResponse; + + /** + * Encodes the specified QueryTimeSeriesResponse message. Does not implicitly {@link google.monitoring.v3.QueryTimeSeriesResponse.verify|verify} messages. + * @param message QueryTimeSeriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IQueryTimeSeriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryTimeSeriesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.QueryTimeSeriesResponse.verify|verify} messages. + * @param message QueryTimeSeriesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IQueryTimeSeriesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryTimeSeriesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryTimeSeriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.QueryTimeSeriesResponse; + + /** + * Decodes a QueryTimeSeriesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryTimeSeriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.QueryTimeSeriesResponse; + + /** + * Verifies a QueryTimeSeriesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryTimeSeriesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryTimeSeriesResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.QueryTimeSeriesResponse; + + /** + * Creates a plain object from a QueryTimeSeriesResponse message. Also converts values to other types if specified. + * @param message QueryTimeSeriesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.QueryTimeSeriesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryTimeSeriesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryTimeSeriesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryErrorList. */ + interface IQueryErrorList { + + /** QueryErrorList errors */ + errors?: (google.monitoring.v3.IQueryError[]|null); + + /** QueryErrorList errorSummary */ + errorSummary?: (string|null); + } + + /** Represents a QueryErrorList. */ + class QueryErrorList implements IQueryErrorList { + + /** + * Constructs a new QueryErrorList. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IQueryErrorList); + + /** QueryErrorList errors. */ + public errors: google.monitoring.v3.IQueryError[]; + + /** QueryErrorList errorSummary. */ + public errorSummary: string; + + /** + * Creates a new QueryErrorList instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryErrorList instance + */ + public static create(properties?: google.monitoring.v3.IQueryErrorList): google.monitoring.v3.QueryErrorList; + + /** + * Encodes the specified QueryErrorList message. Does not implicitly {@link google.monitoring.v3.QueryErrorList.verify|verify} messages. + * @param message QueryErrorList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IQueryErrorList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryErrorList message, length delimited. Does not implicitly {@link google.monitoring.v3.QueryErrorList.verify|verify} messages. + * @param message QueryErrorList message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IQueryErrorList, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryErrorList message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryErrorList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.QueryErrorList; + + /** + * Decodes a QueryErrorList message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryErrorList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.QueryErrorList; + + /** + * Verifies a QueryErrorList message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryErrorList message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryErrorList + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.QueryErrorList; + + /** + * Creates a plain object from a QueryErrorList message. Also converts values to other types if specified. + * @param message QueryErrorList + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.QueryErrorList, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryErrorList to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryErrorList + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a NotificationChannelDescriptor. */ + interface INotificationChannelDescriptor { + + /** NotificationChannelDescriptor name */ + name?: (string|null); + + /** NotificationChannelDescriptor type */ + type?: (string|null); + + /** NotificationChannelDescriptor displayName */ + displayName?: (string|null); + + /** NotificationChannelDescriptor description */ + description?: (string|null); + + /** NotificationChannelDescriptor labels */ + labels?: (google.api.ILabelDescriptor[]|null); + + /** NotificationChannelDescriptor supportedTiers */ + supportedTiers?: (google.monitoring.v3.ServiceTier[]|null); + + /** NotificationChannelDescriptor launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); + } + + /** Represents a NotificationChannelDescriptor. */ + class NotificationChannelDescriptor implements INotificationChannelDescriptor { + + /** + * Constructs a new NotificationChannelDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.INotificationChannelDescriptor); + + /** NotificationChannelDescriptor name. */ + public name: string; + + /** NotificationChannelDescriptor type. */ + public type: string; + + /** NotificationChannelDescriptor displayName. */ + public displayName: string; + + /** NotificationChannelDescriptor description. */ + public description: string; + + /** NotificationChannelDescriptor labels. */ + public labels: google.api.ILabelDescriptor[]; + + /** NotificationChannelDescriptor supportedTiers. */ + public supportedTiers: google.monitoring.v3.ServiceTier[]; + + /** NotificationChannelDescriptor launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); + + /** + * Creates a new NotificationChannelDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns NotificationChannelDescriptor instance + */ + public static create(properties?: google.monitoring.v3.INotificationChannelDescriptor): google.monitoring.v3.NotificationChannelDescriptor; + + /** + * Encodes the specified NotificationChannelDescriptor message. Does not implicitly {@link google.monitoring.v3.NotificationChannelDescriptor.verify|verify} messages. + * @param message NotificationChannelDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.INotificationChannelDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NotificationChannelDescriptor message, length delimited. Does not implicitly {@link google.monitoring.v3.NotificationChannelDescriptor.verify|verify} messages. + * @param message NotificationChannelDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.INotificationChannelDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NotificationChannelDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NotificationChannelDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.NotificationChannelDescriptor; + + /** + * Decodes a NotificationChannelDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NotificationChannelDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.NotificationChannelDescriptor; + + /** + * Verifies a NotificationChannelDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NotificationChannelDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NotificationChannelDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.NotificationChannelDescriptor; + + /** + * Creates a plain object from a NotificationChannelDescriptor message. Also converts values to other types if specified. + * @param message NotificationChannelDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.NotificationChannelDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NotificationChannelDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NotificationChannelDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a NotificationChannel. */ + interface INotificationChannel { + + /** NotificationChannel type */ + type?: (string|null); + + /** NotificationChannel name */ + name?: (string|null); + + /** NotificationChannel displayName */ + displayName?: (string|null); + + /** NotificationChannel description */ + description?: (string|null); + + /** NotificationChannel labels */ + labels?: ({ [k: string]: string }|null); + + /** NotificationChannel userLabels */ + userLabels?: ({ [k: string]: string }|null); + + /** NotificationChannel verificationStatus */ + verificationStatus?: (google.monitoring.v3.NotificationChannel.VerificationStatus|keyof typeof google.monitoring.v3.NotificationChannel.VerificationStatus|null); + + /** NotificationChannel enabled */ + enabled?: (google.protobuf.IBoolValue|null); + + /** NotificationChannel creationRecord */ + creationRecord?: (google.monitoring.v3.IMutationRecord|null); + + /** NotificationChannel mutationRecords */ + mutationRecords?: (google.monitoring.v3.IMutationRecord[]|null); + } + + /** Represents a NotificationChannel. */ + class NotificationChannel implements INotificationChannel { + + /** + * Constructs a new NotificationChannel. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.INotificationChannel); + + /** NotificationChannel type. */ + public type: string; + + /** NotificationChannel name. */ + public name: string; + + /** NotificationChannel displayName. */ + public displayName: string; + + /** NotificationChannel description. */ + public description: string; + + /** NotificationChannel labels. */ + public labels: { [k: string]: string }; + + /** NotificationChannel userLabels. */ + public userLabels: { [k: string]: string }; + + /** NotificationChannel verificationStatus. */ + public verificationStatus: (google.monitoring.v3.NotificationChannel.VerificationStatus|keyof typeof google.monitoring.v3.NotificationChannel.VerificationStatus); + + /** NotificationChannel enabled. */ + public enabled?: (google.protobuf.IBoolValue|null); + + /** NotificationChannel creationRecord. */ + public creationRecord?: (google.monitoring.v3.IMutationRecord|null); + + /** NotificationChannel mutationRecords. */ + public mutationRecords: google.monitoring.v3.IMutationRecord[]; + + /** + * Creates a new NotificationChannel instance using the specified properties. + * @param [properties] Properties to set + * @returns NotificationChannel instance + */ + public static create(properties?: google.monitoring.v3.INotificationChannel): google.monitoring.v3.NotificationChannel; + + /** + * Encodes the specified NotificationChannel message. Does not implicitly {@link google.monitoring.v3.NotificationChannel.verify|verify} messages. + * @param message NotificationChannel message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.INotificationChannel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NotificationChannel message, length delimited. Does not implicitly {@link google.monitoring.v3.NotificationChannel.verify|verify} messages. + * @param message NotificationChannel message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.INotificationChannel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NotificationChannel message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NotificationChannel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.NotificationChannel; + + /** + * Decodes a NotificationChannel message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NotificationChannel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.NotificationChannel; + + /** + * Verifies a NotificationChannel message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NotificationChannel message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NotificationChannel + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.NotificationChannel; + + /** + * Creates a plain object from a NotificationChannel message. Also converts values to other types if specified. + * @param message NotificationChannel + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.NotificationChannel, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NotificationChannel to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NotificationChannel + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace NotificationChannel { + + /** VerificationStatus enum. */ + enum VerificationStatus { + VERIFICATION_STATUS_UNSPECIFIED = 0, + UNVERIFIED = 1, + VERIFIED = 2 + } + } + + /** Represents a NotificationChannelService */ + class NotificationChannelService extends $protobuf.rpc.Service { + + /** + * Constructs a new NotificationChannelService 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 NotificationChannelService 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): NotificationChannelService; + + /** + * Calls ListNotificationChannelDescriptors. + * @param request ListNotificationChannelDescriptorsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListNotificationChannelDescriptorsResponse + */ + public listNotificationChannelDescriptors(request: google.monitoring.v3.IListNotificationChannelDescriptorsRequest, callback: google.monitoring.v3.NotificationChannelService.ListNotificationChannelDescriptorsCallback): void; + + /** + * Calls ListNotificationChannelDescriptors. + * @param request ListNotificationChannelDescriptorsRequest message or plain object + * @returns Promise + */ + public listNotificationChannelDescriptors(request: google.monitoring.v3.IListNotificationChannelDescriptorsRequest): Promise; + + /** + * Calls GetNotificationChannelDescriptor. + * @param request GetNotificationChannelDescriptorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and NotificationChannelDescriptor + */ + public getNotificationChannelDescriptor(request: google.monitoring.v3.IGetNotificationChannelDescriptorRequest, callback: google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptorCallback): void; + + /** + * Calls GetNotificationChannelDescriptor. + * @param request GetNotificationChannelDescriptorRequest message or plain object + * @returns Promise + */ + public getNotificationChannelDescriptor(request: google.monitoring.v3.IGetNotificationChannelDescriptorRequest): Promise; + + /** + * Calls ListNotificationChannels. + * @param request ListNotificationChannelsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListNotificationChannelsResponse + */ + public listNotificationChannels(request: google.monitoring.v3.IListNotificationChannelsRequest, callback: google.monitoring.v3.NotificationChannelService.ListNotificationChannelsCallback): void; + + /** + * Calls ListNotificationChannels. + * @param request ListNotificationChannelsRequest message or plain object + * @returns Promise + */ + public listNotificationChannels(request: google.monitoring.v3.IListNotificationChannelsRequest): Promise; + + /** + * Calls GetNotificationChannel. + * @param request GetNotificationChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and NotificationChannel + */ + public getNotificationChannel(request: google.monitoring.v3.IGetNotificationChannelRequest, callback: google.monitoring.v3.NotificationChannelService.GetNotificationChannelCallback): void; + + /** + * Calls GetNotificationChannel. + * @param request GetNotificationChannelRequest message or plain object + * @returns Promise + */ + public getNotificationChannel(request: google.monitoring.v3.IGetNotificationChannelRequest): Promise; + + /** + * Calls CreateNotificationChannel. + * @param request CreateNotificationChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and NotificationChannel + */ + public createNotificationChannel(request: google.monitoring.v3.ICreateNotificationChannelRequest, callback: google.monitoring.v3.NotificationChannelService.CreateNotificationChannelCallback): void; + + /** + * Calls CreateNotificationChannel. + * @param request CreateNotificationChannelRequest message or plain object + * @returns Promise + */ + public createNotificationChannel(request: google.monitoring.v3.ICreateNotificationChannelRequest): Promise; + + /** + * Calls UpdateNotificationChannel. + * @param request UpdateNotificationChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and NotificationChannel + */ + public updateNotificationChannel(request: google.monitoring.v3.IUpdateNotificationChannelRequest, callback: google.monitoring.v3.NotificationChannelService.UpdateNotificationChannelCallback): void; + + /** + * Calls UpdateNotificationChannel. + * @param request UpdateNotificationChannelRequest message or plain object + * @returns Promise + */ + public updateNotificationChannel(request: google.monitoring.v3.IUpdateNotificationChannelRequest): Promise; + + /** + * Calls DeleteNotificationChannel. + * @param request DeleteNotificationChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteNotificationChannel(request: google.monitoring.v3.IDeleteNotificationChannelRequest, callback: google.monitoring.v3.NotificationChannelService.DeleteNotificationChannelCallback): void; + + /** + * Calls DeleteNotificationChannel. + * @param request DeleteNotificationChannelRequest message or plain object + * @returns Promise + */ + public deleteNotificationChannel(request: google.monitoring.v3.IDeleteNotificationChannelRequest): Promise; + + /** + * Calls SendNotificationChannelVerificationCode. + * @param request SendNotificationChannelVerificationCodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public sendNotificationChannelVerificationCode(request: google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, callback: google.monitoring.v3.NotificationChannelService.SendNotificationChannelVerificationCodeCallback): void; + + /** + * Calls SendNotificationChannelVerificationCode. + * @param request SendNotificationChannelVerificationCodeRequest message or plain object + * @returns Promise + */ + public sendNotificationChannelVerificationCode(request: google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest): Promise; + + /** + * Calls GetNotificationChannelVerificationCode. + * @param request GetNotificationChannelVerificationCodeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GetNotificationChannelVerificationCodeResponse + */ + public getNotificationChannelVerificationCode(request: google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, callback: google.monitoring.v3.NotificationChannelService.GetNotificationChannelVerificationCodeCallback): void; + + /** + * Calls GetNotificationChannelVerificationCode. + * @param request GetNotificationChannelVerificationCodeRequest message or plain object + * @returns Promise + */ + public getNotificationChannelVerificationCode(request: google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest): Promise; + + /** + * Calls VerifyNotificationChannel. + * @param request VerifyNotificationChannelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and NotificationChannel + */ + public verifyNotificationChannel(request: google.monitoring.v3.IVerifyNotificationChannelRequest, callback: google.monitoring.v3.NotificationChannelService.VerifyNotificationChannelCallback): void; + + /** + * Calls VerifyNotificationChannel. + * @param request VerifyNotificationChannelRequest message or plain object + * @returns Promise + */ + public verifyNotificationChannel(request: google.monitoring.v3.IVerifyNotificationChannelRequest): Promise; + } + + namespace NotificationChannelService { + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|listNotificationChannelDescriptors}. + * @param error Error, if any + * @param [response] ListNotificationChannelDescriptorsResponse + */ + type ListNotificationChannelDescriptorsCallback = (error: (Error|null), response?: google.monitoring.v3.ListNotificationChannelDescriptorsResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|getNotificationChannelDescriptor}. + * @param error Error, if any + * @param [response] NotificationChannelDescriptor + */ + type GetNotificationChannelDescriptorCallback = (error: (Error|null), response?: google.monitoring.v3.NotificationChannelDescriptor) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|listNotificationChannels}. + * @param error Error, if any + * @param [response] ListNotificationChannelsResponse + */ + type ListNotificationChannelsCallback = (error: (Error|null), response?: google.monitoring.v3.ListNotificationChannelsResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|getNotificationChannel}. + * @param error Error, if any + * @param [response] NotificationChannel + */ + type GetNotificationChannelCallback = (error: (Error|null), response?: google.monitoring.v3.NotificationChannel) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|createNotificationChannel}. + * @param error Error, if any + * @param [response] NotificationChannel + */ + type CreateNotificationChannelCallback = (error: (Error|null), response?: google.monitoring.v3.NotificationChannel) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|updateNotificationChannel}. + * @param error Error, if any + * @param [response] NotificationChannel + */ + type UpdateNotificationChannelCallback = (error: (Error|null), response?: google.monitoring.v3.NotificationChannel) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|deleteNotificationChannel}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteNotificationChannelCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|sendNotificationChannelVerificationCode}. + * @param error Error, if any + * @param [response] Empty + */ + type SendNotificationChannelVerificationCodeCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|getNotificationChannelVerificationCode}. + * @param error Error, if any + * @param [response] GetNotificationChannelVerificationCodeResponse + */ + type GetNotificationChannelVerificationCodeCallback = (error: (Error|null), response?: google.monitoring.v3.GetNotificationChannelVerificationCodeResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|verifyNotificationChannel}. + * @param error Error, if any + * @param [response] NotificationChannel + */ + type VerifyNotificationChannelCallback = (error: (Error|null), response?: google.monitoring.v3.NotificationChannel) => void; + } + + /** Properties of a ListNotificationChannelDescriptorsRequest. */ + interface IListNotificationChannelDescriptorsRequest { + + /** ListNotificationChannelDescriptorsRequest name */ + name?: (string|null); + + /** ListNotificationChannelDescriptorsRequest pageSize */ + pageSize?: (number|null); + + /** ListNotificationChannelDescriptorsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListNotificationChannelDescriptorsRequest. */ + class ListNotificationChannelDescriptorsRequest implements IListNotificationChannelDescriptorsRequest { + + /** + * Constructs a new ListNotificationChannelDescriptorsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListNotificationChannelDescriptorsRequest); + + /** ListNotificationChannelDescriptorsRequest name. */ + public name: string; + + /** ListNotificationChannelDescriptorsRequest pageSize. */ + public pageSize: number; + + /** ListNotificationChannelDescriptorsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListNotificationChannelDescriptorsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListNotificationChannelDescriptorsRequest instance + */ + public static create(properties?: google.monitoring.v3.IListNotificationChannelDescriptorsRequest): google.monitoring.v3.ListNotificationChannelDescriptorsRequest; + + /** + * Encodes the specified ListNotificationChannelDescriptorsRequest message. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelDescriptorsRequest.verify|verify} messages. + * @param message ListNotificationChannelDescriptorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListNotificationChannelDescriptorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListNotificationChannelDescriptorsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelDescriptorsRequest.verify|verify} messages. + * @param message ListNotificationChannelDescriptorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListNotificationChannelDescriptorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListNotificationChannelDescriptorsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListNotificationChannelDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListNotificationChannelDescriptorsRequest; + + /** + * Decodes a ListNotificationChannelDescriptorsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListNotificationChannelDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListNotificationChannelDescriptorsRequest; + + /** + * Verifies a ListNotificationChannelDescriptorsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListNotificationChannelDescriptorsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListNotificationChannelDescriptorsRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListNotificationChannelDescriptorsRequest; + + /** + * Creates a plain object from a ListNotificationChannelDescriptorsRequest message. Also converts values to other types if specified. + * @param message ListNotificationChannelDescriptorsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListNotificationChannelDescriptorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListNotificationChannelDescriptorsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListNotificationChannelDescriptorsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListNotificationChannelDescriptorsResponse. */ + interface IListNotificationChannelDescriptorsResponse { + + /** ListNotificationChannelDescriptorsResponse channelDescriptors */ + channelDescriptors?: (google.monitoring.v3.INotificationChannelDescriptor[]|null); + + /** ListNotificationChannelDescriptorsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListNotificationChannelDescriptorsResponse. */ + class ListNotificationChannelDescriptorsResponse implements IListNotificationChannelDescriptorsResponse { + + /** + * Constructs a new ListNotificationChannelDescriptorsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListNotificationChannelDescriptorsResponse); + + /** ListNotificationChannelDescriptorsResponse channelDescriptors. */ + public channelDescriptors: google.monitoring.v3.INotificationChannelDescriptor[]; + + /** ListNotificationChannelDescriptorsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListNotificationChannelDescriptorsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListNotificationChannelDescriptorsResponse instance + */ + public static create(properties?: google.monitoring.v3.IListNotificationChannelDescriptorsResponse): google.monitoring.v3.ListNotificationChannelDescriptorsResponse; + + /** + * Encodes the specified ListNotificationChannelDescriptorsResponse message. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelDescriptorsResponse.verify|verify} messages. + * @param message ListNotificationChannelDescriptorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListNotificationChannelDescriptorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListNotificationChannelDescriptorsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelDescriptorsResponse.verify|verify} messages. + * @param message ListNotificationChannelDescriptorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListNotificationChannelDescriptorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListNotificationChannelDescriptorsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListNotificationChannelDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListNotificationChannelDescriptorsResponse; + + /** + * Decodes a ListNotificationChannelDescriptorsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListNotificationChannelDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListNotificationChannelDescriptorsResponse; + + /** + * Verifies a ListNotificationChannelDescriptorsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListNotificationChannelDescriptorsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListNotificationChannelDescriptorsResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListNotificationChannelDescriptorsResponse; + + /** + * Creates a plain object from a ListNotificationChannelDescriptorsResponse message. Also converts values to other types if specified. + * @param message ListNotificationChannelDescriptorsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListNotificationChannelDescriptorsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListNotificationChannelDescriptorsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListNotificationChannelDescriptorsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetNotificationChannelDescriptorRequest. */ + interface IGetNotificationChannelDescriptorRequest { + + /** GetNotificationChannelDescriptorRequest name */ + name?: (string|null); + } + + /** Represents a GetNotificationChannelDescriptorRequest. */ + class GetNotificationChannelDescriptorRequest implements IGetNotificationChannelDescriptorRequest { + + /** + * Constructs a new GetNotificationChannelDescriptorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetNotificationChannelDescriptorRequest); + + /** GetNotificationChannelDescriptorRequest name. */ + public name: string; + + /** + * Creates a new GetNotificationChannelDescriptorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetNotificationChannelDescriptorRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetNotificationChannelDescriptorRequest): google.monitoring.v3.GetNotificationChannelDescriptorRequest; + + /** + * Encodes the specified GetNotificationChannelDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelDescriptorRequest.verify|verify} messages. + * @param message GetNotificationChannelDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetNotificationChannelDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetNotificationChannelDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelDescriptorRequest.verify|verify} messages. + * @param message GetNotificationChannelDescriptorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetNotificationChannelDescriptorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetNotificationChannelDescriptorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetNotificationChannelDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetNotificationChannelDescriptorRequest; + + /** + * Decodes a GetNotificationChannelDescriptorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetNotificationChannelDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetNotificationChannelDescriptorRequest; + + /** + * Verifies a GetNotificationChannelDescriptorRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetNotificationChannelDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetNotificationChannelDescriptorRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetNotificationChannelDescriptorRequest; + + /** + * Creates a plain object from a GetNotificationChannelDescriptorRequest message. Also converts values to other types if specified. + * @param message GetNotificationChannelDescriptorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetNotificationChannelDescriptorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetNotificationChannelDescriptorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetNotificationChannelDescriptorRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateNotificationChannelRequest. */ + interface ICreateNotificationChannelRequest { + + /** CreateNotificationChannelRequest name */ + name?: (string|null); + + /** CreateNotificationChannelRequest notificationChannel */ + notificationChannel?: (google.monitoring.v3.INotificationChannel|null); + } + + /** Represents a CreateNotificationChannelRequest. */ + class CreateNotificationChannelRequest implements ICreateNotificationChannelRequest { + + /** + * Constructs a new CreateNotificationChannelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateNotificationChannelRequest); + + /** CreateNotificationChannelRequest name. */ + public name: string; + + /** CreateNotificationChannelRequest notificationChannel. */ + public notificationChannel?: (google.monitoring.v3.INotificationChannel|null); + + /** + * Creates a new CreateNotificationChannelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateNotificationChannelRequest instance + */ + public static create(properties?: google.monitoring.v3.ICreateNotificationChannelRequest): google.monitoring.v3.CreateNotificationChannelRequest; + + /** + * Encodes the specified CreateNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.CreateNotificationChannelRequest.verify|verify} messages. + * @param message CreateNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateNotificationChannelRequest.verify|verify} messages. + * @param message CreateNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateNotificationChannelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateNotificationChannelRequest; + + /** + * Decodes a CreateNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateNotificationChannelRequest; + + /** + * Verifies a CreateNotificationChannelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateNotificationChannelRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateNotificationChannelRequest; + + /** + * Creates a plain object from a CreateNotificationChannelRequest message. Also converts values to other types if specified. + * @param message CreateNotificationChannelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateNotificationChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateNotificationChannelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateNotificationChannelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListNotificationChannelsRequest. */ + interface IListNotificationChannelsRequest { + + /** ListNotificationChannelsRequest name */ + name?: (string|null); + + /** ListNotificationChannelsRequest filter */ + filter?: (string|null); + + /** ListNotificationChannelsRequest orderBy */ + orderBy?: (string|null); + + /** ListNotificationChannelsRequest pageSize */ + pageSize?: (number|null); + + /** ListNotificationChannelsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListNotificationChannelsRequest. */ + class ListNotificationChannelsRequest implements IListNotificationChannelsRequest { + + /** + * Constructs a new ListNotificationChannelsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListNotificationChannelsRequest); + + /** ListNotificationChannelsRequest name. */ + public name: string; + + /** ListNotificationChannelsRequest filter. */ + public filter: string; + + /** ListNotificationChannelsRequest orderBy. */ + public orderBy: string; + + /** ListNotificationChannelsRequest pageSize. */ + public pageSize: number; + + /** ListNotificationChannelsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListNotificationChannelsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListNotificationChannelsRequest instance + */ + public static create(properties?: google.monitoring.v3.IListNotificationChannelsRequest): google.monitoring.v3.ListNotificationChannelsRequest; + + /** + * Encodes the specified ListNotificationChannelsRequest message. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelsRequest.verify|verify} messages. + * @param message ListNotificationChannelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListNotificationChannelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListNotificationChannelsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelsRequest.verify|verify} messages. + * @param message ListNotificationChannelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListNotificationChannelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListNotificationChannelsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListNotificationChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListNotificationChannelsRequest; + + /** + * Decodes a ListNotificationChannelsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListNotificationChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListNotificationChannelsRequest; + + /** + * Verifies a ListNotificationChannelsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListNotificationChannelsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListNotificationChannelsRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListNotificationChannelsRequest; + + /** + * Creates a plain object from a ListNotificationChannelsRequest message. Also converts values to other types if specified. + * @param message ListNotificationChannelsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListNotificationChannelsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListNotificationChannelsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListNotificationChannelsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListNotificationChannelsResponse. */ + interface IListNotificationChannelsResponse { + + /** ListNotificationChannelsResponse notificationChannels */ + notificationChannels?: (google.monitoring.v3.INotificationChannel[]|null); + + /** ListNotificationChannelsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListNotificationChannelsResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListNotificationChannelsResponse. */ + class ListNotificationChannelsResponse implements IListNotificationChannelsResponse { + + /** + * Constructs a new ListNotificationChannelsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListNotificationChannelsResponse); + + /** ListNotificationChannelsResponse notificationChannels. */ + public notificationChannels: google.monitoring.v3.INotificationChannel[]; + + /** ListNotificationChannelsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListNotificationChannelsResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListNotificationChannelsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListNotificationChannelsResponse instance + */ + public static create(properties?: google.monitoring.v3.IListNotificationChannelsResponse): google.monitoring.v3.ListNotificationChannelsResponse; + + /** + * Encodes the specified ListNotificationChannelsResponse message. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelsResponse.verify|verify} messages. + * @param message ListNotificationChannelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListNotificationChannelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListNotificationChannelsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelsResponse.verify|verify} messages. + * @param message ListNotificationChannelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListNotificationChannelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListNotificationChannelsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListNotificationChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListNotificationChannelsResponse; + + /** + * Decodes a ListNotificationChannelsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListNotificationChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListNotificationChannelsResponse; + + /** + * Verifies a ListNotificationChannelsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListNotificationChannelsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListNotificationChannelsResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListNotificationChannelsResponse; + + /** + * Creates a plain object from a ListNotificationChannelsResponse message. Also converts values to other types if specified. + * @param message ListNotificationChannelsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListNotificationChannelsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListNotificationChannelsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListNotificationChannelsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetNotificationChannelRequest. */ + interface IGetNotificationChannelRequest { + + /** GetNotificationChannelRequest name */ + name?: (string|null); + } + + /** Represents a GetNotificationChannelRequest. */ + class GetNotificationChannelRequest implements IGetNotificationChannelRequest { + + /** + * Constructs a new GetNotificationChannelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetNotificationChannelRequest); + + /** GetNotificationChannelRequest name. */ + public name: string; + + /** + * Creates a new GetNotificationChannelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetNotificationChannelRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetNotificationChannelRequest): google.monitoring.v3.GetNotificationChannelRequest; + + /** + * Encodes the specified GetNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelRequest.verify|verify} messages. + * @param message GetNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelRequest.verify|verify} messages. + * @param message GetNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetNotificationChannelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetNotificationChannelRequest; + + /** + * Decodes a GetNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetNotificationChannelRequest; + + /** + * Verifies a GetNotificationChannelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetNotificationChannelRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetNotificationChannelRequest; + + /** + * Creates a plain object from a GetNotificationChannelRequest message. Also converts values to other types if specified. + * @param message GetNotificationChannelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetNotificationChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetNotificationChannelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetNotificationChannelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateNotificationChannelRequest. */ + interface IUpdateNotificationChannelRequest { + + /** UpdateNotificationChannelRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateNotificationChannelRequest notificationChannel */ + notificationChannel?: (google.monitoring.v3.INotificationChannel|null); + } + + /** Represents an UpdateNotificationChannelRequest. */ + class UpdateNotificationChannelRequest implements IUpdateNotificationChannelRequest { + + /** + * Constructs a new UpdateNotificationChannelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IUpdateNotificationChannelRequest); + + /** UpdateNotificationChannelRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateNotificationChannelRequest notificationChannel. */ + public notificationChannel?: (google.monitoring.v3.INotificationChannel|null); + + /** + * Creates a new UpdateNotificationChannelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateNotificationChannelRequest instance + */ + public static create(properties?: google.monitoring.v3.IUpdateNotificationChannelRequest): google.monitoring.v3.UpdateNotificationChannelRequest; + + /** + * Encodes the specified UpdateNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.UpdateNotificationChannelRequest.verify|verify} messages. + * @param message UpdateNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IUpdateNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateNotificationChannelRequest.verify|verify} messages. + * @param message UpdateNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IUpdateNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateNotificationChannelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UpdateNotificationChannelRequest; + + /** + * Decodes an UpdateNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UpdateNotificationChannelRequest; + + /** + * Verifies an UpdateNotificationChannelRequest message. + * @param message Plain 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 UpdateNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateNotificationChannelRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UpdateNotificationChannelRequest; + + /** + * Creates a plain object from an UpdateNotificationChannelRequest message. Also converts values to other types if specified. + * @param message UpdateNotificationChannelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UpdateNotificationChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateNotificationChannelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateNotificationChannelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteNotificationChannelRequest. */ + interface IDeleteNotificationChannelRequest { + + /** DeleteNotificationChannelRequest name */ + name?: (string|null); + + /** DeleteNotificationChannelRequest force */ + force?: (boolean|null); + } + + /** Represents a DeleteNotificationChannelRequest. */ + class DeleteNotificationChannelRequest implements IDeleteNotificationChannelRequest { + + /** + * Constructs a new DeleteNotificationChannelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDeleteNotificationChannelRequest); + + /** DeleteNotificationChannelRequest name. */ + public name: string; + + /** DeleteNotificationChannelRequest force. */ + public force: boolean; + + /** + * Creates a new DeleteNotificationChannelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteNotificationChannelRequest instance + */ + public static create(properties?: google.monitoring.v3.IDeleteNotificationChannelRequest): google.monitoring.v3.DeleteNotificationChannelRequest; + + /** + * Encodes the specified DeleteNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.DeleteNotificationChannelRequest.verify|verify} messages. + * @param message DeleteNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDeleteNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteNotificationChannelRequest.verify|verify} messages. + * @param message DeleteNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDeleteNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteNotificationChannelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DeleteNotificationChannelRequest; + + /** + * Decodes a DeleteNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DeleteNotificationChannelRequest; + + /** + * Verifies a DeleteNotificationChannelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteNotificationChannelRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DeleteNotificationChannelRequest; + + /** + * Creates a plain object from a DeleteNotificationChannelRequest message. Also converts values to other types if specified. + * @param message DeleteNotificationChannelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DeleteNotificationChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteNotificationChannelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteNotificationChannelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SendNotificationChannelVerificationCodeRequest. */ + interface ISendNotificationChannelVerificationCodeRequest { + + /** SendNotificationChannelVerificationCodeRequest name */ + name?: (string|null); + } + + /** Represents a SendNotificationChannelVerificationCodeRequest. */ + class SendNotificationChannelVerificationCodeRequest implements ISendNotificationChannelVerificationCodeRequest { + + /** + * Constructs a new SendNotificationChannelVerificationCodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest); + + /** SendNotificationChannelVerificationCodeRequest name. */ + public name: string; + + /** + * Creates a new SendNotificationChannelVerificationCodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SendNotificationChannelVerificationCodeRequest instance + */ + public static create(properties?: google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest): google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; + + /** + * Encodes the specified SendNotificationChannelVerificationCodeRequest message. Does not implicitly {@link google.monitoring.v3.SendNotificationChannelVerificationCodeRequest.verify|verify} messages. + * @param message SendNotificationChannelVerificationCodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SendNotificationChannelVerificationCodeRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.SendNotificationChannelVerificationCodeRequest.verify|verify} messages. + * @param message SendNotificationChannelVerificationCodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SendNotificationChannelVerificationCodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SendNotificationChannelVerificationCodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; + + /** + * Decodes a SendNotificationChannelVerificationCodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SendNotificationChannelVerificationCodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; + + /** + * Verifies a SendNotificationChannelVerificationCodeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SendNotificationChannelVerificationCodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SendNotificationChannelVerificationCodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; + + /** + * Creates a plain object from a SendNotificationChannelVerificationCodeRequest message. Also converts values to other types if specified. + * @param message SendNotificationChannelVerificationCodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.SendNotificationChannelVerificationCodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SendNotificationChannelVerificationCodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SendNotificationChannelVerificationCodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetNotificationChannelVerificationCodeRequest. */ + interface IGetNotificationChannelVerificationCodeRequest { + + /** GetNotificationChannelVerificationCodeRequest name */ + name?: (string|null); + + /** GetNotificationChannelVerificationCodeRequest expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a GetNotificationChannelVerificationCodeRequest. */ + class GetNotificationChannelVerificationCodeRequest implements IGetNotificationChannelVerificationCodeRequest { + + /** + * Constructs a new GetNotificationChannelVerificationCodeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest); + + /** GetNotificationChannelVerificationCodeRequest name. */ + public name: string; + + /** GetNotificationChannelVerificationCodeRequest expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new GetNotificationChannelVerificationCodeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetNotificationChannelVerificationCodeRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest): google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; + + /** + * Encodes the specified GetNotificationChannelVerificationCodeRequest message. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelVerificationCodeRequest.verify|verify} messages. + * @param message GetNotificationChannelVerificationCodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetNotificationChannelVerificationCodeRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelVerificationCodeRequest.verify|verify} messages. + * @param message GetNotificationChannelVerificationCodeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetNotificationChannelVerificationCodeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetNotificationChannelVerificationCodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; + + /** + * Decodes a GetNotificationChannelVerificationCodeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetNotificationChannelVerificationCodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; + + /** + * Verifies a GetNotificationChannelVerificationCodeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetNotificationChannelVerificationCodeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetNotificationChannelVerificationCodeRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; + + /** + * Creates a plain object from a GetNotificationChannelVerificationCodeRequest message. Also converts values to other types if specified. + * @param message GetNotificationChannelVerificationCodeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetNotificationChannelVerificationCodeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetNotificationChannelVerificationCodeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetNotificationChannelVerificationCodeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetNotificationChannelVerificationCodeResponse. */ + interface IGetNotificationChannelVerificationCodeResponse { + + /** GetNotificationChannelVerificationCodeResponse code */ + code?: (string|null); + + /** GetNotificationChannelVerificationCodeResponse expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a GetNotificationChannelVerificationCodeResponse. */ + class GetNotificationChannelVerificationCodeResponse implements IGetNotificationChannelVerificationCodeResponse { + + /** + * Constructs a new GetNotificationChannelVerificationCodeResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse); + + /** GetNotificationChannelVerificationCodeResponse code. */ + public code: string; + + /** GetNotificationChannelVerificationCodeResponse expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new GetNotificationChannelVerificationCodeResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GetNotificationChannelVerificationCodeResponse instance + */ + public static create(properties?: google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse): google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; + + /** + * Encodes the specified GetNotificationChannelVerificationCodeResponse message. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelVerificationCodeResponse.verify|verify} messages. + * @param message GetNotificationChannelVerificationCodeResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetNotificationChannelVerificationCodeResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelVerificationCodeResponse.verify|verify} messages. + * @param message GetNotificationChannelVerificationCodeResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetNotificationChannelVerificationCodeResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetNotificationChannelVerificationCodeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; + + /** + * Decodes a GetNotificationChannelVerificationCodeResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetNotificationChannelVerificationCodeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; + + /** + * Verifies a GetNotificationChannelVerificationCodeResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetNotificationChannelVerificationCodeResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetNotificationChannelVerificationCodeResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; + + /** + * Creates a plain object from a GetNotificationChannelVerificationCodeResponse message. Also converts values to other types if specified. + * @param message GetNotificationChannelVerificationCodeResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetNotificationChannelVerificationCodeResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetNotificationChannelVerificationCodeResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetNotificationChannelVerificationCodeResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a VerifyNotificationChannelRequest. */ + interface IVerifyNotificationChannelRequest { + + /** VerifyNotificationChannelRequest name */ + name?: (string|null); + + /** VerifyNotificationChannelRequest code */ + code?: (string|null); + } + + /** Represents a VerifyNotificationChannelRequest. */ + class VerifyNotificationChannelRequest implements IVerifyNotificationChannelRequest { + + /** + * Constructs a new VerifyNotificationChannelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IVerifyNotificationChannelRequest); + + /** VerifyNotificationChannelRequest name. */ + public name: string; + + /** VerifyNotificationChannelRequest code. */ + public code: string; + + /** + * Creates a new VerifyNotificationChannelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns VerifyNotificationChannelRequest instance + */ + public static create(properties?: google.monitoring.v3.IVerifyNotificationChannelRequest): google.monitoring.v3.VerifyNotificationChannelRequest; + + /** + * Encodes the specified VerifyNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.VerifyNotificationChannelRequest.verify|verify} messages. + * @param message VerifyNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IVerifyNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VerifyNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.VerifyNotificationChannelRequest.verify|verify} messages. + * @param message VerifyNotificationChannelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IVerifyNotificationChannelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VerifyNotificationChannelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VerifyNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.VerifyNotificationChannelRequest; + + /** + * Decodes a VerifyNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VerifyNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.VerifyNotificationChannelRequest; + + /** + * Verifies a VerifyNotificationChannelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VerifyNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VerifyNotificationChannelRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.VerifyNotificationChannelRequest; + + /** + * Creates a plain object from a VerifyNotificationChannelRequest message. Also converts values to other types if specified. + * @param message VerifyNotificationChannelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.VerifyNotificationChannelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VerifyNotificationChannelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VerifyNotificationChannelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a QueryService */ + class QueryService extends $protobuf.rpc.Service { + + /** + * Constructs a new QueryService 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 QueryService 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): QueryService; + + /** + * Calls QueryTimeSeries. + * @param request QueryTimeSeriesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and QueryTimeSeriesResponse + */ + public queryTimeSeries(request: google.monitoring.v3.IQueryTimeSeriesRequest, callback: google.monitoring.v3.QueryService.QueryTimeSeriesCallback): void; + + /** + * Calls QueryTimeSeries. + * @param request QueryTimeSeriesRequest message or plain object + * @returns Promise + */ + public queryTimeSeries(request: google.monitoring.v3.IQueryTimeSeriesRequest): Promise; + } + + namespace QueryService { + + /** + * Callback as used by {@link google.monitoring.v3.QueryService|queryTimeSeries}. + * @param error Error, if any + * @param [response] QueryTimeSeriesResponse + */ + type QueryTimeSeriesCallback = (error: (Error|null), response?: google.monitoring.v3.QueryTimeSeriesResponse) => void; + } + + /** Properties of a Service. */ + interface IService { + + /** Service name */ + name?: (string|null); + + /** Service displayName */ + displayName?: (string|null); + + /** Service custom */ + custom?: (google.monitoring.v3.Service.ICustom|null); + + /** Service appEngine */ + appEngine?: (google.monitoring.v3.Service.IAppEngine|null); + + /** Service cloudEndpoints */ + cloudEndpoints?: (google.monitoring.v3.Service.ICloudEndpoints|null); + + /** Service clusterIstio */ + clusterIstio?: (google.monitoring.v3.Service.IClusterIstio|null); + + /** Service meshIstio */ + meshIstio?: (google.monitoring.v3.Service.IMeshIstio|null); + + /** Service istioCanonicalService */ + istioCanonicalService?: (google.monitoring.v3.Service.IIstioCanonicalService|null); + + /** Service telemetry */ + telemetry?: (google.monitoring.v3.Service.ITelemetry|null); + } + + /** Represents a Service. */ + class Service implements IService { + + /** + * Constructs a new Service. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IService); + + /** Service name. */ + public name: string; + + /** Service displayName. */ + public displayName: string; + + /** Service custom. */ + public custom?: (google.monitoring.v3.Service.ICustom|null); + + /** Service appEngine. */ + public appEngine?: (google.monitoring.v3.Service.IAppEngine|null); + + /** Service cloudEndpoints. */ + public cloudEndpoints?: (google.monitoring.v3.Service.ICloudEndpoints|null); + + /** Service clusterIstio. */ + public clusterIstio?: (google.monitoring.v3.Service.IClusterIstio|null); + + /** Service meshIstio. */ + public meshIstio?: (google.monitoring.v3.Service.IMeshIstio|null); + + /** Service istioCanonicalService. */ + public istioCanonicalService?: (google.monitoring.v3.Service.IIstioCanonicalService|null); + + /** Service telemetry. */ + public telemetry?: (google.monitoring.v3.Service.ITelemetry|null); + + /** Service identifier. */ + public identifier?: ("custom"|"appEngine"|"cloudEndpoints"|"clusterIstio"|"meshIstio"|"istioCanonicalService"); + + /** + * Creates a new Service instance using the specified properties. + * @param [properties] Properties to set + * @returns Service instance + */ + public static create(properties?: google.monitoring.v3.IService): google.monitoring.v3.Service; + + /** + * Encodes the specified Service message. Does not implicitly {@link google.monitoring.v3.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.monitoring.v3.IService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Service message, length delimited. Does not implicitly {@link google.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.Service, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Service to JSON. + * @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; + } + + namespace Service { + + /** Properties of a Custom. */ + interface ICustom { + } + + /** Represents a Custom. */ + class Custom implements ICustom { + + /** + * Constructs a new Custom. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.Service.ICustom); + + /** + * Creates a new Custom instance using the specified properties. + * @param [properties] Properties to set + * @returns Custom instance + */ + public static create(properties?: google.monitoring.v3.Service.ICustom): google.monitoring.v3.Service.Custom; + + /** + * Encodes the specified Custom message. Does not implicitly {@link google.monitoring.v3.Service.Custom.verify|verify} messages. + * @param message Custom message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.Service.ICustom, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Custom message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.Custom.verify|verify} messages. + * @param message Custom message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.Service.ICustom, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Custom message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Custom + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Service.Custom; + + /** + * Decodes a Custom message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Custom + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Service.Custom; + + /** + * Verifies a Custom message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Custom message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Custom + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Service.Custom; + + /** + * Creates a plain object from a Custom message. Also converts values to other types if specified. + * @param message Custom + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Service.Custom, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Custom to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Custom + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AppEngine. */ + interface IAppEngine { + + /** AppEngine moduleId */ + moduleId?: (string|null); + } + + /** Represents an AppEngine. */ + class AppEngine implements IAppEngine { + + /** + * Constructs a new AppEngine. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.Service.IAppEngine); + + /** AppEngine moduleId. */ + public moduleId: string; + + /** + * Creates a new AppEngine instance using the specified properties. + * @param [properties] Properties to set + * @returns AppEngine instance + */ + public static create(properties?: google.monitoring.v3.Service.IAppEngine): google.monitoring.v3.Service.AppEngine; + + /** + * Encodes the specified AppEngine message. Does not implicitly {@link google.monitoring.v3.Service.AppEngine.verify|verify} messages. + * @param message AppEngine message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.Service.IAppEngine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AppEngine message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.AppEngine.verify|verify} messages. + * @param message AppEngine message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.Service.IAppEngine, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AppEngine message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AppEngine + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Service.AppEngine; + + /** + * Decodes an AppEngine message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AppEngine + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Service.AppEngine; + + /** + * Verifies an AppEngine message. + * @param message Plain 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 AppEngine message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AppEngine + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Service.AppEngine; + + /** + * Creates a plain object from an AppEngine message. Also converts values to other types if specified. + * @param message AppEngine + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Service.AppEngine, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AppEngine to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AppEngine + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CloudEndpoints. */ + interface ICloudEndpoints { + + /** CloudEndpoints service */ + service?: (string|null); + } + + /** Represents a CloudEndpoints. */ + class CloudEndpoints implements ICloudEndpoints { + + /** + * Constructs a new CloudEndpoints. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.Service.ICloudEndpoints); + + /** CloudEndpoints service. */ + public service: string; + + /** + * Creates a new CloudEndpoints instance using the specified properties. + * @param [properties] Properties to set + * @returns CloudEndpoints instance + */ + public static create(properties?: google.monitoring.v3.Service.ICloudEndpoints): google.monitoring.v3.Service.CloudEndpoints; + + /** + * Encodes the specified CloudEndpoints message. Does not implicitly {@link google.monitoring.v3.Service.CloudEndpoints.verify|verify} messages. + * @param message CloudEndpoints message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.Service.ICloudEndpoints, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloudEndpoints message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.CloudEndpoints.verify|verify} messages. + * @param message CloudEndpoints message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.Service.ICloudEndpoints, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloudEndpoints message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloudEndpoints + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Service.CloudEndpoints; + + /** + * Decodes a CloudEndpoints message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloudEndpoints + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Service.CloudEndpoints; + + /** + * Verifies a CloudEndpoints message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloudEndpoints message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloudEndpoints + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Service.CloudEndpoints; + + /** + * Creates a plain object from a CloudEndpoints message. Also converts values to other types if specified. + * @param message CloudEndpoints + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Service.CloudEndpoints, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloudEndpoints to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloudEndpoints + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ClusterIstio. */ + interface IClusterIstio { + + /** ClusterIstio location */ + location?: (string|null); + + /** ClusterIstio clusterName */ + clusterName?: (string|null); + + /** ClusterIstio serviceNamespace */ + serviceNamespace?: (string|null); + + /** ClusterIstio serviceName */ + serviceName?: (string|null); + } + + /** Represents a ClusterIstio. */ + class ClusterIstio implements IClusterIstio { + + /** + * Constructs a new ClusterIstio. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.Service.IClusterIstio); + + /** ClusterIstio location. */ + public location: string; + + /** ClusterIstio clusterName. */ + public clusterName: string; + + /** ClusterIstio serviceNamespace. */ + public serviceNamespace: string; + + /** ClusterIstio serviceName. */ + public serviceName: string; + + /** + * Creates a new ClusterIstio instance using the specified properties. + * @param [properties] Properties to set + * @returns ClusterIstio instance + */ + public static create(properties?: google.monitoring.v3.Service.IClusterIstio): google.monitoring.v3.Service.ClusterIstio; + + /** + * Encodes the specified ClusterIstio message. Does not implicitly {@link google.monitoring.v3.Service.ClusterIstio.verify|verify} messages. + * @param message ClusterIstio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.Service.IClusterIstio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClusterIstio message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.ClusterIstio.verify|verify} messages. + * @param message ClusterIstio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.Service.IClusterIstio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClusterIstio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClusterIstio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Service.ClusterIstio; + + /** + * Decodes a ClusterIstio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClusterIstio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Service.ClusterIstio; + + /** + * Verifies a ClusterIstio message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClusterIstio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClusterIstio + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Service.ClusterIstio; + + /** + * Creates a plain object from a ClusterIstio message. Also converts values to other types if specified. + * @param message ClusterIstio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Service.ClusterIstio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClusterIstio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClusterIstio + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MeshIstio. */ + interface IMeshIstio { + + /** MeshIstio meshUid */ + meshUid?: (string|null); + + /** MeshIstio serviceNamespace */ + serviceNamespace?: (string|null); + + /** MeshIstio serviceName */ + serviceName?: (string|null); + } + + /** Represents a MeshIstio. */ + class MeshIstio implements IMeshIstio { + + /** + * Constructs a new MeshIstio. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.Service.IMeshIstio); + + /** MeshIstio meshUid. */ + public meshUid: string; + + /** MeshIstio serviceNamespace. */ + public serviceNamespace: string; + + /** MeshIstio serviceName. */ + public serviceName: string; + + /** + * Creates a new MeshIstio instance using the specified properties. + * @param [properties] Properties to set + * @returns MeshIstio instance + */ + public static create(properties?: google.monitoring.v3.Service.IMeshIstio): google.monitoring.v3.Service.MeshIstio; + + /** + * Encodes the specified MeshIstio message. Does not implicitly {@link google.monitoring.v3.Service.MeshIstio.verify|verify} messages. + * @param message MeshIstio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.Service.IMeshIstio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MeshIstio message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.MeshIstio.verify|verify} messages. + * @param message MeshIstio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.Service.IMeshIstio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MeshIstio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MeshIstio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Service.MeshIstio; + + /** + * Decodes a MeshIstio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MeshIstio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Service.MeshIstio; + + /** + * Verifies a MeshIstio message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MeshIstio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MeshIstio + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Service.MeshIstio; + + /** + * Creates a plain object from a MeshIstio message. Also converts values to other types if specified. + * @param message MeshIstio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Service.MeshIstio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MeshIstio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MeshIstio + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an IstioCanonicalService. */ + interface IIstioCanonicalService { + + /** IstioCanonicalService meshUid */ + meshUid?: (string|null); + + /** IstioCanonicalService canonicalServiceNamespace */ + canonicalServiceNamespace?: (string|null); + + /** IstioCanonicalService canonicalService */ + canonicalService?: (string|null); + } + + /** Represents an IstioCanonicalService. */ + class IstioCanonicalService implements IIstioCanonicalService { + + /** + * Constructs a new IstioCanonicalService. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.Service.IIstioCanonicalService); + + /** IstioCanonicalService meshUid. */ + public meshUid: string; + + /** IstioCanonicalService canonicalServiceNamespace. */ + public canonicalServiceNamespace: string; + + /** IstioCanonicalService canonicalService. */ + public canonicalService: string; + + /** + * Creates a new IstioCanonicalService instance using the specified properties. + * @param [properties] Properties to set + * @returns IstioCanonicalService instance + */ + public static create(properties?: google.monitoring.v3.Service.IIstioCanonicalService): google.monitoring.v3.Service.IstioCanonicalService; + + /** + * Encodes the specified IstioCanonicalService message. Does not implicitly {@link google.monitoring.v3.Service.IstioCanonicalService.verify|verify} messages. + * @param message IstioCanonicalService message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.Service.IIstioCanonicalService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IstioCanonicalService message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.IstioCanonicalService.verify|verify} messages. + * @param message IstioCanonicalService message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.Service.IIstioCanonicalService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IstioCanonicalService message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IstioCanonicalService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Service.IstioCanonicalService; + + /** + * Decodes an IstioCanonicalService message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IstioCanonicalService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Service.IstioCanonicalService; + + /** + * Verifies an IstioCanonicalService message. + * @param message Plain 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 IstioCanonicalService message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IstioCanonicalService + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Service.IstioCanonicalService; + + /** + * Creates a plain object from an IstioCanonicalService message. Also converts values to other types if specified. + * @param message IstioCanonicalService + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Service.IstioCanonicalService, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IstioCanonicalService to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IstioCanonicalService + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Telemetry. */ + interface ITelemetry { + + /** Telemetry resourceName */ + resourceName?: (string|null); + } + + /** Represents a Telemetry. */ + class Telemetry implements ITelemetry { + + /** + * Constructs a new Telemetry. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.Service.ITelemetry); + + /** Telemetry resourceName. */ + public resourceName: string; + + /** + * Creates a new Telemetry instance using the specified properties. + * @param [properties] Properties to set + * @returns Telemetry instance + */ + public static create(properties?: google.monitoring.v3.Service.ITelemetry): google.monitoring.v3.Service.Telemetry; + + /** + * Encodes the specified Telemetry message. Does not implicitly {@link google.monitoring.v3.Service.Telemetry.verify|verify} messages. + * @param message Telemetry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.Service.ITelemetry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Telemetry message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.Telemetry.verify|verify} messages. + * @param message Telemetry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.Service.ITelemetry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Telemetry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Telemetry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Service.Telemetry; + + /** + * Decodes a Telemetry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Telemetry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Service.Telemetry; + + /** + * Verifies a Telemetry message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Telemetry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Telemetry + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Service.Telemetry; + + /** + * Creates a plain object from a Telemetry message. Also converts values to other types if specified. + * @param message Telemetry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Service.Telemetry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Telemetry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Telemetry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ServiceLevelObjective. */ + interface IServiceLevelObjective { + + /** ServiceLevelObjective name */ + name?: (string|null); + + /** ServiceLevelObjective displayName */ + displayName?: (string|null); + + /** ServiceLevelObjective serviceLevelIndicator */ + serviceLevelIndicator?: (google.monitoring.v3.IServiceLevelIndicator|null); + + /** ServiceLevelObjective goal */ + goal?: (number|null); + + /** ServiceLevelObjective rollingPeriod */ + rollingPeriod?: (google.protobuf.IDuration|null); + + /** ServiceLevelObjective calendarPeriod */ + calendarPeriod?: (google.type.CalendarPeriod|keyof typeof google.type.CalendarPeriod|null); + } + + /** Represents a ServiceLevelObjective. */ + class ServiceLevelObjective implements IServiceLevelObjective { + + /** + * Constructs a new ServiceLevelObjective. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IServiceLevelObjective); + + /** ServiceLevelObjective name. */ + public name: string; + + /** ServiceLevelObjective displayName. */ + public displayName: string; + + /** ServiceLevelObjective serviceLevelIndicator. */ + public serviceLevelIndicator?: (google.monitoring.v3.IServiceLevelIndicator|null); + + /** ServiceLevelObjective goal. */ + public goal: number; + + /** ServiceLevelObjective rollingPeriod. */ + public rollingPeriod?: (google.protobuf.IDuration|null); + + /** ServiceLevelObjective calendarPeriod. */ + public calendarPeriod?: (google.type.CalendarPeriod|keyof typeof google.type.CalendarPeriod|null); + + /** ServiceLevelObjective period. */ + public period?: ("rollingPeriod"|"calendarPeriod"); + + /** + * Creates a new ServiceLevelObjective instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceLevelObjective instance + */ + public static create(properties?: google.monitoring.v3.IServiceLevelObjective): google.monitoring.v3.ServiceLevelObjective; + + /** + * Encodes the specified ServiceLevelObjective message. Does not implicitly {@link google.monitoring.v3.ServiceLevelObjective.verify|verify} messages. + * @param message ServiceLevelObjective message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IServiceLevelObjective, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceLevelObjective message, length delimited. Does not implicitly {@link google.monitoring.v3.ServiceLevelObjective.verify|verify} messages. + * @param message ServiceLevelObjective message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IServiceLevelObjective, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceLevelObjective message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceLevelObjective + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ServiceLevelObjective; + + /** + * Decodes a ServiceLevelObjective message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceLevelObjective + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ServiceLevelObjective; + + /** + * Verifies a ServiceLevelObjective message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceLevelObjective message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceLevelObjective + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ServiceLevelObjective; + + /** + * Creates a plain object from a ServiceLevelObjective message. Also converts values to other types if specified. + * @param message ServiceLevelObjective + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ServiceLevelObjective, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceLevelObjective to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceLevelObjective + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ServiceLevelObjective { + + /** View enum. */ + enum View { + VIEW_UNSPECIFIED = 0, + FULL = 2, + EXPLICIT = 1 + } + } + + /** Properties of a ServiceLevelIndicator. */ + interface IServiceLevelIndicator { + + /** ServiceLevelIndicator basicSli */ + basicSli?: (google.monitoring.v3.IBasicSli|null); + + /** ServiceLevelIndicator requestBased */ + requestBased?: (google.monitoring.v3.IRequestBasedSli|null); + + /** ServiceLevelIndicator windowsBased */ + windowsBased?: (google.monitoring.v3.IWindowsBasedSli|null); + } + + /** Represents a ServiceLevelIndicator. */ + class ServiceLevelIndicator implements IServiceLevelIndicator { + + /** + * Constructs a new ServiceLevelIndicator. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IServiceLevelIndicator); + + /** ServiceLevelIndicator basicSli. */ + public basicSli?: (google.monitoring.v3.IBasicSli|null); + + /** ServiceLevelIndicator requestBased. */ + public requestBased?: (google.monitoring.v3.IRequestBasedSli|null); + + /** ServiceLevelIndicator windowsBased. */ + public windowsBased?: (google.monitoring.v3.IWindowsBasedSli|null); + + /** ServiceLevelIndicator type. */ + public type?: ("basicSli"|"requestBased"|"windowsBased"); + + /** + * Creates a new ServiceLevelIndicator instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceLevelIndicator instance + */ + public static create(properties?: google.monitoring.v3.IServiceLevelIndicator): google.monitoring.v3.ServiceLevelIndicator; + + /** + * Encodes the specified ServiceLevelIndicator message. Does not implicitly {@link google.monitoring.v3.ServiceLevelIndicator.verify|verify} messages. + * @param message ServiceLevelIndicator message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IServiceLevelIndicator, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceLevelIndicator message, length delimited. Does not implicitly {@link google.monitoring.v3.ServiceLevelIndicator.verify|verify} messages. + * @param message ServiceLevelIndicator message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IServiceLevelIndicator, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceLevelIndicator message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceLevelIndicator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ServiceLevelIndicator; + + /** + * Decodes a ServiceLevelIndicator message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceLevelIndicator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ServiceLevelIndicator; + + /** + * Verifies a ServiceLevelIndicator message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceLevelIndicator message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceLevelIndicator + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ServiceLevelIndicator; + + /** + * Creates a plain object from a ServiceLevelIndicator message. Also converts values to other types if specified. + * @param message ServiceLevelIndicator + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ServiceLevelIndicator, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceLevelIndicator to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceLevelIndicator + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BasicSli. */ + interface IBasicSli { + + /** BasicSli method */ + method?: (string[]|null); + + /** BasicSli location */ + location?: (string[]|null); + + /** BasicSli version */ + version?: (string[]|null); + + /** BasicSli availability */ + availability?: (google.monitoring.v3.BasicSli.IAvailabilityCriteria|null); + + /** BasicSli latency */ + latency?: (google.monitoring.v3.BasicSli.ILatencyCriteria|null); + } + + /** Represents a BasicSli. */ + class BasicSli implements IBasicSli { + + /** + * Constructs a new BasicSli. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IBasicSli); + + /** BasicSli method. */ + public method: string[]; + + /** BasicSli location. */ + public location: string[]; + + /** BasicSli version. */ + public version: string[]; + + /** BasicSli availability. */ + public availability?: (google.monitoring.v3.BasicSli.IAvailabilityCriteria|null); + + /** BasicSli latency. */ + public latency?: (google.monitoring.v3.BasicSli.ILatencyCriteria|null); + + /** BasicSli sliCriteria. */ + public sliCriteria?: ("availability"|"latency"); + + /** + * Creates a new BasicSli instance using the specified properties. + * @param [properties] Properties to set + * @returns BasicSli instance + */ + public static create(properties?: google.monitoring.v3.IBasicSli): google.monitoring.v3.BasicSli; + + /** + * Encodes the specified BasicSli message. Does not implicitly {@link google.monitoring.v3.BasicSli.verify|verify} messages. + * @param message BasicSli message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IBasicSli, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BasicSli message, length delimited. Does not implicitly {@link google.monitoring.v3.BasicSli.verify|verify} messages. + * @param message BasicSli message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IBasicSli, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BasicSli message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BasicSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.BasicSli; + + /** + * Decodes a BasicSli message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BasicSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.BasicSli; + + /** + * Verifies a BasicSli message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BasicSli message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BasicSli + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.BasicSli; + + /** + * Creates a plain object from a BasicSli message. Also converts values to other types if specified. + * @param message BasicSli + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.BasicSli, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BasicSli to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BasicSli + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BasicSli { + + /** Properties of an AvailabilityCriteria. */ + interface IAvailabilityCriteria { + } + + /** Represents an AvailabilityCriteria. */ + class AvailabilityCriteria implements IAvailabilityCriteria { + + /** + * Constructs a new AvailabilityCriteria. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.BasicSli.IAvailabilityCriteria); + + /** + * Creates a new AvailabilityCriteria instance using the specified properties. + * @param [properties] Properties to set + * @returns AvailabilityCriteria instance + */ + public static create(properties?: google.monitoring.v3.BasicSli.IAvailabilityCriteria): google.monitoring.v3.BasicSli.AvailabilityCriteria; + + /** + * Encodes the specified AvailabilityCriteria message. Does not implicitly {@link google.monitoring.v3.BasicSli.AvailabilityCriteria.verify|verify} messages. + * @param message AvailabilityCriteria message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.BasicSli.IAvailabilityCriteria, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AvailabilityCriteria message, length delimited. Does not implicitly {@link google.monitoring.v3.BasicSli.AvailabilityCriteria.verify|verify} messages. + * @param message AvailabilityCriteria message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.BasicSli.IAvailabilityCriteria, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AvailabilityCriteria message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AvailabilityCriteria + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.BasicSli.AvailabilityCriteria; + + /** + * Decodes an AvailabilityCriteria message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AvailabilityCriteria + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.BasicSli.AvailabilityCriteria; + + /** + * Verifies an AvailabilityCriteria message. + * @param message Plain 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 AvailabilityCriteria message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AvailabilityCriteria + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.BasicSli.AvailabilityCriteria; + + /** + * Creates a plain object from an AvailabilityCriteria message. Also converts values to other types if specified. + * @param message AvailabilityCriteria + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.BasicSli.AvailabilityCriteria, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AvailabilityCriteria to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AvailabilityCriteria + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LatencyCriteria. */ + interface ILatencyCriteria { + + /** LatencyCriteria threshold */ + threshold?: (google.protobuf.IDuration|null); + } + + /** Represents a LatencyCriteria. */ + class LatencyCriteria implements ILatencyCriteria { + + /** + * Constructs a new LatencyCriteria. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.BasicSli.ILatencyCriteria); + + /** LatencyCriteria threshold. */ + public threshold?: (google.protobuf.IDuration|null); + + /** + * Creates a new LatencyCriteria instance using the specified properties. + * @param [properties] Properties to set + * @returns LatencyCriteria instance + */ + public static create(properties?: google.monitoring.v3.BasicSli.ILatencyCriteria): google.monitoring.v3.BasicSli.LatencyCriteria; + + /** + * Encodes the specified LatencyCriteria message. Does not implicitly {@link google.monitoring.v3.BasicSli.LatencyCriteria.verify|verify} messages. + * @param message LatencyCriteria message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.BasicSli.ILatencyCriteria, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LatencyCriteria message, length delimited. Does not implicitly {@link google.monitoring.v3.BasicSli.LatencyCriteria.verify|verify} messages. + * @param message LatencyCriteria message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.BasicSli.ILatencyCriteria, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LatencyCriteria message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LatencyCriteria + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.BasicSli.LatencyCriteria; + + /** + * Decodes a LatencyCriteria message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LatencyCriteria + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.BasicSli.LatencyCriteria; + + /** + * Verifies a LatencyCriteria message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LatencyCriteria message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LatencyCriteria + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.BasicSli.LatencyCriteria; + + /** + * Creates a plain object from a LatencyCriteria message. Also converts values to other types if specified. + * @param message LatencyCriteria + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.BasicSli.LatencyCriteria, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LatencyCriteria to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LatencyCriteria + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a Range. */ + interface IRange { + + /** Range min */ + min?: (number|null); + + /** Range max */ + max?: (number|null); + } + + /** Represents a Range. */ + class Range implements IRange { + + /** + * Constructs a new Range. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IRange); + + /** Range min. */ + public min: number; + + /** Range max. */ + public max: number; + + /** + * Creates a new Range instance using the specified properties. + * @param [properties] Properties to set + * @returns Range instance + */ + public static create(properties?: google.monitoring.v3.IRange): google.monitoring.v3.Range; + + /** + * Encodes the specified Range message. Does not implicitly {@link google.monitoring.v3.Range.verify|verify} messages. + * @param message Range message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Range message, length delimited. Does not implicitly {@link google.monitoring.v3.Range.verify|verify} messages. + * @param message Range message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Range message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Range + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.Range; + + /** + * Decodes a Range message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Range + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.Range; + + /** + * Verifies a Range message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Range message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Range + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.Range; + + /** + * Creates a plain object from a Range message. Also converts values to other types if specified. + * @param message Range + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.Range, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Range to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Range + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RequestBasedSli. */ + interface IRequestBasedSli { + + /** RequestBasedSli goodTotalRatio */ + goodTotalRatio?: (google.monitoring.v3.ITimeSeriesRatio|null); + + /** RequestBasedSli distributionCut */ + distributionCut?: (google.monitoring.v3.IDistributionCut|null); + } + + /** Represents a RequestBasedSli. */ + class RequestBasedSli implements IRequestBasedSli { + + /** + * Constructs a new RequestBasedSli. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IRequestBasedSli); + + /** RequestBasedSli goodTotalRatio. */ + public goodTotalRatio?: (google.monitoring.v3.ITimeSeriesRatio|null); + + /** RequestBasedSli distributionCut. */ + public distributionCut?: (google.monitoring.v3.IDistributionCut|null); + + /** RequestBasedSli method. */ + public method?: ("goodTotalRatio"|"distributionCut"); + + /** + * Creates a new RequestBasedSli instance using the specified properties. + * @param [properties] Properties to set + * @returns RequestBasedSli instance + */ + public static create(properties?: google.monitoring.v3.IRequestBasedSli): google.monitoring.v3.RequestBasedSli; + + /** + * Encodes the specified RequestBasedSli message. Does not implicitly {@link google.monitoring.v3.RequestBasedSli.verify|verify} messages. + * @param message RequestBasedSli message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IRequestBasedSli, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RequestBasedSli message, length delimited. Does not implicitly {@link google.monitoring.v3.RequestBasedSli.verify|verify} messages. + * @param message RequestBasedSli message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IRequestBasedSli, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RequestBasedSli message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RequestBasedSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.RequestBasedSli; + + /** + * Decodes a RequestBasedSli message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RequestBasedSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.RequestBasedSli; + + /** + * Verifies a RequestBasedSli message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RequestBasedSli message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RequestBasedSli + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.RequestBasedSli; + + /** + * Creates a plain object from a RequestBasedSli message. Also converts values to other types if specified. + * @param message RequestBasedSli + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.RequestBasedSli, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RequestBasedSli to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RequestBasedSli + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TimeSeriesRatio. */ + interface ITimeSeriesRatio { + + /** TimeSeriesRatio goodServiceFilter */ + goodServiceFilter?: (string|null); + + /** TimeSeriesRatio badServiceFilter */ + badServiceFilter?: (string|null); + + /** TimeSeriesRatio totalServiceFilter */ + totalServiceFilter?: (string|null); + } + + /** Represents a TimeSeriesRatio. */ + class TimeSeriesRatio implements ITimeSeriesRatio { + + /** + * Constructs a new TimeSeriesRatio. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ITimeSeriesRatio); + + /** TimeSeriesRatio goodServiceFilter. */ + public goodServiceFilter: string; + + /** TimeSeriesRatio badServiceFilter. */ + public badServiceFilter: string; + + /** TimeSeriesRatio totalServiceFilter. */ + public totalServiceFilter: string; + + /** + * Creates a new TimeSeriesRatio instance using the specified properties. + * @param [properties] Properties to set + * @returns TimeSeriesRatio instance + */ + public static create(properties?: google.monitoring.v3.ITimeSeriesRatio): google.monitoring.v3.TimeSeriesRatio; + + /** + * Encodes the specified TimeSeriesRatio message. Does not implicitly {@link google.monitoring.v3.TimeSeriesRatio.verify|verify} messages. + * @param message TimeSeriesRatio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ITimeSeriesRatio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TimeSeriesRatio message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesRatio.verify|verify} messages. + * @param message TimeSeriesRatio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ITimeSeriesRatio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TimeSeriesRatio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TimeSeriesRatio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.TimeSeriesRatio; + + /** + * Decodes a TimeSeriesRatio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TimeSeriesRatio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.TimeSeriesRatio; + + /** + * Verifies a TimeSeriesRatio message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TimeSeriesRatio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TimeSeriesRatio + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.TimeSeriesRatio; + + /** + * Creates a plain object from a TimeSeriesRatio message. Also converts values to other types if specified. + * @param message TimeSeriesRatio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.TimeSeriesRatio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TimeSeriesRatio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TimeSeriesRatio + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DistributionCut. */ + interface IDistributionCut { + + /** DistributionCut distributionFilter */ + distributionFilter?: (string|null); + + /** DistributionCut range */ + range?: (google.monitoring.v3.IRange|null); + } + + /** Represents a DistributionCut. */ + class DistributionCut implements IDistributionCut { + + /** + * Constructs a new DistributionCut. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDistributionCut); + + /** DistributionCut distributionFilter. */ + public distributionFilter: string; + + /** DistributionCut range. */ + public range?: (google.monitoring.v3.IRange|null); + + /** + * Creates a new DistributionCut instance using the specified properties. + * @param [properties] Properties to set + * @returns DistributionCut instance + */ + public static create(properties?: google.monitoring.v3.IDistributionCut): google.monitoring.v3.DistributionCut; + + /** + * Encodes the specified DistributionCut message. Does not implicitly {@link google.monitoring.v3.DistributionCut.verify|verify} messages. + * @param message DistributionCut message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDistributionCut, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DistributionCut message, length delimited. Does not implicitly {@link google.monitoring.v3.DistributionCut.verify|verify} messages. + * @param message DistributionCut message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDistributionCut, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DistributionCut message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DistributionCut + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DistributionCut; + + /** + * Decodes a DistributionCut message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DistributionCut + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DistributionCut; + + /** + * Verifies a DistributionCut message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DistributionCut message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DistributionCut + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DistributionCut; + + /** + * Creates a plain object from a DistributionCut message. Also converts values to other types if specified. + * @param message DistributionCut + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DistributionCut, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DistributionCut to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DistributionCut + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WindowsBasedSli. */ + interface IWindowsBasedSli { + + /** WindowsBasedSli goodBadMetricFilter */ + goodBadMetricFilter?: (string|null); + + /** WindowsBasedSli goodTotalRatioThreshold */ + goodTotalRatioThreshold?: (google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold|null); + + /** WindowsBasedSli metricMeanInRange */ + metricMeanInRange?: (google.monitoring.v3.WindowsBasedSli.IMetricRange|null); + + /** WindowsBasedSli metricSumInRange */ + metricSumInRange?: (google.monitoring.v3.WindowsBasedSli.IMetricRange|null); + + /** WindowsBasedSli windowPeriod */ + windowPeriod?: (google.protobuf.IDuration|null); + } + + /** Represents a WindowsBasedSli. */ + class WindowsBasedSli implements IWindowsBasedSli { + + /** + * Constructs a new WindowsBasedSli. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IWindowsBasedSli); + + /** WindowsBasedSli goodBadMetricFilter. */ + public goodBadMetricFilter?: (string|null); + + /** WindowsBasedSli goodTotalRatioThreshold. */ + public goodTotalRatioThreshold?: (google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold|null); + + /** WindowsBasedSli metricMeanInRange. */ + public metricMeanInRange?: (google.monitoring.v3.WindowsBasedSli.IMetricRange|null); + + /** WindowsBasedSli metricSumInRange. */ + public metricSumInRange?: (google.monitoring.v3.WindowsBasedSli.IMetricRange|null); + + /** WindowsBasedSli windowPeriod. */ + public windowPeriod?: (google.protobuf.IDuration|null); + + /** WindowsBasedSli windowCriterion. */ + public windowCriterion?: ("goodBadMetricFilter"|"goodTotalRatioThreshold"|"metricMeanInRange"|"metricSumInRange"); + + /** + * Creates a new WindowsBasedSli instance using the specified properties. + * @param [properties] Properties to set + * @returns WindowsBasedSli instance + */ + public static create(properties?: google.monitoring.v3.IWindowsBasedSli): google.monitoring.v3.WindowsBasedSli; + + /** + * Encodes the specified WindowsBasedSli message. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.verify|verify} messages. + * @param message WindowsBasedSli message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IWindowsBasedSli, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WindowsBasedSli message, length delimited. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.verify|verify} messages. + * @param message WindowsBasedSli message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IWindowsBasedSli, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WindowsBasedSli message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WindowsBasedSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.WindowsBasedSli; + + /** + * Decodes a WindowsBasedSli message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WindowsBasedSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.WindowsBasedSli; + + /** + * Verifies a WindowsBasedSli message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WindowsBasedSli message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WindowsBasedSli + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.WindowsBasedSli; + + /** + * Creates a plain object from a WindowsBasedSli message. Also converts values to other types if specified. + * @param message WindowsBasedSli + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.WindowsBasedSli, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WindowsBasedSli to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WindowsBasedSli + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace WindowsBasedSli { + + /** Properties of a PerformanceThreshold. */ + interface IPerformanceThreshold { + + /** PerformanceThreshold performance */ + performance?: (google.monitoring.v3.IRequestBasedSli|null); + + /** PerformanceThreshold basicSliPerformance */ + basicSliPerformance?: (google.monitoring.v3.IBasicSli|null); + + /** PerformanceThreshold threshold */ + threshold?: (number|null); + } + + /** Represents a PerformanceThreshold. */ + class PerformanceThreshold implements IPerformanceThreshold { + + /** + * Constructs a new PerformanceThreshold. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold); + + /** PerformanceThreshold performance. */ + public performance?: (google.monitoring.v3.IRequestBasedSli|null); + + /** PerformanceThreshold basicSliPerformance. */ + public basicSliPerformance?: (google.monitoring.v3.IBasicSli|null); + + /** PerformanceThreshold threshold. */ + public threshold: number; + + /** PerformanceThreshold type. */ + public type?: ("performance"|"basicSliPerformance"); + + /** + * Creates a new PerformanceThreshold instance using the specified properties. + * @param [properties] Properties to set + * @returns PerformanceThreshold instance + */ + public static create(properties?: google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold): google.monitoring.v3.WindowsBasedSli.PerformanceThreshold; + + /** + * Encodes the specified PerformanceThreshold message. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.verify|verify} messages. + * @param message PerformanceThreshold message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PerformanceThreshold message, length delimited. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.verify|verify} messages. + * @param message PerformanceThreshold message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PerformanceThreshold message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PerformanceThreshold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.WindowsBasedSli.PerformanceThreshold; + + /** + * Decodes a PerformanceThreshold message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PerformanceThreshold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.WindowsBasedSli.PerformanceThreshold; + + /** + * Verifies a PerformanceThreshold message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PerformanceThreshold message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PerformanceThreshold + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.WindowsBasedSli.PerformanceThreshold; + + /** + * Creates a plain object from a PerformanceThreshold message. Also converts values to other types if specified. + * @param message PerformanceThreshold + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.WindowsBasedSli.PerformanceThreshold, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PerformanceThreshold to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PerformanceThreshold + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MetricRange. */ + interface IMetricRange { + + /** MetricRange timeSeries */ + timeSeries?: (string|null); + + /** MetricRange range */ + range?: (google.monitoring.v3.IRange|null); + } + + /** Represents a MetricRange. */ + class MetricRange implements IMetricRange { + + /** + * Constructs a new MetricRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.WindowsBasedSli.IMetricRange); + + /** MetricRange timeSeries. */ + public timeSeries: string; + + /** MetricRange range. */ + public range?: (google.monitoring.v3.IRange|null); + + /** + * Creates a new MetricRange instance using the specified properties. + * @param [properties] Properties to set + * @returns MetricRange instance + */ + public static create(properties?: google.monitoring.v3.WindowsBasedSli.IMetricRange): google.monitoring.v3.WindowsBasedSli.MetricRange; + + /** + * Encodes the specified MetricRange message. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.MetricRange.verify|verify} messages. + * @param message MetricRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.WindowsBasedSli.IMetricRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MetricRange message, length delimited. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.MetricRange.verify|verify} messages. + * @param message MetricRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.WindowsBasedSli.IMetricRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MetricRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MetricRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.WindowsBasedSli.MetricRange; + + /** + * Decodes a MetricRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MetricRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.WindowsBasedSli.MetricRange; + + /** + * Verifies a MetricRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MetricRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MetricRange + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.WindowsBasedSli.MetricRange; + + /** + * Creates a plain object from a MetricRange message. Also converts values to other types if specified. + * @param message MetricRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.WindowsBasedSli.MetricRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MetricRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MetricRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Represents a ServiceMonitoringService */ + class ServiceMonitoringService extends $protobuf.rpc.Service { + + /** + * Constructs a new ServiceMonitoringService 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 ServiceMonitoringService 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): ServiceMonitoringService; + + /** + * Calls CreateService. + * @param request CreateServiceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Service + */ + public createService(request: google.monitoring.v3.ICreateServiceRequest, callback: google.monitoring.v3.ServiceMonitoringService.CreateServiceCallback): void; + + /** + * Calls CreateService. + * @param request CreateServiceRequest message or plain object + * @returns Promise + */ + public createService(request: google.monitoring.v3.ICreateServiceRequest): Promise; + + /** + * Calls GetService. + * @param request GetServiceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Service + */ + public getService(request: google.monitoring.v3.IGetServiceRequest, callback: google.monitoring.v3.ServiceMonitoringService.GetServiceCallback): void; + + /** + * Calls GetService. + * @param request GetServiceRequest message or plain object + * @returns Promise + */ + public getService(request: google.monitoring.v3.IGetServiceRequest): Promise; + + /** + * 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.monitoring.v3.IListServicesRequest, callback: google.monitoring.v3.ServiceMonitoringService.ListServicesCallback): void; + + /** + * Calls ListServices. + * @param request ListServicesRequest message or plain object + * @returns Promise + */ + public listServices(request: google.monitoring.v3.IListServicesRequest): Promise; + + /** + * Calls UpdateService. + * @param request UpdateServiceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Service + */ + public updateService(request: google.monitoring.v3.IUpdateServiceRequest, callback: google.monitoring.v3.ServiceMonitoringService.UpdateServiceCallback): void; + + /** + * Calls UpdateService. + * @param request UpdateServiceRequest message or plain object + * @returns Promise + */ + public updateService(request: google.monitoring.v3.IUpdateServiceRequest): Promise; + + /** + * Calls DeleteService. + * @param request DeleteServiceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteService(request: google.monitoring.v3.IDeleteServiceRequest, callback: google.monitoring.v3.ServiceMonitoringService.DeleteServiceCallback): void; + + /** + * Calls DeleteService. + * @param request DeleteServiceRequest message or plain object + * @returns Promise + */ + public deleteService(request: google.monitoring.v3.IDeleteServiceRequest): Promise; + + /** + * Calls CreateServiceLevelObjective. + * @param request CreateServiceLevelObjectiveRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServiceLevelObjective + */ + public createServiceLevelObjective(request: google.monitoring.v3.ICreateServiceLevelObjectiveRequest, callback: google.monitoring.v3.ServiceMonitoringService.CreateServiceLevelObjectiveCallback): void; + + /** + * Calls CreateServiceLevelObjective. + * @param request CreateServiceLevelObjectiveRequest message or plain object + * @returns Promise + */ + public createServiceLevelObjective(request: google.monitoring.v3.ICreateServiceLevelObjectiveRequest): Promise; + + /** + * Calls GetServiceLevelObjective. + * @param request GetServiceLevelObjectiveRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServiceLevelObjective + */ + public getServiceLevelObjective(request: google.monitoring.v3.IGetServiceLevelObjectiveRequest, callback: google.monitoring.v3.ServiceMonitoringService.GetServiceLevelObjectiveCallback): void; + + /** + * Calls GetServiceLevelObjective. + * @param request GetServiceLevelObjectiveRequest message or plain object + * @returns Promise + */ + public getServiceLevelObjective(request: google.monitoring.v3.IGetServiceLevelObjectiveRequest): Promise; + + /** + * Calls ListServiceLevelObjectives. + * @param request ListServiceLevelObjectivesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListServiceLevelObjectivesResponse + */ + public listServiceLevelObjectives(request: google.monitoring.v3.IListServiceLevelObjectivesRequest, callback: google.monitoring.v3.ServiceMonitoringService.ListServiceLevelObjectivesCallback): void; + + /** + * Calls ListServiceLevelObjectives. + * @param request ListServiceLevelObjectivesRequest message or plain object + * @returns Promise + */ + public listServiceLevelObjectives(request: google.monitoring.v3.IListServiceLevelObjectivesRequest): Promise; + + /** + * Calls UpdateServiceLevelObjective. + * @param request UpdateServiceLevelObjectiveRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ServiceLevelObjective + */ + public updateServiceLevelObjective(request: google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, callback: google.monitoring.v3.ServiceMonitoringService.UpdateServiceLevelObjectiveCallback): void; + + /** + * Calls UpdateServiceLevelObjective. + * @param request UpdateServiceLevelObjectiveRequest message or plain object + * @returns Promise + */ + public updateServiceLevelObjective(request: google.monitoring.v3.IUpdateServiceLevelObjectiveRequest): Promise; + + /** + * Calls DeleteServiceLevelObjective. + * @param request DeleteServiceLevelObjectiveRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteServiceLevelObjective(request: google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, callback: google.monitoring.v3.ServiceMonitoringService.DeleteServiceLevelObjectiveCallback): void; + + /** + * Calls DeleteServiceLevelObjective. + * @param request DeleteServiceLevelObjectiveRequest message or plain object + * @returns Promise + */ + public deleteServiceLevelObjective(request: google.monitoring.v3.IDeleteServiceLevelObjectiveRequest): Promise; + } + + namespace ServiceMonitoringService { + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|createService}. + * @param error Error, if any + * @param [response] Service + */ + type CreateServiceCallback = (error: (Error|null), response?: google.monitoring.v3.Service) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|getService}. + * @param error Error, if any + * @param [response] Service + */ + type GetServiceCallback = (error: (Error|null), response?: google.monitoring.v3.Service) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|listServices}. + * @param error Error, if any + * @param [response] ListServicesResponse + */ + type ListServicesCallback = (error: (Error|null), response?: google.monitoring.v3.ListServicesResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|updateService}. + * @param error Error, if any + * @param [response] Service + */ + type UpdateServiceCallback = (error: (Error|null), response?: google.monitoring.v3.Service) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|deleteService}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteServiceCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|createServiceLevelObjective}. + * @param error Error, if any + * @param [response] ServiceLevelObjective + */ + type CreateServiceLevelObjectiveCallback = (error: (Error|null), response?: google.monitoring.v3.ServiceLevelObjective) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|getServiceLevelObjective}. + * @param error Error, if any + * @param [response] ServiceLevelObjective + */ + type GetServiceLevelObjectiveCallback = (error: (Error|null), response?: google.monitoring.v3.ServiceLevelObjective) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|listServiceLevelObjectives}. + * @param error Error, if any + * @param [response] ListServiceLevelObjectivesResponse + */ + type ListServiceLevelObjectivesCallback = (error: (Error|null), response?: google.monitoring.v3.ListServiceLevelObjectivesResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|updateServiceLevelObjective}. + * @param error Error, if any + * @param [response] ServiceLevelObjective + */ + type UpdateServiceLevelObjectiveCallback = (error: (Error|null), response?: google.monitoring.v3.ServiceLevelObjective) => void; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|deleteServiceLevelObjective}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteServiceLevelObjectiveCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a CreateServiceRequest. */ + interface ICreateServiceRequest { + + /** CreateServiceRequest parent */ + parent?: (string|null); + + /** CreateServiceRequest serviceId */ + serviceId?: (string|null); + + /** CreateServiceRequest service */ + service?: (google.monitoring.v3.IService|null); + } + + /** Represents a CreateServiceRequest. */ + class CreateServiceRequest implements ICreateServiceRequest { + + /** + * Constructs a new CreateServiceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateServiceRequest); + + /** CreateServiceRequest parent. */ + public parent: string; + + /** CreateServiceRequest serviceId. */ + public serviceId: string; + + /** CreateServiceRequest service. */ + public service?: (google.monitoring.v3.IService|null); + + /** + * Creates a new CreateServiceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateServiceRequest instance + */ + public static create(properties?: google.monitoring.v3.ICreateServiceRequest): google.monitoring.v3.CreateServiceRequest; + + /** + * Encodes the specified CreateServiceRequest message. Does not implicitly {@link google.monitoring.v3.CreateServiceRequest.verify|verify} messages. + * @param message CreateServiceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateServiceRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateServiceRequest.verify|verify} messages. + * @param message CreateServiceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateServiceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateServiceRequest; + + /** + * Decodes a CreateServiceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateServiceRequest; + + /** + * Verifies a CreateServiceRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateServiceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateServiceRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateServiceRequest; + + /** + * Creates a plain object from a CreateServiceRequest message. Also converts values to other types if specified. + * @param message CreateServiceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateServiceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateServiceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateServiceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetServiceRequest. */ + interface IGetServiceRequest { + + /** GetServiceRequest name */ + name?: (string|null); + } + + /** Represents a GetServiceRequest. */ + class GetServiceRequest implements IGetServiceRequest { + + /** + * Constructs a new GetServiceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetServiceRequest); + + /** GetServiceRequest name. */ + public name: string; + + /** + * Creates a new GetServiceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetServiceRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetServiceRequest): google.monitoring.v3.GetServiceRequest; + + /** + * Encodes the specified GetServiceRequest message. Does not implicitly {@link google.monitoring.v3.GetServiceRequest.verify|verify} messages. + * @param message GetServiceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetServiceRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetServiceRequest.verify|verify} messages. + * @param message GetServiceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetServiceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetServiceRequest; + + /** + * Decodes a GetServiceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetServiceRequest; + + /** + * Verifies a GetServiceRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetServiceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetServiceRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetServiceRequest; + + /** + * Creates a plain object from a GetServiceRequest message. Also converts values to other types if specified. + * @param message GetServiceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetServiceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetServiceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetServiceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListServicesRequest. */ + interface IListServicesRequest { + + /** ListServicesRequest parent */ + parent?: (string|null); + + /** ListServicesRequest filter */ + filter?: (string|null); + + /** 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.monitoring.v3.IListServicesRequest); + + /** ListServicesRequest parent. */ + public parent: string; + + /** ListServicesRequest filter. */ + public filter: string; + + /** 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.monitoring.v3.IListServicesRequest): google.monitoring.v3.ListServicesRequest; + + /** + * Encodes the specified ListServicesRequest message. Does not implicitly {@link google.monitoring.v3.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.monitoring.v3.IListServicesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListServicesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.ListServicesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListServicesRequest to JSON. + * @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. */ + interface IListServicesResponse { + + /** ListServicesResponse services */ + services?: (google.monitoring.v3.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.monitoring.v3.IListServicesResponse); + + /** ListServicesResponse services. */ + public services: google.monitoring.v3.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.monitoring.v3.IListServicesResponse): google.monitoring.v3.ListServicesResponse; + + /** + * Encodes the specified ListServicesResponse message. Does not implicitly {@link google.monitoring.v3.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.monitoring.v3.IListServicesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListServicesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.ListServicesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListServicesResponse to JSON. + * @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 an UpdateServiceRequest. */ + interface IUpdateServiceRequest { + + /** UpdateServiceRequest service */ + service?: (google.monitoring.v3.IService|null); + + /** UpdateServiceRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateServiceRequest. */ + class UpdateServiceRequest implements IUpdateServiceRequest { + + /** + * Constructs a new UpdateServiceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IUpdateServiceRequest); + + /** UpdateServiceRequest service. */ + public service?: (google.monitoring.v3.IService|null); + + /** UpdateServiceRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateServiceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateServiceRequest instance + */ + public static create(properties?: google.monitoring.v3.IUpdateServiceRequest): google.monitoring.v3.UpdateServiceRequest; + + /** + * Encodes the specified UpdateServiceRequest message. Does not implicitly {@link google.monitoring.v3.UpdateServiceRequest.verify|verify} messages. + * @param message UpdateServiceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IUpdateServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateServiceRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateServiceRequest.verify|verify} messages. + * @param message UpdateServiceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IUpdateServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateServiceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UpdateServiceRequest; + + /** + * Decodes an UpdateServiceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UpdateServiceRequest; + + /** + * Verifies an UpdateServiceRequest message. + * @param message Plain 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 UpdateServiceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateServiceRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UpdateServiceRequest; + + /** + * Creates a plain object from an UpdateServiceRequest message. Also converts values to other types if specified. + * @param message UpdateServiceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UpdateServiceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateServiceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateServiceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteServiceRequest. */ + interface IDeleteServiceRequest { + + /** DeleteServiceRequest name */ + name?: (string|null); + } + + /** Represents a DeleteServiceRequest. */ + class DeleteServiceRequest implements IDeleteServiceRequest { + + /** + * Constructs a new DeleteServiceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDeleteServiceRequest); + + /** DeleteServiceRequest name. */ + public name: string; + + /** + * Creates a new DeleteServiceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteServiceRequest instance + */ + public static create(properties?: google.monitoring.v3.IDeleteServiceRequest): google.monitoring.v3.DeleteServiceRequest; + + /** + * Encodes the specified DeleteServiceRequest message. Does not implicitly {@link google.monitoring.v3.DeleteServiceRequest.verify|verify} messages. + * @param message DeleteServiceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDeleteServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteServiceRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteServiceRequest.verify|verify} messages. + * @param message DeleteServiceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDeleteServiceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteServiceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DeleteServiceRequest; + + /** + * Decodes a DeleteServiceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DeleteServiceRequest; + + /** + * Verifies a DeleteServiceRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteServiceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteServiceRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DeleteServiceRequest; + + /** + * Creates a plain object from a DeleteServiceRequest message. Also converts values to other types if specified. + * @param message DeleteServiceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DeleteServiceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteServiceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteServiceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateServiceLevelObjectiveRequest. */ + interface ICreateServiceLevelObjectiveRequest { + + /** CreateServiceLevelObjectiveRequest parent */ + parent?: (string|null); + + /** CreateServiceLevelObjectiveRequest serviceLevelObjectiveId */ + serviceLevelObjectiveId?: (string|null); + + /** CreateServiceLevelObjectiveRequest serviceLevelObjective */ + serviceLevelObjective?: (google.monitoring.v3.IServiceLevelObjective|null); + } + + /** Represents a CreateServiceLevelObjectiveRequest. */ + class CreateServiceLevelObjectiveRequest implements ICreateServiceLevelObjectiveRequest { + + /** + * Constructs a new CreateServiceLevelObjectiveRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateServiceLevelObjectiveRequest); + + /** CreateServiceLevelObjectiveRequest parent. */ + public parent: string; + + /** CreateServiceLevelObjectiveRequest serviceLevelObjectiveId. */ + public serviceLevelObjectiveId: string; + + /** CreateServiceLevelObjectiveRequest serviceLevelObjective. */ + public serviceLevelObjective?: (google.monitoring.v3.IServiceLevelObjective|null); + + /** + * Creates a new CreateServiceLevelObjectiveRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateServiceLevelObjectiveRequest instance + */ + public static create(properties?: google.monitoring.v3.ICreateServiceLevelObjectiveRequest): google.monitoring.v3.CreateServiceLevelObjectiveRequest; + + /** + * Encodes the specified CreateServiceLevelObjectiveRequest message. Does not implicitly {@link google.monitoring.v3.CreateServiceLevelObjectiveRequest.verify|verify} messages. + * @param message CreateServiceLevelObjectiveRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateServiceLevelObjectiveRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateServiceLevelObjectiveRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateServiceLevelObjectiveRequest.verify|verify} messages. + * @param message CreateServiceLevelObjectiveRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateServiceLevelObjectiveRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateServiceLevelObjectiveRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateServiceLevelObjectiveRequest; + + /** + * Decodes a CreateServiceLevelObjectiveRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateServiceLevelObjectiveRequest; + + /** + * Verifies a CreateServiceLevelObjectiveRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateServiceLevelObjectiveRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateServiceLevelObjectiveRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateServiceLevelObjectiveRequest; + + /** + * Creates a plain object from a CreateServiceLevelObjectiveRequest message. Also converts values to other types if specified. + * @param message CreateServiceLevelObjectiveRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateServiceLevelObjectiveRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateServiceLevelObjectiveRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateServiceLevelObjectiveRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetServiceLevelObjectiveRequest. */ + interface IGetServiceLevelObjectiveRequest { + + /** GetServiceLevelObjectiveRequest name */ + name?: (string|null); + + /** GetServiceLevelObjectiveRequest view */ + view?: (google.monitoring.v3.ServiceLevelObjective.View|keyof typeof google.monitoring.v3.ServiceLevelObjective.View|null); + } + + /** Represents a GetServiceLevelObjectiveRequest. */ + class GetServiceLevelObjectiveRequest implements IGetServiceLevelObjectiveRequest { + + /** + * Constructs a new GetServiceLevelObjectiveRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetServiceLevelObjectiveRequest); + + /** GetServiceLevelObjectiveRequest name. */ + public name: string; + + /** GetServiceLevelObjectiveRequest view. */ + public view: (google.monitoring.v3.ServiceLevelObjective.View|keyof typeof google.monitoring.v3.ServiceLevelObjective.View); + + /** + * Creates a new GetServiceLevelObjectiveRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetServiceLevelObjectiveRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetServiceLevelObjectiveRequest): google.monitoring.v3.GetServiceLevelObjectiveRequest; + + /** + * Encodes the specified GetServiceLevelObjectiveRequest message. Does not implicitly {@link google.monitoring.v3.GetServiceLevelObjectiveRequest.verify|verify} messages. + * @param message GetServiceLevelObjectiveRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetServiceLevelObjectiveRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetServiceLevelObjectiveRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetServiceLevelObjectiveRequest.verify|verify} messages. + * @param message GetServiceLevelObjectiveRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetServiceLevelObjectiveRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetServiceLevelObjectiveRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetServiceLevelObjectiveRequest; + + /** + * Decodes a GetServiceLevelObjectiveRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetServiceLevelObjectiveRequest; + + /** + * Verifies a GetServiceLevelObjectiveRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetServiceLevelObjectiveRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetServiceLevelObjectiveRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetServiceLevelObjectiveRequest; + + /** + * Creates a plain object from a GetServiceLevelObjectiveRequest message. Also converts values to other types if specified. + * @param message GetServiceLevelObjectiveRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetServiceLevelObjectiveRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetServiceLevelObjectiveRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetServiceLevelObjectiveRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListServiceLevelObjectivesRequest. */ + interface IListServiceLevelObjectivesRequest { + + /** ListServiceLevelObjectivesRequest parent */ + parent?: (string|null); + + /** ListServiceLevelObjectivesRequest filter */ + filter?: (string|null); + + /** ListServiceLevelObjectivesRequest pageSize */ + pageSize?: (number|null); + + /** ListServiceLevelObjectivesRequest pageToken */ + pageToken?: (string|null); + + /** ListServiceLevelObjectivesRequest view */ + view?: (google.monitoring.v3.ServiceLevelObjective.View|keyof typeof google.monitoring.v3.ServiceLevelObjective.View|null); + } + + /** Represents a ListServiceLevelObjectivesRequest. */ + class ListServiceLevelObjectivesRequest implements IListServiceLevelObjectivesRequest { + + /** + * Constructs a new ListServiceLevelObjectivesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListServiceLevelObjectivesRequest); + + /** ListServiceLevelObjectivesRequest parent. */ + public parent: string; + + /** ListServiceLevelObjectivesRequest filter. */ + public filter: string; + + /** ListServiceLevelObjectivesRequest pageSize. */ + public pageSize: number; + + /** ListServiceLevelObjectivesRequest pageToken. */ + public pageToken: string; + + /** ListServiceLevelObjectivesRequest view. */ + public view: (google.monitoring.v3.ServiceLevelObjective.View|keyof typeof google.monitoring.v3.ServiceLevelObjective.View); + + /** + * Creates a new ListServiceLevelObjectivesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServiceLevelObjectivesRequest instance + */ + public static create(properties?: google.monitoring.v3.IListServiceLevelObjectivesRequest): google.monitoring.v3.ListServiceLevelObjectivesRequest; + + /** + * Encodes the specified ListServiceLevelObjectivesRequest message. Does not implicitly {@link google.monitoring.v3.ListServiceLevelObjectivesRequest.verify|verify} messages. + * @param message ListServiceLevelObjectivesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListServiceLevelObjectivesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListServiceLevelObjectivesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListServiceLevelObjectivesRequest.verify|verify} messages. + * @param message ListServiceLevelObjectivesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListServiceLevelObjectivesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListServiceLevelObjectivesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServiceLevelObjectivesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListServiceLevelObjectivesRequest; + + /** + * Decodes a ListServiceLevelObjectivesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServiceLevelObjectivesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListServiceLevelObjectivesRequest; + + /** + * Verifies a ListServiceLevelObjectivesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListServiceLevelObjectivesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServiceLevelObjectivesRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListServiceLevelObjectivesRequest; + + /** + * Creates a plain object from a ListServiceLevelObjectivesRequest message. Also converts values to other types if specified. + * @param message ListServiceLevelObjectivesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListServiceLevelObjectivesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListServiceLevelObjectivesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListServiceLevelObjectivesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListServiceLevelObjectivesResponse. */ + interface IListServiceLevelObjectivesResponse { + + /** ListServiceLevelObjectivesResponse serviceLevelObjectives */ + serviceLevelObjectives?: (google.monitoring.v3.IServiceLevelObjective[]|null); + + /** ListServiceLevelObjectivesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListServiceLevelObjectivesResponse. */ + class ListServiceLevelObjectivesResponse implements IListServiceLevelObjectivesResponse { + + /** + * Constructs a new ListServiceLevelObjectivesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListServiceLevelObjectivesResponse); + + /** ListServiceLevelObjectivesResponse serviceLevelObjectives. */ + public serviceLevelObjectives: google.monitoring.v3.IServiceLevelObjective[]; + + /** ListServiceLevelObjectivesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListServiceLevelObjectivesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListServiceLevelObjectivesResponse instance + */ + public static create(properties?: google.monitoring.v3.IListServiceLevelObjectivesResponse): google.monitoring.v3.ListServiceLevelObjectivesResponse; + + /** + * Encodes the specified ListServiceLevelObjectivesResponse message. Does not implicitly {@link google.monitoring.v3.ListServiceLevelObjectivesResponse.verify|verify} messages. + * @param message ListServiceLevelObjectivesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListServiceLevelObjectivesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListServiceLevelObjectivesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListServiceLevelObjectivesResponse.verify|verify} messages. + * @param message ListServiceLevelObjectivesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListServiceLevelObjectivesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListServiceLevelObjectivesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListServiceLevelObjectivesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListServiceLevelObjectivesResponse; + + /** + * Decodes a ListServiceLevelObjectivesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListServiceLevelObjectivesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListServiceLevelObjectivesResponse; + + /** + * Verifies a ListServiceLevelObjectivesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListServiceLevelObjectivesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListServiceLevelObjectivesResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListServiceLevelObjectivesResponse; + + /** + * Creates a plain object from a ListServiceLevelObjectivesResponse message. Also converts values to other types if specified. + * @param message ListServiceLevelObjectivesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListServiceLevelObjectivesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListServiceLevelObjectivesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListServiceLevelObjectivesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateServiceLevelObjectiveRequest. */ + interface IUpdateServiceLevelObjectiveRequest { + + /** UpdateServiceLevelObjectiveRequest serviceLevelObjective */ + serviceLevelObjective?: (google.monitoring.v3.IServiceLevelObjective|null); + + /** UpdateServiceLevelObjectiveRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateServiceLevelObjectiveRequest. */ + class UpdateServiceLevelObjectiveRequest implements IUpdateServiceLevelObjectiveRequest { + + /** + * Constructs a new UpdateServiceLevelObjectiveRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IUpdateServiceLevelObjectiveRequest); + + /** UpdateServiceLevelObjectiveRequest serviceLevelObjective. */ + public serviceLevelObjective?: (google.monitoring.v3.IServiceLevelObjective|null); + + /** UpdateServiceLevelObjectiveRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateServiceLevelObjectiveRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateServiceLevelObjectiveRequest instance + */ + public static create(properties?: google.monitoring.v3.IUpdateServiceLevelObjectiveRequest): google.monitoring.v3.UpdateServiceLevelObjectiveRequest; + + /** + * Encodes the specified UpdateServiceLevelObjectiveRequest message. Does not implicitly {@link google.monitoring.v3.UpdateServiceLevelObjectiveRequest.verify|verify} messages. + * @param message UpdateServiceLevelObjectiveRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateServiceLevelObjectiveRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateServiceLevelObjectiveRequest.verify|verify} messages. + * @param message UpdateServiceLevelObjectiveRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateServiceLevelObjectiveRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UpdateServiceLevelObjectiveRequest; + + /** + * Decodes an UpdateServiceLevelObjectiveRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UpdateServiceLevelObjectiveRequest; + + /** + * Verifies an UpdateServiceLevelObjectiveRequest message. + * @param message Plain 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 UpdateServiceLevelObjectiveRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateServiceLevelObjectiveRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UpdateServiceLevelObjectiveRequest; + + /** + * Creates a plain object from an UpdateServiceLevelObjectiveRequest message. Also converts values to other types if specified. + * @param message UpdateServiceLevelObjectiveRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UpdateServiceLevelObjectiveRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateServiceLevelObjectiveRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateServiceLevelObjectiveRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteServiceLevelObjectiveRequest. */ + interface IDeleteServiceLevelObjectiveRequest { + + /** DeleteServiceLevelObjectiveRequest name */ + name?: (string|null); + } + + /** Represents a DeleteServiceLevelObjectiveRequest. */ + class DeleteServiceLevelObjectiveRequest implements IDeleteServiceLevelObjectiveRequest { + + /** + * Constructs a new DeleteServiceLevelObjectiveRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDeleteServiceLevelObjectiveRequest); + + /** DeleteServiceLevelObjectiveRequest name. */ + public name: string; + + /** + * Creates a new DeleteServiceLevelObjectiveRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteServiceLevelObjectiveRequest instance + */ + public static create(properties?: google.monitoring.v3.IDeleteServiceLevelObjectiveRequest): google.monitoring.v3.DeleteServiceLevelObjectiveRequest; + + /** + * Encodes the specified DeleteServiceLevelObjectiveRequest message. Does not implicitly {@link google.monitoring.v3.DeleteServiceLevelObjectiveRequest.verify|verify} messages. + * @param message DeleteServiceLevelObjectiveRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteServiceLevelObjectiveRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteServiceLevelObjectiveRequest.verify|verify} messages. + * @param message DeleteServiceLevelObjectiveRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteServiceLevelObjectiveRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DeleteServiceLevelObjectiveRequest; + + /** + * Decodes a DeleteServiceLevelObjectiveRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DeleteServiceLevelObjectiveRequest; + + /** + * Verifies a DeleteServiceLevelObjectiveRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteServiceLevelObjectiveRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteServiceLevelObjectiveRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DeleteServiceLevelObjectiveRequest; + + /** + * Creates a plain object from a DeleteServiceLevelObjectiveRequest message. Also converts values to other types if specified. + * @param message DeleteServiceLevelObjectiveRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DeleteServiceLevelObjectiveRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteServiceLevelObjectiveRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteServiceLevelObjectiveRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SpanContext. */ + interface ISpanContext { + + /** SpanContext spanName */ + spanName?: (string|null); + } + + /** Represents a SpanContext. */ + class SpanContext implements ISpanContext { + + /** + * Constructs a new SpanContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ISpanContext); + + /** SpanContext spanName. */ + public spanName: string; + + /** + * Creates a new SpanContext instance using the specified properties. + * @param [properties] Properties to set + * @returns SpanContext instance + */ + public static create(properties?: google.monitoring.v3.ISpanContext): google.monitoring.v3.SpanContext; + + /** + * Encodes the specified SpanContext message. Does not implicitly {@link google.monitoring.v3.SpanContext.verify|verify} messages. + * @param message SpanContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ISpanContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpanContext message, length delimited. Does not implicitly {@link google.monitoring.v3.SpanContext.verify|verify} messages. + * @param message SpanContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ISpanContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpanContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpanContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.SpanContext; + + /** + * Decodes a SpanContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpanContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.SpanContext; + + /** + * Verifies a SpanContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpanContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpanContext + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.SpanContext; + + /** + * Creates a plain object from a SpanContext message. Also converts values to other types if specified. + * @param message SpanContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.SpanContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpanContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpanContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** UptimeCheckRegion enum. */ + enum UptimeCheckRegion { + REGION_UNSPECIFIED = 0, + USA = 1, + EUROPE = 2, + SOUTH_AMERICA = 3, + ASIA_PACIFIC = 4 + } + + /** Properties of an InternalChecker. */ + interface IInternalChecker { + + /** InternalChecker name */ + name?: (string|null); + + /** InternalChecker displayName */ + displayName?: (string|null); + + /** InternalChecker network */ + network?: (string|null); + + /** InternalChecker gcpZone */ + gcpZone?: (string|null); + + /** InternalChecker peerProjectId */ + peerProjectId?: (string|null); + + /** InternalChecker state */ + state?: (google.monitoring.v3.InternalChecker.State|keyof typeof google.monitoring.v3.InternalChecker.State|null); + } + + /** Represents an InternalChecker. */ + class InternalChecker implements IInternalChecker { + + /** + * Constructs a new InternalChecker. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IInternalChecker); + + /** InternalChecker name. */ + public name: string; + + /** InternalChecker displayName. */ + public displayName: string; + + /** InternalChecker network. */ + public network: string; + + /** InternalChecker gcpZone. */ + public gcpZone: string; + + /** InternalChecker peerProjectId. */ + public peerProjectId: string; + + /** InternalChecker state. */ + public state: (google.monitoring.v3.InternalChecker.State|keyof typeof google.monitoring.v3.InternalChecker.State); + + /** + * Creates a new InternalChecker instance using the specified properties. + * @param [properties] Properties to set + * @returns InternalChecker instance + */ + public static create(properties?: google.monitoring.v3.IInternalChecker): google.monitoring.v3.InternalChecker; + + /** + * Encodes the specified InternalChecker message. Does not implicitly {@link google.monitoring.v3.InternalChecker.verify|verify} messages. + * @param message InternalChecker message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IInternalChecker, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InternalChecker message, length delimited. Does not implicitly {@link google.monitoring.v3.InternalChecker.verify|verify} messages. + * @param message InternalChecker message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IInternalChecker, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InternalChecker message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InternalChecker + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.InternalChecker; + + /** + * Decodes an InternalChecker message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InternalChecker + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.InternalChecker; + + /** + * Verifies an InternalChecker message. + * @param message Plain 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 InternalChecker message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InternalChecker + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.InternalChecker; + + /** + * Creates a plain object from an InternalChecker message. Also converts values to other types if specified. + * @param message InternalChecker + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.InternalChecker, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InternalChecker to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InternalChecker + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace InternalChecker { + + /** State enum. */ + enum State { + UNSPECIFIED = 0, + CREATING = 1, + RUNNING = 2 + } + } + + /** Properties of an UptimeCheckConfig. */ + interface IUptimeCheckConfig { + + /** UptimeCheckConfig name */ + name?: (string|null); + + /** UptimeCheckConfig displayName */ + displayName?: (string|null); + + /** UptimeCheckConfig monitoredResource */ + monitoredResource?: (google.api.IMonitoredResource|null); + + /** UptimeCheckConfig resourceGroup */ + resourceGroup?: (google.monitoring.v3.UptimeCheckConfig.IResourceGroup|null); + + /** UptimeCheckConfig httpCheck */ + httpCheck?: (google.monitoring.v3.UptimeCheckConfig.IHttpCheck|null); + + /** UptimeCheckConfig tcpCheck */ + tcpCheck?: (google.monitoring.v3.UptimeCheckConfig.ITcpCheck|null); + + /** UptimeCheckConfig period */ + period?: (google.protobuf.IDuration|null); + + /** UptimeCheckConfig timeout */ + timeout?: (google.protobuf.IDuration|null); + + /** UptimeCheckConfig contentMatchers */ + contentMatchers?: (google.monitoring.v3.UptimeCheckConfig.IContentMatcher[]|null); + + /** UptimeCheckConfig selectedRegions */ + selectedRegions?: (google.monitoring.v3.UptimeCheckRegion[]|null); + + /** UptimeCheckConfig isInternal */ + isInternal?: (boolean|null); + + /** UptimeCheckConfig internalCheckers */ + internalCheckers?: (google.monitoring.v3.IInternalChecker[]|null); + } + + /** Represents an UptimeCheckConfig. */ + class UptimeCheckConfig implements IUptimeCheckConfig { + + /** + * Constructs a new UptimeCheckConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IUptimeCheckConfig); + + /** UptimeCheckConfig name. */ + public name: string; + + /** UptimeCheckConfig displayName. */ + public displayName: string; + + /** UptimeCheckConfig monitoredResource. */ + public monitoredResource?: (google.api.IMonitoredResource|null); + + /** UptimeCheckConfig resourceGroup. */ + public resourceGroup?: (google.monitoring.v3.UptimeCheckConfig.IResourceGroup|null); + + /** UptimeCheckConfig httpCheck. */ + public httpCheck?: (google.monitoring.v3.UptimeCheckConfig.IHttpCheck|null); + + /** UptimeCheckConfig tcpCheck. */ + public tcpCheck?: (google.monitoring.v3.UptimeCheckConfig.ITcpCheck|null); + + /** UptimeCheckConfig period. */ + public period?: (google.protobuf.IDuration|null); + + /** UptimeCheckConfig timeout. */ + public timeout?: (google.protobuf.IDuration|null); + + /** UptimeCheckConfig contentMatchers. */ + public contentMatchers: google.monitoring.v3.UptimeCheckConfig.IContentMatcher[]; + + /** UptimeCheckConfig selectedRegions. */ + public selectedRegions: google.monitoring.v3.UptimeCheckRegion[]; + + /** UptimeCheckConfig isInternal. */ + public isInternal: boolean; + + /** UptimeCheckConfig internalCheckers. */ + public internalCheckers: google.monitoring.v3.IInternalChecker[]; + + /** UptimeCheckConfig resource. */ + public resource?: ("monitoredResource"|"resourceGroup"); + + /** UptimeCheckConfig checkRequestType. */ + public checkRequestType?: ("httpCheck"|"tcpCheck"); + + /** + * Creates a new UptimeCheckConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns UptimeCheckConfig instance + */ + public static create(properties?: google.monitoring.v3.IUptimeCheckConfig): google.monitoring.v3.UptimeCheckConfig; + + /** + * Encodes the specified UptimeCheckConfig message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.verify|verify} messages. + * @param message UptimeCheckConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IUptimeCheckConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UptimeCheckConfig message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.verify|verify} messages. + * @param message UptimeCheckConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IUptimeCheckConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UptimeCheckConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UptimeCheckConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UptimeCheckConfig; + + /** + * Decodes an UptimeCheckConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UptimeCheckConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UptimeCheckConfig; + + /** + * Verifies an UptimeCheckConfig message. + * @param message Plain 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 UptimeCheckConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UptimeCheckConfig + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UptimeCheckConfig; + + /** + * Creates a plain object from an UptimeCheckConfig message. Also converts values to other types if specified. + * @param message UptimeCheckConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UptimeCheckConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UptimeCheckConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UptimeCheckConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UptimeCheckConfig { + + /** Properties of a ResourceGroup. */ + interface IResourceGroup { + + /** ResourceGroup groupId */ + groupId?: (string|null); + + /** ResourceGroup resourceType */ + resourceType?: (google.monitoring.v3.GroupResourceType|keyof typeof google.monitoring.v3.GroupResourceType|null); + } + + /** Represents a ResourceGroup. */ + class ResourceGroup implements IResourceGroup { + + /** + * Constructs a new ResourceGroup. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.UptimeCheckConfig.IResourceGroup); + + /** ResourceGroup groupId. */ + public groupId: string; + + /** ResourceGroup resourceType. */ + public resourceType: (google.monitoring.v3.GroupResourceType|keyof typeof google.monitoring.v3.GroupResourceType); + + /** + * Creates a new ResourceGroup instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceGroup instance + */ + public static create(properties?: google.monitoring.v3.UptimeCheckConfig.IResourceGroup): google.monitoring.v3.UptimeCheckConfig.ResourceGroup; + + /** + * Encodes the specified ResourceGroup message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.ResourceGroup.verify|verify} messages. + * @param message ResourceGroup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.UptimeCheckConfig.IResourceGroup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceGroup message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.ResourceGroup.verify|verify} messages. + * @param message ResourceGroup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.UptimeCheckConfig.IResourceGroup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceGroup message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UptimeCheckConfig.ResourceGroup; + + /** + * Decodes a ResourceGroup message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UptimeCheckConfig.ResourceGroup; + + /** + * Verifies a ResourceGroup message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceGroup message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceGroup + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UptimeCheckConfig.ResourceGroup; + + /** + * Creates a plain object from a ResourceGroup message. Also converts values to other types if specified. + * @param message ResourceGroup + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UptimeCheckConfig.ResourceGroup, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceGroup to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceGroup + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HttpCheck. */ + interface IHttpCheck { + + /** HttpCheck requestMethod */ + requestMethod?: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod|keyof typeof google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod|null); + + /** HttpCheck useSsl */ + useSsl?: (boolean|null); + + /** HttpCheck path */ + path?: (string|null); + + /** HttpCheck port */ + port?: (number|null); + + /** HttpCheck authInfo */ + authInfo?: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication|null); + + /** HttpCheck maskHeaders */ + maskHeaders?: (boolean|null); + + /** HttpCheck headers */ + headers?: ({ [k: string]: string }|null); + + /** HttpCheck contentType */ + contentType?: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType|keyof typeof google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType|null); + + /** HttpCheck validateSsl */ + validateSsl?: (boolean|null); + + /** HttpCheck body */ + body?: (Uint8Array|string|null); + } + + /** Represents a HttpCheck. */ + class HttpCheck implements IHttpCheck { + + /** + * Constructs a new HttpCheck. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.UptimeCheckConfig.IHttpCheck); + + /** HttpCheck requestMethod. */ + public requestMethod: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod|keyof typeof google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod); + + /** HttpCheck useSsl. */ + public useSsl: boolean; + + /** HttpCheck path. */ + public path: string; + + /** HttpCheck port. */ + public port: number; + + /** HttpCheck authInfo. */ + public authInfo?: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication|null); + + /** HttpCheck maskHeaders. */ + public maskHeaders: boolean; + + /** HttpCheck headers. */ + public headers: { [k: string]: string }; + + /** HttpCheck contentType. */ + public contentType: (google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType|keyof typeof google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType); + + /** HttpCheck validateSsl. */ + public validateSsl: boolean; + + /** HttpCheck body. */ + public body: (Uint8Array|string); + + /** + * Creates a new HttpCheck instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpCheck instance + */ + public static create(properties?: google.monitoring.v3.UptimeCheckConfig.IHttpCheck): google.monitoring.v3.UptimeCheckConfig.HttpCheck; + + /** + * Encodes the specified HttpCheck message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.HttpCheck.verify|verify} messages. + * @param message HttpCheck message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.UptimeCheckConfig.IHttpCheck, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpCheck message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.HttpCheck.verify|verify} messages. + * @param message HttpCheck message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.UptimeCheckConfig.IHttpCheck, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpCheck message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpCheck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UptimeCheckConfig.HttpCheck; + + /** + * Decodes a HttpCheck message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpCheck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UptimeCheckConfig.HttpCheck; + + /** + * Verifies a HttpCheck message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpCheck message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpCheck + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UptimeCheckConfig.HttpCheck; + + /** + * Creates a plain object from a HttpCheck message. Also converts values to other types if specified. + * @param message HttpCheck + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UptimeCheckConfig.HttpCheck, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpCheck to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpCheck + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace HttpCheck { + + /** Properties of a BasicAuthentication. */ + interface IBasicAuthentication { + + /** BasicAuthentication username */ + username?: (string|null); + + /** BasicAuthentication password */ + password?: (string|null); + } + + /** Represents a BasicAuthentication. */ + class BasicAuthentication implements IBasicAuthentication { + + /** + * Constructs a new BasicAuthentication. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication); + + /** BasicAuthentication username. */ + public username: string; + + /** BasicAuthentication password. */ + public password: string; + + /** + * Creates a new BasicAuthentication instance using the specified properties. + * @param [properties] Properties to set + * @returns BasicAuthentication instance + */ + public static create(properties?: google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication): google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication; + + /** + * Encodes the specified BasicAuthentication message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.verify|verify} messages. + * @param message BasicAuthentication message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BasicAuthentication message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.verify|verify} messages. + * @param message BasicAuthentication message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BasicAuthentication message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BasicAuthentication + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication; + + /** + * Decodes a BasicAuthentication message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BasicAuthentication + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication; + + /** + * Verifies a BasicAuthentication message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BasicAuthentication message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BasicAuthentication + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication; + + /** + * Creates a plain object from a BasicAuthentication message. Also converts values to other types if specified. + * @param message BasicAuthentication + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BasicAuthentication to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BasicAuthentication + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** RequestMethod enum. */ + enum RequestMethod { + METHOD_UNSPECIFIED = 0, + GET = 1, + POST = 2 + } + + /** ContentType enum. */ + enum ContentType { + TYPE_UNSPECIFIED = 0, + URL_ENCODED = 1 + } + } + + /** Properties of a TcpCheck. */ + interface ITcpCheck { + + /** TcpCheck port */ + port?: (number|null); + } + + /** Represents a TcpCheck. */ + class TcpCheck implements ITcpCheck { + + /** + * Constructs a new TcpCheck. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.UptimeCheckConfig.ITcpCheck); + + /** TcpCheck port. */ + public port: number; + + /** + * Creates a new TcpCheck instance using the specified properties. + * @param [properties] Properties to set + * @returns TcpCheck instance + */ + public static create(properties?: google.monitoring.v3.UptimeCheckConfig.ITcpCheck): google.monitoring.v3.UptimeCheckConfig.TcpCheck; + + /** + * Encodes the specified TcpCheck message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.TcpCheck.verify|verify} messages. + * @param message TcpCheck message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.UptimeCheckConfig.ITcpCheck, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TcpCheck message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.TcpCheck.verify|verify} messages. + * @param message TcpCheck message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.UptimeCheckConfig.ITcpCheck, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TcpCheck message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TcpCheck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UptimeCheckConfig.TcpCheck; + + /** + * Decodes a TcpCheck message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TcpCheck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UptimeCheckConfig.TcpCheck; + + /** + * Verifies a TcpCheck message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TcpCheck message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TcpCheck + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UptimeCheckConfig.TcpCheck; + + /** + * Creates a plain object from a TcpCheck message. Also converts values to other types if specified. + * @param message TcpCheck + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UptimeCheckConfig.TcpCheck, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TcpCheck to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TcpCheck + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ContentMatcher. */ + interface IContentMatcher { + + /** ContentMatcher content */ + content?: (string|null); + + /** ContentMatcher matcher */ + matcher?: (google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption|keyof typeof google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption|null); + } + + /** Represents a ContentMatcher. */ + class ContentMatcher implements IContentMatcher { + + /** + * Constructs a new ContentMatcher. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.UptimeCheckConfig.IContentMatcher); + + /** ContentMatcher content. */ + public content: string; + + /** ContentMatcher matcher. */ + public matcher: (google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption|keyof typeof google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption); + + /** + * Creates a new ContentMatcher instance using the specified properties. + * @param [properties] Properties to set + * @returns ContentMatcher instance + */ + public static create(properties?: google.monitoring.v3.UptimeCheckConfig.IContentMatcher): google.monitoring.v3.UptimeCheckConfig.ContentMatcher; + + /** + * Encodes the specified ContentMatcher message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.ContentMatcher.verify|verify} messages. + * @param message ContentMatcher message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.UptimeCheckConfig.IContentMatcher, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ContentMatcher message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.ContentMatcher.verify|verify} messages. + * @param message ContentMatcher message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.UptimeCheckConfig.IContentMatcher, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ContentMatcher message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ContentMatcher + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UptimeCheckConfig.ContentMatcher; + + /** + * Decodes a ContentMatcher message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ContentMatcher + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UptimeCheckConfig.ContentMatcher; + + /** + * Verifies a ContentMatcher message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ContentMatcher message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ContentMatcher + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UptimeCheckConfig.ContentMatcher; + + /** + * Creates a plain object from a ContentMatcher message. Also converts values to other types if specified. + * @param message ContentMatcher + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UptimeCheckConfig.ContentMatcher, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ContentMatcher to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ContentMatcher + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ContentMatcher { + + /** ContentMatcherOption enum. */ + enum ContentMatcherOption { + CONTENT_MATCHER_OPTION_UNSPECIFIED = 0, + CONTAINS_STRING = 1, + NOT_CONTAINS_STRING = 2, + MATCHES_REGEX = 3, + NOT_MATCHES_REGEX = 4 + } + } + } + + /** Properties of an UptimeCheckIp. */ + interface IUptimeCheckIp { + + /** UptimeCheckIp region */ + region?: (google.monitoring.v3.UptimeCheckRegion|keyof typeof google.monitoring.v3.UptimeCheckRegion|null); + + /** UptimeCheckIp location */ + location?: (string|null); + + /** UptimeCheckIp ipAddress */ + ipAddress?: (string|null); + } + + /** Represents an UptimeCheckIp. */ + class UptimeCheckIp implements IUptimeCheckIp { + + /** + * Constructs a new UptimeCheckIp. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IUptimeCheckIp); + + /** UptimeCheckIp region. */ + public region: (google.monitoring.v3.UptimeCheckRegion|keyof typeof google.monitoring.v3.UptimeCheckRegion); + + /** UptimeCheckIp location. */ + public location: string; + + /** UptimeCheckIp ipAddress. */ + public ipAddress: string; + + /** + * Creates a new UptimeCheckIp instance using the specified properties. + * @param [properties] Properties to set + * @returns UptimeCheckIp instance + */ + public static create(properties?: google.monitoring.v3.IUptimeCheckIp): google.monitoring.v3.UptimeCheckIp; + + /** + * Encodes the specified UptimeCheckIp message. Does not implicitly {@link google.monitoring.v3.UptimeCheckIp.verify|verify} messages. + * @param message UptimeCheckIp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IUptimeCheckIp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UptimeCheckIp message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckIp.verify|verify} messages. + * @param message UptimeCheckIp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IUptimeCheckIp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UptimeCheckIp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UptimeCheckIp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UptimeCheckIp; + + /** + * Decodes an UptimeCheckIp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UptimeCheckIp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UptimeCheckIp; + + /** + * Verifies an UptimeCheckIp message. + * @param message Plain 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 UptimeCheckIp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UptimeCheckIp + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UptimeCheckIp; + + /** + * Creates a plain object from an UptimeCheckIp message. Also converts values to other types if specified. + * @param message UptimeCheckIp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UptimeCheckIp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UptimeCheckIp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UptimeCheckIp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** GroupResourceType enum. */ + enum GroupResourceType { + RESOURCE_TYPE_UNSPECIFIED = 0, + INSTANCE = 1, + AWS_ELB_LOAD_BALANCER = 2 + } + + /** Represents an UptimeCheckService */ + class UptimeCheckService extends $protobuf.rpc.Service { + + /** + * Constructs a new UptimeCheckService 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 UptimeCheckService 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): UptimeCheckService; + + /** + * Calls ListUptimeCheckConfigs. + * @param request ListUptimeCheckConfigsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListUptimeCheckConfigsResponse + */ + public listUptimeCheckConfigs(request: google.monitoring.v3.IListUptimeCheckConfigsRequest, callback: google.monitoring.v3.UptimeCheckService.ListUptimeCheckConfigsCallback): void; + + /** + * Calls ListUptimeCheckConfigs. + * @param request ListUptimeCheckConfigsRequest message or plain object + * @returns Promise + */ + public listUptimeCheckConfigs(request: google.monitoring.v3.IListUptimeCheckConfigsRequest): Promise; + + /** + * Calls GetUptimeCheckConfig. + * @param request GetUptimeCheckConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UptimeCheckConfig + */ + public getUptimeCheckConfig(request: google.monitoring.v3.IGetUptimeCheckConfigRequest, callback: google.monitoring.v3.UptimeCheckService.GetUptimeCheckConfigCallback): void; + + /** + * Calls GetUptimeCheckConfig. + * @param request GetUptimeCheckConfigRequest message or plain object + * @returns Promise + */ + public getUptimeCheckConfig(request: google.monitoring.v3.IGetUptimeCheckConfigRequest): Promise; + + /** + * Calls CreateUptimeCheckConfig. + * @param request CreateUptimeCheckConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UptimeCheckConfig + */ + public createUptimeCheckConfig(request: google.monitoring.v3.ICreateUptimeCheckConfigRequest, callback: google.monitoring.v3.UptimeCheckService.CreateUptimeCheckConfigCallback): void; + + /** + * Calls CreateUptimeCheckConfig. + * @param request CreateUptimeCheckConfigRequest message or plain object + * @returns Promise + */ + public createUptimeCheckConfig(request: google.monitoring.v3.ICreateUptimeCheckConfigRequest): Promise; + + /** + * Calls UpdateUptimeCheckConfig. + * @param request UpdateUptimeCheckConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UptimeCheckConfig + */ + public updateUptimeCheckConfig(request: google.monitoring.v3.IUpdateUptimeCheckConfigRequest, callback: google.monitoring.v3.UptimeCheckService.UpdateUptimeCheckConfigCallback): void; + + /** + * Calls UpdateUptimeCheckConfig. + * @param request UpdateUptimeCheckConfigRequest message or plain object + * @returns Promise + */ + public updateUptimeCheckConfig(request: google.monitoring.v3.IUpdateUptimeCheckConfigRequest): Promise; + + /** + * Calls DeleteUptimeCheckConfig. + * @param request DeleteUptimeCheckConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteUptimeCheckConfig(request: google.monitoring.v3.IDeleteUptimeCheckConfigRequest, callback: google.monitoring.v3.UptimeCheckService.DeleteUptimeCheckConfigCallback): void; + + /** + * Calls DeleteUptimeCheckConfig. + * @param request DeleteUptimeCheckConfigRequest message or plain object + * @returns Promise + */ + public deleteUptimeCheckConfig(request: google.monitoring.v3.IDeleteUptimeCheckConfigRequest): Promise; + + /** + * Calls ListUptimeCheckIps. + * @param request ListUptimeCheckIpsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListUptimeCheckIpsResponse + */ + public listUptimeCheckIps(request: google.monitoring.v3.IListUptimeCheckIpsRequest, callback: google.monitoring.v3.UptimeCheckService.ListUptimeCheckIpsCallback): void; + + /** + * Calls ListUptimeCheckIps. + * @param request ListUptimeCheckIpsRequest message or plain object + * @returns Promise + */ + public listUptimeCheckIps(request: google.monitoring.v3.IListUptimeCheckIpsRequest): Promise; + } + + namespace UptimeCheckService { + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|listUptimeCheckConfigs}. + * @param error Error, if any + * @param [response] ListUptimeCheckConfigsResponse + */ + type ListUptimeCheckConfigsCallback = (error: (Error|null), response?: google.monitoring.v3.ListUptimeCheckConfigsResponse) => void; + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|getUptimeCheckConfig}. + * @param error Error, if any + * @param [response] UptimeCheckConfig + */ + type GetUptimeCheckConfigCallback = (error: (Error|null), response?: google.monitoring.v3.UptimeCheckConfig) => void; + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|createUptimeCheckConfig}. + * @param error Error, if any + * @param [response] UptimeCheckConfig + */ + type CreateUptimeCheckConfigCallback = (error: (Error|null), response?: google.monitoring.v3.UptimeCheckConfig) => void; + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|updateUptimeCheckConfig}. + * @param error Error, if any + * @param [response] UptimeCheckConfig + */ + type UpdateUptimeCheckConfigCallback = (error: (Error|null), response?: google.monitoring.v3.UptimeCheckConfig) => void; + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|deleteUptimeCheckConfig}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteUptimeCheckConfigCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|listUptimeCheckIps}. + * @param error Error, if any + * @param [response] ListUptimeCheckIpsResponse + */ + type ListUptimeCheckIpsCallback = (error: (Error|null), response?: google.monitoring.v3.ListUptimeCheckIpsResponse) => void; + } + + /** Properties of a ListUptimeCheckConfigsRequest. */ + interface IListUptimeCheckConfigsRequest { + + /** ListUptimeCheckConfigsRequest parent */ + parent?: (string|null); + + /** ListUptimeCheckConfigsRequest pageSize */ + pageSize?: (number|null); + + /** ListUptimeCheckConfigsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListUptimeCheckConfigsRequest. */ + class ListUptimeCheckConfigsRequest implements IListUptimeCheckConfigsRequest { + + /** + * Constructs a new ListUptimeCheckConfigsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListUptimeCheckConfigsRequest); + + /** ListUptimeCheckConfigsRequest parent. */ + public parent: string; + + /** ListUptimeCheckConfigsRequest pageSize. */ + public pageSize: number; + + /** ListUptimeCheckConfigsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListUptimeCheckConfigsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListUptimeCheckConfigsRequest instance + */ + public static create(properties?: google.monitoring.v3.IListUptimeCheckConfigsRequest): google.monitoring.v3.ListUptimeCheckConfigsRequest; + + /** + * Encodes the specified ListUptimeCheckConfigsRequest message. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckConfigsRequest.verify|verify} messages. + * @param message ListUptimeCheckConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListUptimeCheckConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListUptimeCheckConfigsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckConfigsRequest.verify|verify} messages. + * @param message ListUptimeCheckConfigsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListUptimeCheckConfigsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListUptimeCheckConfigsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListUptimeCheckConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListUptimeCheckConfigsRequest; + + /** + * Decodes a ListUptimeCheckConfigsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListUptimeCheckConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListUptimeCheckConfigsRequest; + + /** + * Verifies a ListUptimeCheckConfigsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListUptimeCheckConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListUptimeCheckConfigsRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListUptimeCheckConfigsRequest; + + /** + * Creates a plain object from a ListUptimeCheckConfigsRequest message. Also converts values to other types if specified. + * @param message ListUptimeCheckConfigsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListUptimeCheckConfigsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListUptimeCheckConfigsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListUptimeCheckConfigsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListUptimeCheckConfigsResponse. */ + interface IListUptimeCheckConfigsResponse { + + /** ListUptimeCheckConfigsResponse uptimeCheckConfigs */ + uptimeCheckConfigs?: (google.monitoring.v3.IUptimeCheckConfig[]|null); + + /** ListUptimeCheckConfigsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListUptimeCheckConfigsResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListUptimeCheckConfigsResponse. */ + class ListUptimeCheckConfigsResponse implements IListUptimeCheckConfigsResponse { + + /** + * Constructs a new ListUptimeCheckConfigsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListUptimeCheckConfigsResponse); + + /** ListUptimeCheckConfigsResponse uptimeCheckConfigs. */ + public uptimeCheckConfigs: google.monitoring.v3.IUptimeCheckConfig[]; + + /** ListUptimeCheckConfigsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListUptimeCheckConfigsResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListUptimeCheckConfigsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListUptimeCheckConfigsResponse instance + */ + public static create(properties?: google.monitoring.v3.IListUptimeCheckConfigsResponse): google.monitoring.v3.ListUptimeCheckConfigsResponse; + + /** + * Encodes the specified ListUptimeCheckConfigsResponse message. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckConfigsResponse.verify|verify} messages. + * @param message ListUptimeCheckConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListUptimeCheckConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListUptimeCheckConfigsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckConfigsResponse.verify|verify} messages. + * @param message ListUptimeCheckConfigsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListUptimeCheckConfigsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListUptimeCheckConfigsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListUptimeCheckConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListUptimeCheckConfigsResponse; + + /** + * Decodes a ListUptimeCheckConfigsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListUptimeCheckConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListUptimeCheckConfigsResponse; + + /** + * Verifies a ListUptimeCheckConfigsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListUptimeCheckConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListUptimeCheckConfigsResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListUptimeCheckConfigsResponse; + + /** + * Creates a plain object from a ListUptimeCheckConfigsResponse message. Also converts values to other types if specified. + * @param message ListUptimeCheckConfigsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListUptimeCheckConfigsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListUptimeCheckConfigsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListUptimeCheckConfigsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetUptimeCheckConfigRequest. */ + interface IGetUptimeCheckConfigRequest { + + /** GetUptimeCheckConfigRequest name */ + name?: (string|null); + } + + /** Represents a GetUptimeCheckConfigRequest. */ + class GetUptimeCheckConfigRequest implements IGetUptimeCheckConfigRequest { + + /** + * Constructs a new GetUptimeCheckConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IGetUptimeCheckConfigRequest); + + /** GetUptimeCheckConfigRequest name. */ + public name: string; + + /** + * Creates a new GetUptimeCheckConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetUptimeCheckConfigRequest instance + */ + public static create(properties?: google.monitoring.v3.IGetUptimeCheckConfigRequest): google.monitoring.v3.GetUptimeCheckConfigRequest; + + /** + * Encodes the specified GetUptimeCheckConfigRequest message. Does not implicitly {@link google.monitoring.v3.GetUptimeCheckConfigRequest.verify|verify} messages. + * @param message GetUptimeCheckConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IGetUptimeCheckConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetUptimeCheckConfigRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetUptimeCheckConfigRequest.verify|verify} messages. + * @param message GetUptimeCheckConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IGetUptimeCheckConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetUptimeCheckConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.GetUptimeCheckConfigRequest; + + /** + * Decodes a GetUptimeCheckConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.GetUptimeCheckConfigRequest; + + /** + * Verifies a GetUptimeCheckConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetUptimeCheckConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetUptimeCheckConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.GetUptimeCheckConfigRequest; + + /** + * Creates a plain object from a GetUptimeCheckConfigRequest message. Also converts values to other types if specified. + * @param message GetUptimeCheckConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.GetUptimeCheckConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetUptimeCheckConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetUptimeCheckConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateUptimeCheckConfigRequest. */ + interface ICreateUptimeCheckConfigRequest { + + /** CreateUptimeCheckConfigRequest parent */ + parent?: (string|null); + + /** CreateUptimeCheckConfigRequest uptimeCheckConfig */ + uptimeCheckConfig?: (google.monitoring.v3.IUptimeCheckConfig|null); + } + + /** Represents a CreateUptimeCheckConfigRequest. */ + class CreateUptimeCheckConfigRequest implements ICreateUptimeCheckConfigRequest { + + /** + * Constructs a new CreateUptimeCheckConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.ICreateUptimeCheckConfigRequest); + + /** CreateUptimeCheckConfigRequest parent. */ + public parent: string; + + /** CreateUptimeCheckConfigRequest uptimeCheckConfig. */ + public uptimeCheckConfig?: (google.monitoring.v3.IUptimeCheckConfig|null); + + /** + * Creates a new CreateUptimeCheckConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateUptimeCheckConfigRequest instance + */ + public static create(properties?: google.monitoring.v3.ICreateUptimeCheckConfigRequest): google.monitoring.v3.CreateUptimeCheckConfigRequest; + + /** + * Encodes the specified CreateUptimeCheckConfigRequest message. Does not implicitly {@link google.monitoring.v3.CreateUptimeCheckConfigRequest.verify|verify} messages. + * @param message CreateUptimeCheckConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.ICreateUptimeCheckConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateUptimeCheckConfigRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateUptimeCheckConfigRequest.verify|verify} messages. + * @param message CreateUptimeCheckConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.ICreateUptimeCheckConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateUptimeCheckConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.CreateUptimeCheckConfigRequest; + + /** + * Decodes a CreateUptimeCheckConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.CreateUptimeCheckConfigRequest; + + /** + * Verifies a CreateUptimeCheckConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateUptimeCheckConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateUptimeCheckConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.CreateUptimeCheckConfigRequest; + + /** + * Creates a plain object from a CreateUptimeCheckConfigRequest message. Also converts values to other types if specified. + * @param message CreateUptimeCheckConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.CreateUptimeCheckConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateUptimeCheckConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateUptimeCheckConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateUptimeCheckConfigRequest. */ + interface IUpdateUptimeCheckConfigRequest { + + /** UpdateUptimeCheckConfigRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateUptimeCheckConfigRequest uptimeCheckConfig */ + uptimeCheckConfig?: (google.monitoring.v3.IUptimeCheckConfig|null); + } + + /** Represents an UpdateUptimeCheckConfigRequest. */ + class UpdateUptimeCheckConfigRequest implements IUpdateUptimeCheckConfigRequest { + + /** + * Constructs a new UpdateUptimeCheckConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IUpdateUptimeCheckConfigRequest); + + /** UpdateUptimeCheckConfigRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateUptimeCheckConfigRequest uptimeCheckConfig. */ + public uptimeCheckConfig?: (google.monitoring.v3.IUptimeCheckConfig|null); + + /** + * Creates a new UpdateUptimeCheckConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateUptimeCheckConfigRequest instance + */ + public static create(properties?: google.monitoring.v3.IUpdateUptimeCheckConfigRequest): google.monitoring.v3.UpdateUptimeCheckConfigRequest; + + /** + * Encodes the specified UpdateUptimeCheckConfigRequest message. Does not implicitly {@link google.monitoring.v3.UpdateUptimeCheckConfigRequest.verify|verify} messages. + * @param message UpdateUptimeCheckConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IUpdateUptimeCheckConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateUptimeCheckConfigRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateUptimeCheckConfigRequest.verify|verify} messages. + * @param message UpdateUptimeCheckConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IUpdateUptimeCheckConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateUptimeCheckConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.UpdateUptimeCheckConfigRequest; + + /** + * Decodes an UpdateUptimeCheckConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.UpdateUptimeCheckConfigRequest; + + /** + * Verifies an UpdateUptimeCheckConfigRequest message. + * @param message Plain 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 UpdateUptimeCheckConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateUptimeCheckConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.UpdateUptimeCheckConfigRequest; + + /** + * Creates a plain object from an UpdateUptimeCheckConfigRequest message. Also converts values to other types if specified. + * @param message UpdateUptimeCheckConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.UpdateUptimeCheckConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateUptimeCheckConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateUptimeCheckConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteUptimeCheckConfigRequest. */ + interface IDeleteUptimeCheckConfigRequest { + + /** DeleteUptimeCheckConfigRequest name */ + name?: (string|null); + } + + /** Represents a DeleteUptimeCheckConfigRequest. */ + class DeleteUptimeCheckConfigRequest implements IDeleteUptimeCheckConfigRequest { + + /** + * Constructs a new DeleteUptimeCheckConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IDeleteUptimeCheckConfigRequest); + + /** DeleteUptimeCheckConfigRequest name. */ + public name: string; + + /** + * Creates a new DeleteUptimeCheckConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteUptimeCheckConfigRequest instance + */ + public static create(properties?: google.monitoring.v3.IDeleteUptimeCheckConfigRequest): google.monitoring.v3.DeleteUptimeCheckConfigRequest; + + /** + * Encodes the specified DeleteUptimeCheckConfigRequest message. Does not implicitly {@link google.monitoring.v3.DeleteUptimeCheckConfigRequest.verify|verify} messages. + * @param message DeleteUptimeCheckConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IDeleteUptimeCheckConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteUptimeCheckConfigRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteUptimeCheckConfigRequest.verify|verify} messages. + * @param message DeleteUptimeCheckConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IDeleteUptimeCheckConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteUptimeCheckConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.DeleteUptimeCheckConfigRequest; + + /** + * Decodes a DeleteUptimeCheckConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.DeleteUptimeCheckConfigRequest; + + /** + * Verifies a DeleteUptimeCheckConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteUptimeCheckConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteUptimeCheckConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.DeleteUptimeCheckConfigRequest; + + /** + * Creates a plain object from a DeleteUptimeCheckConfigRequest message. Also converts values to other types if specified. + * @param message DeleteUptimeCheckConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.DeleteUptimeCheckConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteUptimeCheckConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteUptimeCheckConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListUptimeCheckIpsRequest. */ + interface IListUptimeCheckIpsRequest { + + /** ListUptimeCheckIpsRequest pageSize */ + pageSize?: (number|null); + + /** ListUptimeCheckIpsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListUptimeCheckIpsRequest. */ + class ListUptimeCheckIpsRequest implements IListUptimeCheckIpsRequest { + + /** + * Constructs a new ListUptimeCheckIpsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListUptimeCheckIpsRequest); + + /** ListUptimeCheckIpsRequest pageSize. */ + public pageSize: number; + + /** ListUptimeCheckIpsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListUptimeCheckIpsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListUptimeCheckIpsRequest instance + */ + public static create(properties?: google.monitoring.v3.IListUptimeCheckIpsRequest): google.monitoring.v3.ListUptimeCheckIpsRequest; + + /** + * Encodes the specified ListUptimeCheckIpsRequest message. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckIpsRequest.verify|verify} messages. + * @param message ListUptimeCheckIpsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListUptimeCheckIpsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListUptimeCheckIpsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckIpsRequest.verify|verify} messages. + * @param message ListUptimeCheckIpsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListUptimeCheckIpsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListUptimeCheckIpsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListUptimeCheckIpsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListUptimeCheckIpsRequest; + + /** + * Decodes a ListUptimeCheckIpsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListUptimeCheckIpsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListUptimeCheckIpsRequest; + + /** + * Verifies a ListUptimeCheckIpsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListUptimeCheckIpsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListUptimeCheckIpsRequest + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListUptimeCheckIpsRequest; + + /** + * Creates a plain object from a ListUptimeCheckIpsRequest message. Also converts values to other types if specified. + * @param message ListUptimeCheckIpsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListUptimeCheckIpsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListUptimeCheckIpsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListUptimeCheckIpsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListUptimeCheckIpsResponse. */ + interface IListUptimeCheckIpsResponse { + + /** ListUptimeCheckIpsResponse uptimeCheckIps */ + uptimeCheckIps?: (google.monitoring.v3.IUptimeCheckIp[]|null); + + /** ListUptimeCheckIpsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListUptimeCheckIpsResponse. */ + class ListUptimeCheckIpsResponse implements IListUptimeCheckIpsResponse { + + /** + * Constructs a new ListUptimeCheckIpsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.monitoring.v3.IListUptimeCheckIpsResponse); + + /** ListUptimeCheckIpsResponse uptimeCheckIps. */ + public uptimeCheckIps: google.monitoring.v3.IUptimeCheckIp[]; + + /** ListUptimeCheckIpsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListUptimeCheckIpsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListUptimeCheckIpsResponse instance + */ + public static create(properties?: google.monitoring.v3.IListUptimeCheckIpsResponse): google.monitoring.v3.ListUptimeCheckIpsResponse; + + /** + * Encodes the specified ListUptimeCheckIpsResponse message. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckIpsResponse.verify|verify} messages. + * @param message ListUptimeCheckIpsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.monitoring.v3.IListUptimeCheckIpsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListUptimeCheckIpsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckIpsResponse.verify|verify} messages. + * @param message ListUptimeCheckIpsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.monitoring.v3.IListUptimeCheckIpsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListUptimeCheckIpsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListUptimeCheckIpsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.monitoring.v3.ListUptimeCheckIpsResponse; + + /** + * Decodes a ListUptimeCheckIpsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListUptimeCheckIpsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.monitoring.v3.ListUptimeCheckIpsResponse; + + /** + * Verifies a ListUptimeCheckIpsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListUptimeCheckIpsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListUptimeCheckIpsResponse + */ + public static fromObject(object: { [k: string]: any }): google.monitoring.v3.ListUptimeCheckIpsResponse; + + /** + * Creates a plain object from a ListUptimeCheckIpsResponse message. Also converts values to other types if specified. + * @param message ListUptimeCheckIpsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.monitoring.v3.ListUptimeCheckIpsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListUptimeCheckIpsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListUptimeCheckIpsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** Namespace api. */ + namespace api { + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Distribution. */ + interface IDistribution { + + /** Distribution count */ + count?: (number|Long|string|null); + + /** Distribution mean */ + mean?: (number|null); + + /** Distribution sumOfSquaredDeviation */ + sumOfSquaredDeviation?: (number|null); + + /** Distribution range */ + range?: (google.api.Distribution.IRange|null); + + /** Distribution bucketOptions */ + bucketOptions?: (google.api.Distribution.IBucketOptions|null); + + /** Distribution bucketCounts */ + bucketCounts?: ((number|Long|string)[]|null); + + /** Distribution exemplars */ + exemplars?: (google.api.Distribution.IExemplar[]|null); + } + + /** Represents a Distribution. */ + class Distribution implements IDistribution { + + /** + * Constructs a new Distribution. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IDistribution); + + /** Distribution count. */ + public count: (number|Long|string); + + /** Distribution mean. */ + public mean: number; + + /** Distribution sumOfSquaredDeviation. */ + public sumOfSquaredDeviation: number; + + /** Distribution range. */ + public range?: (google.api.Distribution.IRange|null); + + /** Distribution bucketOptions. */ + public bucketOptions?: (google.api.Distribution.IBucketOptions|null); + + /** Distribution bucketCounts. */ + public bucketCounts: (number|Long|string)[]; + + /** Distribution exemplars. */ + public exemplars: google.api.Distribution.IExemplar[]; + + /** + * Creates a new Distribution instance using the specified properties. + * @param [properties] Properties to set + * @returns Distribution instance + */ + public static create(properties?: google.api.IDistribution): google.api.Distribution; + + /** + * Encodes the specified Distribution message. Does not implicitly {@link google.api.Distribution.verify|verify} messages. + * @param message Distribution message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IDistribution, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Distribution message, length delimited. Does not implicitly {@link google.api.Distribution.verify|verify} messages. + * @param message Distribution message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IDistribution, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Distribution message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Distribution + * @throws {Error} If the payload is not 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.Distribution; + + /** + * Decodes a Distribution message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Distribution + * @throws {Error} If the payload 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.Distribution; + + /** + * Verifies a Distribution message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Distribution message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Distribution + */ + public static fromObject(object: { [k: string]: any }): google.api.Distribution; + + /** + * Creates a plain object from a Distribution message. Also converts values to other types if specified. + * @param message Distribution + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Distribution, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Distribution to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Distribution + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Distribution { + + /** Properties of a Range. */ + interface IRange { + + /** Range min */ + min?: (number|null); + + /** Range max */ + max?: (number|null); + } + + /** Represents a Range. */ + class Range implements IRange { + + /** + * Constructs a new Range. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.Distribution.IRange); + + /** Range min. */ + public min: number; + + /** Range max. */ + public max: number; + + /** + * Creates a new Range instance using the specified properties. + * @param [properties] Properties to set + * @returns Range instance + */ + public static create(properties?: google.api.Distribution.IRange): google.api.Distribution.Range; + + /** + * Encodes the specified Range message. Does not implicitly {@link google.api.Distribution.Range.verify|verify} messages. + * @param message Range message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.Distribution.IRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Range message, length delimited. Does not implicitly {@link google.api.Distribution.Range.verify|verify} messages. + * @param message Range message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.Distribution.IRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Range message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Range + * @throws {Error} If the payload is not 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.Distribution.Range; + + /** + * Decodes a Range message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Range + * @throws {Error} If the payload 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.Distribution.Range; + + /** + * Verifies a Range message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Range message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Range + */ + public static fromObject(object: { [k: string]: any }): google.api.Distribution.Range; + + /** + * Creates a plain object from a Range message. Also converts values to other types if specified. + * @param message Range + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Distribution.Range, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Range to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Range + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BucketOptions. */ + interface IBucketOptions { + + /** BucketOptions linearBuckets */ + linearBuckets?: (google.api.Distribution.BucketOptions.ILinear|null); + + /** BucketOptions exponentialBuckets */ + exponentialBuckets?: (google.api.Distribution.BucketOptions.IExponential|null); + + /** BucketOptions explicitBuckets */ + explicitBuckets?: (google.api.Distribution.BucketOptions.IExplicit|null); + } + + /** Represents a BucketOptions. */ + class BucketOptions implements IBucketOptions { + + /** + * Constructs a new BucketOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.Distribution.IBucketOptions); + + /** BucketOptions linearBuckets. */ + public linearBuckets?: (google.api.Distribution.BucketOptions.ILinear|null); + + /** BucketOptions exponentialBuckets. */ + public exponentialBuckets?: (google.api.Distribution.BucketOptions.IExponential|null); + + /** BucketOptions explicitBuckets. */ + public explicitBuckets?: (google.api.Distribution.BucketOptions.IExplicit|null); + + /** BucketOptions options. */ + public options?: ("linearBuckets"|"exponentialBuckets"|"explicitBuckets"); + + /** + * Creates a new BucketOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns BucketOptions instance + */ + public static create(properties?: google.api.Distribution.IBucketOptions): google.api.Distribution.BucketOptions; + + /** + * Encodes the specified BucketOptions message. Does not implicitly {@link google.api.Distribution.BucketOptions.verify|verify} messages. + * @param message BucketOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.Distribution.IBucketOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BucketOptions message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.verify|verify} messages. + * @param message BucketOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.Distribution.IBucketOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BucketOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BucketOptions + * @throws {Error} If the payload is not 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.Distribution.BucketOptions; + + /** + * Decodes a BucketOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BucketOptions + * @throws {Error} If the payload 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.Distribution.BucketOptions; + + /** + * Verifies a BucketOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BucketOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BucketOptions + */ + public static fromObject(object: { [k: string]: any }): google.api.Distribution.BucketOptions; + + /** + * Creates a plain object from a BucketOptions message. Also converts values to other types if specified. + * @param message BucketOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Distribution.BucketOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BucketOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BucketOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BucketOptions { + + /** Properties of a Linear. */ + interface ILinear { + + /** Linear numFiniteBuckets */ + numFiniteBuckets?: (number|null); + + /** Linear width */ + width?: (number|null); + + /** Linear offset */ + offset?: (number|null); + } + + /** Represents a Linear. */ + class Linear implements ILinear { + + /** + * Constructs a new Linear. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.Distribution.BucketOptions.ILinear); + + /** Linear numFiniteBuckets. */ + public numFiniteBuckets: number; + + /** Linear width. */ + public width: number; + + /** Linear offset. */ + public offset: number; + + /** + * Creates a new Linear instance using the specified properties. + * @param [properties] Properties to set + * @returns Linear instance + */ + public static create(properties?: google.api.Distribution.BucketOptions.ILinear): google.api.Distribution.BucketOptions.Linear; + + /** + * Encodes the specified Linear message. Does not implicitly {@link google.api.Distribution.BucketOptions.Linear.verify|verify} messages. + * @param message Linear message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.Distribution.BucketOptions.ILinear, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Linear message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Linear.verify|verify} messages. + * @param message Linear message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.Distribution.BucketOptions.ILinear, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Linear message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Linear + * @throws {Error} If the payload is not 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.Distribution.BucketOptions.Linear; + + /** + * Decodes a Linear message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Linear + * @throws {Error} If the payload 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.Distribution.BucketOptions.Linear; + + /** + * Verifies a Linear message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Linear message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Linear + */ + public static fromObject(object: { [k: string]: any }): google.api.Distribution.BucketOptions.Linear; + + /** + * Creates a plain object from a Linear message. Also converts values to other types if specified. + * @param message Linear + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Distribution.BucketOptions.Linear, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Linear to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Linear + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Exponential. */ + interface IExponential { + + /** Exponential numFiniteBuckets */ + numFiniteBuckets?: (number|null); + + /** Exponential growthFactor */ + growthFactor?: (number|null); + + /** Exponential scale */ + scale?: (number|null); + } + + /** Represents an Exponential. */ + class Exponential implements IExponential { + + /** + * Constructs a new Exponential. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.Distribution.BucketOptions.IExponential); + + /** Exponential numFiniteBuckets. */ + public numFiniteBuckets: number; + + /** Exponential growthFactor. */ + public growthFactor: number; + + /** Exponential scale. */ + public scale: number; + + /** + * Creates a new Exponential instance using the specified properties. + * @param [properties] Properties to set + * @returns Exponential instance + */ + public static create(properties?: google.api.Distribution.BucketOptions.IExponential): google.api.Distribution.BucketOptions.Exponential; + + /** + * Encodes the specified Exponential message. Does not implicitly {@link google.api.Distribution.BucketOptions.Exponential.verify|verify} messages. + * @param message Exponential message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.Distribution.BucketOptions.IExponential, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Exponential message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Exponential.verify|verify} messages. + * @param message Exponential message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.Distribution.BucketOptions.IExponential, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Exponential message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Exponential + * @throws {Error} If the payload is not 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.Distribution.BucketOptions.Exponential; + + /** + * Decodes an Exponential message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Exponential + * @throws {Error} If the payload 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.Distribution.BucketOptions.Exponential; + + /** + * Verifies an Exponential message. + * @param message Plain 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 Exponential message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Exponential + */ + public static fromObject(object: { [k: string]: any }): google.api.Distribution.BucketOptions.Exponential; + + /** + * Creates a plain object from an Exponential message. Also converts values to other types if specified. + * @param message Exponential + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Distribution.BucketOptions.Exponential, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Exponential to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Exponential + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Explicit. */ + interface IExplicit { + + /** Explicit bounds */ + bounds?: (number[]|null); + } + + /** Represents an Explicit. */ + class Explicit implements IExplicit { + + /** + * Constructs a new Explicit. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.Distribution.BucketOptions.IExplicit); + + /** Explicit bounds. */ + public bounds: number[]; + + /** + * Creates a new Explicit instance using the specified properties. + * @param [properties] Properties to set + * @returns Explicit instance + */ + public static create(properties?: google.api.Distribution.BucketOptions.IExplicit): google.api.Distribution.BucketOptions.Explicit; + + /** + * Encodes the specified Explicit message. Does not implicitly {@link google.api.Distribution.BucketOptions.Explicit.verify|verify} messages. + * @param message Explicit message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.Distribution.BucketOptions.IExplicit, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Explicit message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Explicit.verify|verify} messages. + * @param message Explicit message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.Distribution.BucketOptions.IExplicit, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Explicit message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Explicit + * @throws {Error} If the payload is not 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.Distribution.BucketOptions.Explicit; + + /** + * Decodes an Explicit message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Explicit + * @throws {Error} If the payload 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.Distribution.BucketOptions.Explicit; + + /** + * Verifies an Explicit message. + * @param message Plain 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 Explicit message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Explicit + */ + public static fromObject(object: { [k: string]: any }): google.api.Distribution.BucketOptions.Explicit; + + /** + * Creates a plain object from an Explicit message. Also converts values to other types if specified. + * @param message Explicit + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Distribution.BucketOptions.Explicit, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Explicit to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Explicit + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an Exemplar. */ + interface IExemplar { + + /** Exemplar value */ + value?: (number|null); + + /** Exemplar timestamp */ + timestamp?: (google.protobuf.ITimestamp|null); + + /** Exemplar attachments */ + attachments?: (google.protobuf.IAny[]|null); + } + + /** Represents an Exemplar. */ + class Exemplar implements IExemplar { + + /** + * Constructs a new Exemplar. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.Distribution.IExemplar); + + /** Exemplar value. */ + public value: number; + + /** Exemplar timestamp. */ + public timestamp?: (google.protobuf.ITimestamp|null); + + /** Exemplar attachments. */ + public attachments: google.protobuf.IAny[]; + + /** + * Creates a new Exemplar instance using the specified properties. + * @param [properties] Properties to set + * @returns Exemplar instance + */ + public static create(properties?: google.api.Distribution.IExemplar): google.api.Distribution.Exemplar; + + /** + * Encodes the specified Exemplar message. Does not implicitly {@link google.api.Distribution.Exemplar.verify|verify} messages. + * @param message Exemplar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.Distribution.IExemplar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Exemplar message, length delimited. Does not implicitly {@link google.api.Distribution.Exemplar.verify|verify} messages. + * @param message Exemplar message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.Distribution.IExemplar, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Exemplar message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Exemplar + * @throws {Error} If the payload is not 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.Distribution.Exemplar; + + /** + * Decodes an Exemplar message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Exemplar + * @throws {Error} If the payload 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.Distribution.Exemplar; + + /** + * Verifies an Exemplar message. + * @param message Plain 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 Exemplar message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Exemplar + */ + public static fromObject(object: { [k: string]: any }): google.api.Distribution.Exemplar; + + /** + * Creates a plain object from an Exemplar message. Also converts values to other types if specified. + * @param message Exemplar + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Distribution.Exemplar, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Exemplar to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Exemplar + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: (google.api.IHttpRule[]|null); + + /** Http fullyDecodeReservedExpansion */ + fullyDecodeReservedExpansion?: (boolean|null); + } + + /** Represents a Http. */ + class Http implements IHttp { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** Http fullyDecodeReservedExpansion. */ + public fullyDecodeReservedExpansion: boolean; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Http + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HttpRule. */ + interface IHttpRule { + + /** HttpRule selector */ + selector?: (string|null); + + /** HttpRule get */ + get?: (string|null); + + /** HttpRule put */ + put?: (string|null); + + /** HttpRule post */ + post?: (string|null); + + /** HttpRule delete */ + "delete"?: (string|null); + + /** HttpRule patch */ + patch?: (string|null); + + /** HttpRule custom */ + custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body */ + body?: (string|null); + + /** HttpRule responseBody */ + responseBody?: (string|null); + + /** HttpRule additionalBindings */ + additionalBindings?: (google.api.IHttpRule[]|null); + } + + /** Represents a HttpRule. */ + class HttpRule implements IHttpRule { + + /** + * Constructs a new HttpRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpRule); + + /** HttpRule selector. */ + public selector: string; + + /** HttpRule get. */ + public get?: (string|null); + + /** HttpRule put. */ + public put?: (string|null); + + /** HttpRule post. */ + public post?: (string|null); + + /** HttpRule delete. */ + public delete?: (string|null); + + /** HttpRule patch. */ + public patch?: (string|null); + + /** HttpRule custom. */ + public custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body. */ + public body: string; + + /** HttpRule responseBody. */ + public responseBody: string; + + /** HttpRule additionalBindings. */ + public additionalBindings: google.api.IHttpRule[]; + + /** HttpRule pattern. */ + public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); + + /** + * Creates a new HttpRule instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpRule instance + */ + public static create(properties?: google.api.IHttpRule): google.api.HttpRule; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; + + /** + * Verifies a HttpRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpRule + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpRule; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @param message HttpRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CustomHttpPattern. */ + interface ICustomHttpPattern { + + /** CustomHttpPattern kind */ + kind?: (string|null); + + /** CustomHttpPattern path */ + path?: (string|null); + } + + /** Represents a CustomHttpPattern. */ + class CustomHttpPattern implements ICustomHttpPattern { + + /** + * Constructs a new CustomHttpPattern. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICustomHttpPattern); + + /** CustomHttpPattern kind. */ + public kind: string; + + /** CustomHttpPattern path. */ + public path: string; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomHttpPattern instance + */ + public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; + + /** + * Verifies a CustomHttpPattern message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomHttpPattern + */ + public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @param message CustomHttpPattern + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomHttpPattern to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomHttpPattern + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MonitoredResourceDescriptor. */ + interface IMonitoredResourceDescriptor { + + /** MonitoredResourceDescriptor name */ + name?: (string|null); + + /** MonitoredResourceDescriptor type */ + type?: (string|null); + + /** MonitoredResourceDescriptor displayName */ + displayName?: (string|null); + + /** MonitoredResourceDescriptor description */ + description?: (string|null); + + /** MonitoredResourceDescriptor labels */ + labels?: (google.api.ILabelDescriptor[]|null); + + /** MonitoredResourceDescriptor launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); + } + + /** Represents a MonitoredResourceDescriptor. */ + class MonitoredResourceDescriptor implements IMonitoredResourceDescriptor { + + /** + * Constructs a new MonitoredResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IMonitoredResourceDescriptor); + + /** MonitoredResourceDescriptor name. */ + public name: string; + + /** MonitoredResourceDescriptor type. */ + public type: string; + + /** MonitoredResourceDescriptor displayName. */ + public displayName: string; + + /** MonitoredResourceDescriptor description. */ + public description: string; + + /** MonitoredResourceDescriptor labels. */ + public labels: google.api.ILabelDescriptor[]; + + /** MonitoredResourceDescriptor launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); + + /** + * Creates a new MonitoredResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns MonitoredResourceDescriptor instance + */ + public static create(properties?: google.api.IMonitoredResourceDescriptor): google.api.MonitoredResourceDescriptor; + + /** + * Encodes the specified MonitoredResourceDescriptor message. Does not implicitly {@link google.api.MonitoredResourceDescriptor.verify|verify} messages. + * @param message MonitoredResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IMonitoredResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MonitoredResourceDescriptor message, length delimited. Does not implicitly {@link google.api.MonitoredResourceDescriptor.verify|verify} messages. + * @param message MonitoredResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IMonitoredResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MonitoredResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MonitoredResourceDescriptor + * @throws {Error} If the payload is not 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.MonitoredResourceDescriptor; + + /** + * Decodes a MonitoredResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MonitoredResourceDescriptor + * @throws {Error} If the payload 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.MonitoredResourceDescriptor; + + /** + * Verifies a MonitoredResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MonitoredResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MonitoredResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.MonitoredResourceDescriptor; + + /** + * Creates a plain object from a MonitoredResourceDescriptor message. Also converts values to other types if specified. + * @param message MonitoredResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MonitoredResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MonitoredResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MonitoredResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MonitoredResource. */ + interface IMonitoredResource { + + /** MonitoredResource type */ + type?: (string|null); + + /** MonitoredResource labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a MonitoredResource. */ + class MonitoredResource implements IMonitoredResource { + + /** + * Constructs a new MonitoredResource. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IMonitoredResource); + + /** MonitoredResource type. */ + public type: string; + + /** MonitoredResource labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new MonitoredResource instance using the specified properties. + * @param [properties] Properties to set + * @returns MonitoredResource instance + */ + public static create(properties?: google.api.IMonitoredResource): google.api.MonitoredResource; + + /** + * Encodes the specified MonitoredResource message. Does not implicitly {@link google.api.MonitoredResource.verify|verify} messages. + * @param message MonitoredResource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IMonitoredResource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MonitoredResource message, length delimited. Does not implicitly {@link google.api.MonitoredResource.verify|verify} messages. + * @param message MonitoredResource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IMonitoredResource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MonitoredResource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MonitoredResource + * @throws {Error} If the payload is not 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.MonitoredResource; + + /** + * Decodes a MonitoredResource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MonitoredResource + * @throws {Error} If the payload 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.MonitoredResource; + + /** + * Verifies a MonitoredResource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MonitoredResource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MonitoredResource + */ + public static fromObject(object: { [k: string]: any }): google.api.MonitoredResource; + + /** + * Creates a plain object from a MonitoredResource message. Also converts values to other types if specified. + * @param message MonitoredResource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MonitoredResource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MonitoredResource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MonitoredResource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MonitoredResourceMetadata. */ + interface IMonitoredResourceMetadata { + + /** MonitoredResourceMetadata systemLabels */ + systemLabels?: (google.protobuf.IStruct|null); + + /** MonitoredResourceMetadata userLabels */ + userLabels?: ({ [k: string]: string }|null); + } + + /** Represents a MonitoredResourceMetadata. */ + class MonitoredResourceMetadata implements IMonitoredResourceMetadata { + + /** + * Constructs a new MonitoredResourceMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IMonitoredResourceMetadata); + + /** MonitoredResourceMetadata systemLabels. */ + public systemLabels?: (google.protobuf.IStruct|null); + + /** MonitoredResourceMetadata userLabels. */ + public userLabels: { [k: string]: string }; + + /** + * Creates a new MonitoredResourceMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns MonitoredResourceMetadata instance + */ + public static create(properties?: google.api.IMonitoredResourceMetadata): google.api.MonitoredResourceMetadata; + + /** + * Encodes the specified MonitoredResourceMetadata message. Does not implicitly {@link google.api.MonitoredResourceMetadata.verify|verify} messages. + * @param message MonitoredResourceMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IMonitoredResourceMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MonitoredResourceMetadata message, length delimited. Does not implicitly {@link google.api.MonitoredResourceMetadata.verify|verify} messages. + * @param message MonitoredResourceMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IMonitoredResourceMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MonitoredResourceMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MonitoredResourceMetadata + * @throws {Error} If the payload is not 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.MonitoredResourceMetadata; + + /** + * Decodes a MonitoredResourceMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MonitoredResourceMetadata + * @throws {Error} If the payload 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.MonitoredResourceMetadata; + + /** + * Verifies a MonitoredResourceMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MonitoredResourceMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MonitoredResourceMetadata + */ + public static fromObject(object: { [k: string]: any }): google.api.MonitoredResourceMetadata; + + /** + * Creates a plain object from a MonitoredResourceMetadata message. Also converts values to other types if specified. + * @param message MonitoredResourceMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MonitoredResourceMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MonitoredResourceMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MonitoredResourceMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LabelDescriptor. */ + interface ILabelDescriptor { + + /** LabelDescriptor key */ + key?: (string|null); + + /** LabelDescriptor valueType */ + valueType?: (google.api.LabelDescriptor.ValueType|keyof typeof google.api.LabelDescriptor.ValueType|null); + + /** LabelDescriptor description */ + description?: (string|null); + } + + /** Represents a LabelDescriptor. */ + class LabelDescriptor implements ILabelDescriptor { + + /** + * Constructs a new LabelDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ILabelDescriptor); + + /** LabelDescriptor key. */ + public key: string; + + /** LabelDescriptor valueType. */ + public valueType: (google.api.LabelDescriptor.ValueType|keyof typeof google.api.LabelDescriptor.ValueType); + + /** LabelDescriptor description. */ + public description: string; + + /** + * Creates a new LabelDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns LabelDescriptor instance + */ + public static create(properties?: google.api.ILabelDescriptor): google.api.LabelDescriptor; + + /** + * Encodes the specified LabelDescriptor message. Does not implicitly {@link google.api.LabelDescriptor.verify|verify} messages. + * @param message LabelDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ILabelDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LabelDescriptor message, length delimited. Does not implicitly {@link google.api.LabelDescriptor.verify|verify} messages. + * @param message LabelDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ILabelDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LabelDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LabelDescriptor + * @throws {Error} If the payload is not 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.LabelDescriptor; + + /** + * Decodes a LabelDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LabelDescriptor + * @throws {Error} If the payload 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.LabelDescriptor; + + /** + * Verifies a LabelDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LabelDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LabelDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.LabelDescriptor; + + /** + * Creates a plain object from a LabelDescriptor message. Also converts values to other types if specified. + * @param message LabelDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.LabelDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LabelDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LabelDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace LabelDescriptor { + + /** ValueType enum. */ + enum ValueType { + STRING = 0, + BOOL = 1, + INT64 = 2 + } + } + + /** LaunchStage enum. */ + enum LaunchStage { + LAUNCH_STAGE_UNSPECIFIED = 0, + UNIMPLEMENTED = 6, + PRELAUNCH = 7, + EARLY_ACCESS = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5 + } + + /** Properties of a MetricDescriptor. */ + interface IMetricDescriptor { + + /** MetricDescriptor name */ + name?: (string|null); + + /** MetricDescriptor type */ + type?: (string|null); + + /** MetricDescriptor labels */ + labels?: (google.api.ILabelDescriptor[]|null); + + /** MetricDescriptor metricKind */ + metricKind?: (google.api.MetricDescriptor.MetricKind|keyof typeof google.api.MetricDescriptor.MetricKind|null); + + /** MetricDescriptor valueType */ + valueType?: (google.api.MetricDescriptor.ValueType|keyof typeof google.api.MetricDescriptor.ValueType|null); + + /** MetricDescriptor unit */ + unit?: (string|null); + + /** MetricDescriptor description */ + description?: (string|null); + + /** MetricDescriptor displayName */ + displayName?: (string|null); + + /** MetricDescriptor metadata */ + metadata?: (google.api.MetricDescriptor.IMetricDescriptorMetadata|null); + + /** MetricDescriptor launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); + + /** MetricDescriptor monitoredResourceTypes */ + monitoredResourceTypes?: (string[]|null); + } + + /** Represents a MetricDescriptor. */ + class MetricDescriptor implements IMetricDescriptor { + + /** + * Constructs a new MetricDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IMetricDescriptor); + + /** MetricDescriptor name. */ + public name: string; + + /** MetricDescriptor type. */ + public type: string; + + /** MetricDescriptor labels. */ + public labels: google.api.ILabelDescriptor[]; + + /** MetricDescriptor metricKind. */ + public metricKind: (google.api.MetricDescriptor.MetricKind|keyof typeof google.api.MetricDescriptor.MetricKind); + + /** MetricDescriptor valueType. */ + public valueType: (google.api.MetricDescriptor.ValueType|keyof typeof google.api.MetricDescriptor.ValueType); + + /** MetricDescriptor unit. */ + public unit: string; + + /** MetricDescriptor description. */ + public description: string; + + /** MetricDescriptor displayName. */ + public displayName: string; + + /** MetricDescriptor metadata. */ + public metadata?: (google.api.MetricDescriptor.IMetricDescriptorMetadata|null); + + /** MetricDescriptor launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); + + /** MetricDescriptor monitoredResourceTypes. */ + public monitoredResourceTypes: string[]; + + /** + * Creates a new MetricDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns MetricDescriptor instance + */ + public static create(properties?: google.api.IMetricDescriptor): google.api.MetricDescriptor; + + /** + * Encodes the specified MetricDescriptor message. Does not implicitly {@link google.api.MetricDescriptor.verify|verify} messages. + * @param message MetricDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IMetricDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MetricDescriptor message, length delimited. Does not implicitly {@link google.api.MetricDescriptor.verify|verify} messages. + * @param message MetricDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IMetricDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MetricDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MetricDescriptor + * @throws {Error} If the payload is not 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.MetricDescriptor; + + /** + * Decodes a MetricDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MetricDescriptor + * @throws {Error} If the payload 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.MetricDescriptor; + + /** + * Verifies a MetricDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MetricDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MetricDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.MetricDescriptor; + + /** + * Creates a plain object from a MetricDescriptor message. Also converts values to other types if specified. + * @param message MetricDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MetricDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MetricDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MetricDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MetricDescriptor { + + /** Properties of a MetricDescriptorMetadata. */ + interface IMetricDescriptorMetadata { + + /** MetricDescriptorMetadata launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); + + /** MetricDescriptorMetadata samplePeriod */ + samplePeriod?: (google.protobuf.IDuration|null); + + /** MetricDescriptorMetadata ingestDelay */ + ingestDelay?: (google.protobuf.IDuration|null); + } + + /** Represents a MetricDescriptorMetadata. */ + class MetricDescriptorMetadata implements IMetricDescriptorMetadata { + + /** + * Constructs a new MetricDescriptorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.MetricDescriptor.IMetricDescriptorMetadata); + + /** MetricDescriptorMetadata launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); + + /** MetricDescriptorMetadata samplePeriod. */ + public samplePeriod?: (google.protobuf.IDuration|null); + + /** MetricDescriptorMetadata ingestDelay. */ + public ingestDelay?: (google.protobuf.IDuration|null); + + /** + * Creates a new MetricDescriptorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns MetricDescriptorMetadata instance + */ + public static create(properties?: google.api.MetricDescriptor.IMetricDescriptorMetadata): google.api.MetricDescriptor.MetricDescriptorMetadata; + + /** + * Encodes the specified MetricDescriptorMetadata message. Does not implicitly {@link google.api.MetricDescriptor.MetricDescriptorMetadata.verify|verify} messages. + * @param message MetricDescriptorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.MetricDescriptor.IMetricDescriptorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MetricDescriptorMetadata message, length delimited. Does not implicitly {@link google.api.MetricDescriptor.MetricDescriptorMetadata.verify|verify} messages. + * @param message MetricDescriptorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.MetricDescriptor.IMetricDescriptorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MetricDescriptorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MetricDescriptorMetadata + * @throws {Error} If the payload is not 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.MetricDescriptor.MetricDescriptorMetadata; + + /** + * Decodes a MetricDescriptorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MetricDescriptorMetadata + * @throws {Error} If the payload 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.MetricDescriptor.MetricDescriptorMetadata; + + /** + * Verifies a MetricDescriptorMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MetricDescriptorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MetricDescriptorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.api.MetricDescriptor.MetricDescriptorMetadata; + + /** + * Creates a plain object from a MetricDescriptorMetadata message. Also converts values to other types if specified. + * @param message MetricDescriptorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MetricDescriptor.MetricDescriptorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MetricDescriptorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MetricDescriptorMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** MetricKind enum. */ + enum MetricKind { + METRIC_KIND_UNSPECIFIED = 0, + GAUGE = 1, + DELTA = 2, + CUMULATIVE = 3 + } + + /** ValueType enum. */ + enum ValueType { + VALUE_TYPE_UNSPECIFIED = 0, + BOOL = 1, + INT64 = 2, + DOUBLE = 3, + STRING = 4, + DISTRIBUTION = 5, + MONEY = 6 + } + } + + /** Properties of a Metric. */ + interface IMetric { + + /** Metric type */ + type?: (string|null); + + /** Metric labels */ + labels?: ({ [k: string]: string }|null); + } + + /** Represents a Metric. */ + class Metric implements IMetric { + + /** + * Constructs a new Metric. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IMetric); + + /** Metric type. */ + public type: string; + + /** Metric labels. */ + public labels: { [k: string]: string }; + + /** + * Creates a new Metric instance using the specified properties. + * @param [properties] Properties to set + * @returns Metric instance + */ + public static create(properties?: google.api.IMetric): google.api.Metric; + + /** + * Encodes the specified Metric message. Does not implicitly {@link google.api.Metric.verify|verify} messages. + * @param message Metric message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IMetric, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Metric message, length delimited. Does not implicitly {@link google.api.Metric.verify|verify} messages. + * @param message Metric message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IMetric, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metric message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Metric + * @throws {Error} If the payload is not 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.Metric; + + /** + * Decodes a Metric message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Metric + * @throws {Error} If the payload 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.Metric; + + /** + * Verifies a Metric message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Metric message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Metric + */ + public static fromObject(object: { [k: string]: any }): google.api.Metric; + + /** + * Creates a plain object from a Metric message. Also converts values to other types if specified. + * @param message Metric + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Metric, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Metric to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Metric + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace protobuf. */ + namespace protobuf { + + /** Properties of a FileDescriptorSet. */ + interface IFileDescriptorSet { + + /** FileDescriptorSet file */ + file?: (google.protobuf.IFileDescriptorProto[]|null); + } + + /** Represents a FileDescriptorSet. */ + class FileDescriptorSet implements IFileDescriptorSet { + + /** + * Constructs a new FileDescriptorSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorSet); + + /** FileDescriptorSet file. */ + public file: google.protobuf.IFileDescriptorProto[]; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorSet instance + */ + public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + + /** + * Verifies a FileDescriptorSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @param message FileDescriptorSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FileDescriptorProto. */ + interface IFileDescriptorProto { + + /** FileDescriptorProto name */ + name?: (string|null); + + /** FileDescriptorProto package */ + "package"?: (string|null); + + /** FileDescriptorProto dependency */ + dependency?: (string[]|null); + + /** FileDescriptorProto publicDependency */ + publicDependency?: (number[]|null); + + /** FileDescriptorProto weakDependency */ + weakDependency?: (number[]|null); + + /** FileDescriptorProto messageType */ + messageType?: (google.protobuf.IDescriptorProto[]|null); + + /** FileDescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** FileDescriptorProto service */ + service?: (google.protobuf.IServiceDescriptorProto[]|null); + + /** FileDescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** FileDescriptorProto options */ + options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo */ + sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax */ + syntax?: (string|null); + + /** FileDescriptorProto edition */ + edition?: (string|null); + } + + /** Represents a FileDescriptorProto. */ + class FileDescriptorProto implements IFileDescriptorProto { + + /** + * Constructs a new FileDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorProto); + + /** FileDescriptorProto name. */ + public name: string; + + /** FileDescriptorProto package. */ + public package: string; + + /** FileDescriptorProto dependency. */ + public dependency: string[]; + + /** FileDescriptorProto publicDependency. */ + public publicDependency: number[]; + + /** FileDescriptorProto weakDependency. */ + public weakDependency: number[]; + + /** FileDescriptorProto messageType. */ + public messageType: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service. */ + public service: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options. */ + public options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo. */ + public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax. */ + public syntax: string; + + /** FileDescriptorProto edition. */ + public edition: string; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + + /** + * Verifies a FileDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @param message FileDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DescriptorProto. */ + interface IDescriptorProto { + + /** DescriptorProto name */ + name?: (string|null); + + /** DescriptorProto field */ + field?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto nestedType */ + nestedType?: (google.protobuf.IDescriptorProto[]|null); + + /** DescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** DescriptorProto extensionRange */ + extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); + + /** DescriptorProto oneofDecl */ + oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); + + /** DescriptorProto options */ + options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange */ + reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); + + /** DescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents a DescriptorProto. */ + class DescriptorProto implements IDescriptorProto { + + /** + * Constructs a new DescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDescriptorProto); + + /** DescriptorProto name. */ + public name: string; + + /** DescriptorProto field. */ + public field: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType. */ + public nestedType: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange. */ + public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl. */ + public oneofDecl: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options. */ + public options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange. */ + public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns DescriptorProto instance + */ + public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + + /** + * Verifies a DescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @param message DescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DescriptorProto { + + /** Properties of an ExtensionRange. */ + interface IExtensionRange { + + /** ExtensionRange start */ + start?: (number|null); + + /** ExtensionRange end */ + end?: (number|null); + + /** ExtensionRange options */ + options?: (google.protobuf.IExtensionRangeOptions|null); + } + + /** Represents an ExtensionRange. */ + class ExtensionRange implements IExtensionRange { + + /** + * Constructs a new ExtensionRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); + + /** ExtensionRange start. */ + public start: number; + + /** ExtensionRange end. */ + public end: number; + + /** ExtensionRange options. */ + public options?: (google.protobuf.IExtensionRangeOptions|null); + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Verifies an ExtensionRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @param message ExtensionRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReservedRange. */ + interface IReservedRange { + + /** ReservedRange start */ + start?: (number|null); + + /** ReservedRange end */ + end?: (number|null); + } + + /** Represents a ReservedRange. */ + class ReservedRange implements IReservedRange { + + /** + * Constructs a new ReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); + + /** ReservedRange start. */ + public start: number; + + /** ReservedRange end. */ + public end: number; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ReservedRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Verifies a ReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @param message ReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an ExtensionRangeOptions. */ + interface IExtensionRangeOptions { + + /** ExtensionRangeOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an ExtensionRangeOptions. */ + class ExtensionRangeOptions implements IExtensionRangeOptions { + + /** + * Constructs a new ExtensionRangeOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IExtensionRangeOptions); + + /** ExtensionRangeOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRangeOptions instance + */ + public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions; + + /** + * Verifies an ExtensionRangeOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRangeOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @param message ExtensionRangeOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldDescriptorProto. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: (string|null); + + /** FieldDescriptorProto number */ + number?: (number|null); + + /** FieldDescriptorProto label */ + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + + /** FieldDescriptorProto type */ + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + + /** FieldDescriptorProto typeName */ + typeName?: (string|null); + + /** FieldDescriptorProto extendee */ + extendee?: (string|null); + + /** FieldDescriptorProto defaultValue */ + defaultValue?: (string|null); + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: (number|null); + + /** FieldDescriptorProto jsonName */ + jsonName?: (string|null); + + /** FieldDescriptorProto options */ + options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); + } + + /** Represents a FieldDescriptorProto. */ + class FieldDescriptorProto implements IFieldDescriptorProto { + + /** + * Constructs a new FieldDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldDescriptorProto); + + /** FieldDescriptorProto name. */ + public name: string; + + /** FieldDescriptorProto number. */ + public number: number; + + /** FieldDescriptorProto label. */ + public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); + + /** FieldDescriptorProto type. */ + public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); + + /** FieldDescriptorProto typeName. */ + public typeName: string; + + /** FieldDescriptorProto extendee. */ + public extendee: string; + + /** FieldDescriptorProto defaultValue. */ + public defaultValue: string; + + /** FieldDescriptorProto oneofIndex. */ + public oneofIndex: number; + + /** FieldDescriptorProto jsonName. */ + public jsonName: string; + + /** FieldDescriptorProto options. */ + public options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional. */ + public proto3Optional: boolean; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldDescriptorProto { + + /** Type enum. */ + enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18 + } + + /** Label enum. */ + enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3 + } + } + + /** Properties of an OneofDescriptorProto. */ + interface IOneofDescriptorProto { + + /** OneofDescriptorProto name */ + name?: (string|null); + + /** OneofDescriptorProto options */ + options?: (google.protobuf.IOneofOptions|null); + } + + /** Represents an OneofDescriptorProto. */ + class OneofDescriptorProto implements IOneofDescriptorProto { + + /** + * Constructs a new OneofDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofDescriptorProto); + + /** OneofDescriptorProto name. */ + public name: string; + + /** OneofDescriptorProto options. */ + public options?: (google.protobuf.IOneofOptions|null); + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofDescriptorProto instance + */ + public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + + /** + * Verifies an OneofDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @param message OneofDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumDescriptorProto. */ + interface IEnumDescriptorProto { + + /** EnumDescriptorProto name */ + name?: (string|null); + + /** EnumDescriptorProto value */ + value?: (google.protobuf.IEnumValueDescriptorProto[]|null); + + /** EnumDescriptorProto options */ + options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange */ + reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); + + /** EnumDescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents an EnumDescriptorProto. */ + class EnumDescriptorProto implements IEnumDescriptorProto { + + /** + * Constructs a new EnumDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumDescriptorProto); + + /** EnumDescriptorProto name. */ + public name: string; + + /** EnumDescriptorProto value. */ + public value: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options. */ + public options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange. */ + public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; + + /** EnumDescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + + /** + * Verifies an EnumDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @param message EnumDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EnumDescriptorProto { + + /** Properties of an EnumReservedRange. */ + interface IEnumReservedRange { + + /** EnumReservedRange start */ + start?: (number|null); + + /** EnumReservedRange end */ + end?: (number|null); + } + + /** Represents an EnumReservedRange. */ + class EnumReservedRange implements IEnumReservedRange { + + /** + * Constructs a new EnumReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); + + /** EnumReservedRange start. */ + public start: number; + + /** EnumReservedRange end. */ + public end: number; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumReservedRange instance + */ + public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Verifies an EnumReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @param message EnumReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an EnumValueDescriptorProto. */ + interface IEnumValueDescriptorProto { + + /** EnumValueDescriptorProto name */ + name?: (string|null); + + /** EnumValueDescriptorProto number */ + number?: (number|null); + + /** EnumValueDescriptorProto options */ + options?: (google.protobuf.IEnumValueOptions|null); + } + + /** Represents an EnumValueDescriptorProto. */ + class EnumValueDescriptorProto implements IEnumValueDescriptorProto { + + /** + * Constructs a new EnumValueDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueDescriptorProto); + + /** EnumValueDescriptorProto name. */ + public name: string; + + /** EnumValueDescriptorProto number. */ + public number: number; + + /** EnumValueDescriptorProto options. */ + public options?: (google.protobuf.IEnumValueOptions|null); + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + + /** + * Verifies an EnumValueDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @param message EnumValueDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceDescriptorProto. */ + interface IServiceDescriptorProto { + + /** ServiceDescriptorProto name */ + name?: (string|null); + + /** ServiceDescriptorProto method */ + method?: (google.protobuf.IMethodDescriptorProto[]|null); + + /** ServiceDescriptorProto options */ + options?: (google.protobuf.IServiceOptions|null); + } + + /** Represents a ServiceDescriptorProto. */ + class ServiceDescriptorProto implements IServiceDescriptorProto { + + /** + * Constructs a new ServiceDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceDescriptorProto); + + /** ServiceDescriptorProto name. */ + public name: string; + + /** ServiceDescriptorProto method. */ + public method: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options. */ + public options?: (google.protobuf.IServiceOptions|null); + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceDescriptorProto instance + */ + public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + + /** + * Verifies a ServiceDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @param message ServiceDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodDescriptorProto. */ + interface IMethodDescriptorProto { + + /** MethodDescriptorProto name */ + name?: (string|null); + + /** MethodDescriptorProto inputType */ + inputType?: (string|null); + + /** MethodDescriptorProto outputType */ + outputType?: (string|null); + + /** MethodDescriptorProto options */ + options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming */ + clientStreaming?: (boolean|null); + + /** MethodDescriptorProto serverStreaming */ + serverStreaming?: (boolean|null); + } + + /** Represents a MethodDescriptorProto. */ + class MethodDescriptorProto implements IMethodDescriptorProto { + + /** + * Constructs a new MethodDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodDescriptorProto); + + /** MethodDescriptorProto name. */ + public name: string; + + /** MethodDescriptorProto inputType. */ + public inputType: string; + + /** MethodDescriptorProto outputType. */ + public outputType: string; + + /** MethodDescriptorProto options. */ + public options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming. */ + public clientStreaming: boolean; + + /** MethodDescriptorProto serverStreaming. */ + public serverStreaming: boolean; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodDescriptorProto instance + */ + public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + + /** + * Verifies a MethodDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @param message MethodDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FileOptions. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: (string|null); + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: (string|null); + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: (boolean|null); + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: (boolean|null); + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: (boolean|null); + + /** FileOptions optimizeFor */ + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + + /** FileOptions goPackage */ + goPackage?: (string|null); + + /** FileOptions ccGenericServices */ + ccGenericServices?: (boolean|null); + + /** FileOptions javaGenericServices */ + javaGenericServices?: (boolean|null); + + /** FileOptions pyGenericServices */ + pyGenericServices?: (boolean|null); + + /** FileOptions phpGenericServices */ + phpGenericServices?: (boolean|null); + + /** FileOptions deprecated */ + deprecated?: (boolean|null); + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: (boolean|null); + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: (string|null); + + /** FileOptions csharpNamespace */ + csharpNamespace?: (string|null); + + /** FileOptions swiftPrefix */ + swiftPrefix?: (string|null); + + /** FileOptions phpClassPrefix */ + phpClassPrefix?: (string|null); + + /** FileOptions phpNamespace */ + phpNamespace?: (string|null); + + /** FileOptions phpMetadataNamespace */ + phpMetadataNamespace?: (string|null); + + /** FileOptions rubyPackage */ + rubyPackage?: (string|null); + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); + } + + /** Represents a FileOptions. */ + class FileOptions implements IFileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions phpGenericServices. */ + public phpGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions swiftPrefix. */ + public swiftPrefix: string; + + /** FileOptions phpClassPrefix. */ + public phpClassPrefix: string; + + /** FileOptions phpNamespace. */ + public phpNamespace: string; + + /** FileOptions phpMetadataNamespace. */ + public phpMetadataNamespace: string; + + /** FileOptions rubyPackage. */ + public rubyPackage: string; + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FileOptions { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: (boolean|null); + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: (boolean|null); + + /** MessageOptions deprecated */ + deprecated?: (boolean|null); + + /** MessageOptions mapEntry */ + mapEntry?: (boolean|null); + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); + } + + /** Represents a MessageOptions. */ + class MessageOptions implements IMessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldOptions. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + + /** FieldOptions lazy */ + lazy?: (boolean|null); + + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + + /** FieldOptions deprecated */ + deprecated?: (boolean|null); + + /** FieldOptions weak */ + weak?: (boolean|null); + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FieldOptions .google.api.fieldBehavior */ + ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); + } + + /** Represents a FieldOptions. */ + class FieldOptions implements IFieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + + /** FieldOptions deprecated. */ + public deprecated: boolean; + + /** FieldOptions weak. */ + public weak: boolean; + + /** FieldOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOptions instance + */ + public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + + /** + * Verifies a FieldOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @param message FieldOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldOptions { + + /** CType enum. */ + enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2 + } + + /** JSType enum. */ + enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2 + } + } + + /** Properties of an OneofOptions. */ + interface IOneofOptions { + + /** OneofOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an OneofOptions. */ + class OneofOptions implements IOneofOptions { + + /** + * Constructs a new OneofOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofOptions); + + /** OneofOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofOptions instance + */ + public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + + /** + * Verifies an OneofOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @param message OneofOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumOptions. */ + interface IEnumOptions { + + /** EnumOptions allowAlias */ + allowAlias?: (boolean|null); + + /** EnumOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumOptions. */ + class EnumOptions implements IEnumOptions { + + /** + * Constructs a new EnumOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumOptions); + + /** EnumOptions allowAlias. */ + public allowAlias: boolean; + + /** EnumOptions deprecated. */ + public deprecated: boolean; + + /** EnumOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumOptions instance + */ + public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + + /** + * Verifies an EnumOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @param message EnumOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumValueOptions. */ + interface IEnumValueOptions { + + /** EnumValueOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumValueOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumValueOptions. */ + class EnumValueOptions implements IEnumValueOptions { + + /** + * Constructs a new EnumValueOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueOptions); + + /** EnumValueOptions deprecated. */ + public deprecated: boolean; + + /** EnumValueOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueOptions instance + */ + public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + + /** + * Verifies an EnumValueOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @param message EnumValueOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceOptions. */ + interface IServiceOptions { + + /** ServiceOptions deprecated */ + deprecated?: (boolean|null); + + /** ServiceOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ServiceOptions .google.api.defaultHost */ + ".google.api.defaultHost"?: (string|null); + + /** ServiceOptions .google.api.oauthScopes */ + ".google.api.oauthScopes"?: (string|null); + } + + /** Represents a ServiceOptions. */ + class ServiceOptions implements IServiceOptions { + + /** + * Constructs a new ServiceOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceOptions); + + /** ServiceOptions deprecated. */ + public deprecated: boolean; + + /** ServiceOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceOptions instance + */ + public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + + /** + * Verifies a ServiceOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @param message ServiceOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodOptions. */ + interface IMethodOptions { + + /** MethodOptions deprecated */ + deprecated?: (boolean|null); + + /** MethodOptions idempotencyLevel */ + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + + /** MethodOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MethodOptions .google.api.http */ + ".google.api.http"?: (google.api.IHttpRule|null); + + /** MethodOptions .google.api.methodSignature */ + ".google.api.methodSignature"?: (string[]|null); + } + + /** Represents a MethodOptions. */ + class MethodOptions implements IMethodOptions { + + /** + * Constructs a new MethodOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodOptions); + + /** MethodOptions deprecated. */ + public deprecated: boolean; + + /** MethodOptions idempotencyLevel. */ + public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); + + /** MethodOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodOptions instance + */ + public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + + /** + * Verifies a MethodOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @param message MethodOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MethodOptions { + + /** IdempotencyLevel enum. */ + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2 + } + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + + /** UninterpretedOption identifierValue */ + identifierValue?: (string|null); + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long|string|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|string|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|string|null); + + /** UninterpretedOption aggregateValue */ + aggregateValue?: (string|null); + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption implements IUninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long|string); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long|string); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: (Uint8Array|string); + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UninterpretedOption + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UninterpretedOption { + + /** Properties of a NamePart. */ + interface INamePart { + + /** NamePart namePart */ + namePart: string; + + /** NamePart isExtension */ + isExtension: boolean; + } + + /** Represents a NamePart. */ + class NamePart implements INamePart { + + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + + /** NamePart namePart. */ + public namePart: string; + + /** NamePart isExtension. */ + public isExtension: boolean; + + /** + * Creates a new NamePart instance using the specified properties. + * @param [properties] Properties to set + * @returns NamePart instance + */ + public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + + /** + * Verifies a NamePart message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NamePart + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @param message NamePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NamePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NamePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo implements ISourceCodeInfo { + + /** + * Constructs a new SourceCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ISourceCodeInfo); + + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceCodeInfo instance + */ + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + + /** + * Verifies a SourceCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @param message SourceCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SourceCodeInfo { + + /** Properties of a Location. */ + interface ILocation { + + /** Location path */ + path?: (number[]|null); + + /** Location span */ + span?: (number[]|null); + + /** Location leadingComments */ + leadingComments?: (string|null); + + /** Location trailingComments */ + trailingComments?: (string|null); + + /** Location leadingDetachedComments */ + leadingDetachedComments?: (string[]|null); + } + + /** Represents a Location. */ + class Location implements ILocation { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + + /** Location path. */ + public path: number[]; + + /** Location span. */ + public span: number[]; + + /** Location leadingComments. */ + public leadingComments: string; + + /** Location trailingComments. */ + public trailingComments: string; + + /** Location leadingDetachedComments. */ + public leadingDetachedComments: string[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Location + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { + + /** GeneratedCodeInfo annotation */ + annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); + } + + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo implements IGeneratedCodeInfo { + + /** + * Constructs a new GeneratedCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IGeneratedCodeInfo); + + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratedCodeInfo instance + */ + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + + /** + * Verifies a GeneratedCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratedCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @param message GeneratedCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace GeneratedCodeInfo { + + /** Properties of an Annotation. */ + interface IAnnotation { + + /** Annotation path */ + path?: (number[]|null); + + /** Annotation sourceFile */ + sourceFile?: (string|null); + + /** Annotation begin */ + begin?: (number|null); + + /** Annotation end */ + end?: (number|null); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); + } + + /** Represents an Annotation. */ + class Annotation implements IAnnotation { + + /** + * Constructs a new Annotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + + /** Annotation path. */ + public path: number[]; + + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; + + /** Annotation semantic. */ + public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); + + /** + * Creates a new Annotation instance using the specified properties. + * @param [properties] Properties to set + * @returns Annotation instance + */ + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Verifies an Annotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Annotation + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @param message Annotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Annotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Annotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Annotation { + + /** Semantic enum. */ + enum Semantic { + NONE = 0, + SET = 1, + ALIAS = 2 + } + } + } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; + + /** + * Verifies an Any message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Any + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Timestamp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } + + /** Represents a Duration. */ + class Duration implements IDuration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Duration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DoubleValue. */ + interface IDoubleValue { + + /** DoubleValue value */ + value?: (number|null); + } + + /** Represents a DoubleValue. */ + class DoubleValue implements IDoubleValue { + + /** + * Constructs a new DoubleValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDoubleValue); + + /** DoubleValue value. */ + public value: number; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @param [properties] Properties to set + * @returns DoubleValue instance + */ + public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoubleValue + * @throws {Error} If the payload is not 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.DoubleValue; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoubleValue + * @throws {Error} If the payload 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.DoubleValue; + + /** + * Verifies a DoubleValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoubleValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @param message DoubleValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoubleValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DoubleValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FloatValue. */ + interface IFloatValue { + + /** FloatValue value */ + value?: (number|null); + } + + /** Represents a FloatValue. */ + class FloatValue implements IFloatValue { + + /** + * Constructs a new FloatValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFloatValue); + + /** FloatValue value. */ + public value: number; + + /** + * Creates a new FloatValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FloatValue instance + */ + public static create(properties?: google.protobuf.IFloatValue): google.protobuf.FloatValue; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FloatValue + * @throws {Error} If the payload is not 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.FloatValue; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FloatValue + * @throws {Error} If the payload 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.FloatValue; + + /** + * Verifies a FloatValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FloatValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FloatValue; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @param message FloatValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FloatValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FloatValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FloatValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Int64Value. */ + interface IInt64Value { + + /** Int64Value value */ + value?: (number|Long|string|null); + } + + /** Represents an Int64Value. */ + class Int64Value implements IInt64Value { + + /** + * Constructs a new Int64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt64Value); + + /** Int64Value value. */ + public value: (number|Long|string); + + /** + * Creates a new Int64Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int64Value instance + */ + public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int64Value + * @throws {Error} If the payload is not 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.Int64Value; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int64Value + * @throws {Error} If the payload 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.Int64Value; + + /** + * Verifies an Int64Value message. + * @param message Plain 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 Int64Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int64Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @param message Int64Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int64Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int64Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UInt64Value. */ + interface IUInt64Value { + + /** UInt64Value value */ + value?: (number|Long|string|null); + } + + /** Represents a UInt64Value. */ + class UInt64Value implements IUInt64Value { + + /** + * Constructs a new UInt64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt64Value); + + /** UInt64Value value. */ + public value: (number|Long|string); + + /** + * Creates a new UInt64Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt64Value instance + */ + public static create(properties?: google.protobuf.IUInt64Value): google.protobuf.UInt64Value; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt64Value + * @throws {Error} If the payload is not 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.UInt64Value; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt64Value + * @throws {Error} If the payload 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.UInt64Value; + + /** + * Verifies a UInt64Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt64Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt64Value; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @param message UInt64Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt64Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt64Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Int32Value. */ + interface IInt32Value { + + /** Int32Value value */ + value?: (number|null); + } + + /** Represents an Int32Value. */ + class Int32Value implements IInt32Value { + + /** + * Constructs a new Int32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt32Value); + + /** Int32Value value. */ + public value: number; + + /** + * Creates a new Int32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int32Value instance + */ + public static create(properties?: google.protobuf.IInt32Value): google.protobuf.Int32Value; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int32Value + * @throws {Error} If the payload is not 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.Int32Value; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int32Value + * @throws {Error} If the payload 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.Int32Value; + + /** + * Verifies an Int32Value message. + * @param message Plain 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 Int32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int32Value; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @param message Int32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UInt32Value. */ + interface IUInt32Value { + + /** UInt32Value value */ + value?: (number|null); + } + + /** Represents a UInt32Value. */ + class UInt32Value implements IUInt32Value { + + /** + * Constructs a new UInt32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt32Value); + + /** UInt32Value value. */ + public value: number; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt32Value instance + */ + public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt32Value + * @throws {Error} If the payload is not 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.UInt32Value; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt32Value + * @throws {Error} If the payload 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.UInt32Value; + + /** + * Verifies a UInt32Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @param message UInt32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BoolValue. */ + interface IBoolValue { + + /** BoolValue value */ + value?: (boolean|null); + } + + /** Represents a BoolValue. */ + class BoolValue implements IBoolValue { + + /** + * Constructs a new BoolValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBoolValue); + + /** BoolValue value. */ + public value: boolean; + + /** + * Creates a new BoolValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BoolValue instance + */ + public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoolValue + * @throws {Error} If the payload is not 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.BoolValue; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoolValue + * @throws {Error} If the payload 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.BoolValue; + + /** + * Verifies a BoolValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoolValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @param message BoolValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoolValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoolValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StringValue. */ + interface IStringValue { + + /** StringValue value */ + value?: (string|null); + } + + /** Represents a StringValue. */ + class StringValue implements IStringValue { + + /** + * Constructs a new StringValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStringValue); + + /** StringValue value. */ + public value: string; + + /** + * Creates a new StringValue instance using the specified properties. + * @param [properties] Properties to set + * @returns StringValue instance + */ + public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StringValue + * @throws {Error} If the payload is not 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.StringValue; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StringValue + * @throws {Error} If the payload 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.StringValue; + + /** + * Verifies a StringValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StringValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @param message StringValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StringValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StringValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BytesValue. */ + interface IBytesValue { + + /** BytesValue value */ + value?: (Uint8Array|string|null); + } + + /** Represents a BytesValue. */ + class BytesValue implements IBytesValue { + + /** + * Constructs a new BytesValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBytesValue); + + /** BytesValue value. */ + public value: (Uint8Array|string); + + /** + * Creates a new BytesValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BytesValue instance + */ + public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BytesValue + * @throws {Error} If the payload is not 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.BytesValue; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BytesValue + * @throws {Error} If the payload 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.BytesValue; + + /** + * Verifies a BytesValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BytesValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @param message BytesValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BytesValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BytesValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Struct. */ + interface IStruct { + + /** Struct fields */ + fields?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a Struct. */ + class Struct implements IStruct { + + /** + * Constructs a new Struct. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStruct); + + /** Struct fields. */ + public fields: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new Struct instance using the specified properties. + * @param [properties] Properties to set + * @returns Struct instance + */ + public static create(properties?: google.protobuf.IStruct): google.protobuf.Struct; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @param message Struct message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStruct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @param message Struct message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStruct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Struct + * @throws {Error} If the payload is not 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.Struct; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Struct + * @throws {Error} If the payload 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.Struct; + + /** + * Verifies a Struct message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Struct + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Struct; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @param message Struct + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Struct, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Struct to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Struct + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Value. */ + interface IValue { + + /** Value nullValue */ + nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value numberValue */ + numberValue?: (number|null); + + /** Value stringValue */ + stringValue?: (string|null); + + /** Value boolValue */ + boolValue?: (boolean|null); + + /** Value structValue */ + structValue?: (google.protobuf.IStruct|null); + + /** Value listValue */ + listValue?: (google.protobuf.IListValue|null); + } + + /** Represents a Value. */ + class Value implements IValue { + + /** + * Constructs a new Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IValue); + + /** Value nullValue. */ + public nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value numberValue. */ + public numberValue?: (number|null); + + /** Value stringValue. */ + public stringValue?: (string|null); + + /** Value boolValue. */ + public boolValue?: (boolean|null); + + /** Value structValue. */ + public structValue?: (google.protobuf.IStruct|null); + + /** Value listValue. */ + public listValue?: (google.protobuf.IListValue|null); + + /** Value kind. */ + public kind?: ("nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"); + + /** + * Creates a new Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Value instance + */ + public static create(properties?: google.protobuf.IValue): google.protobuf.Value; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Value + * @throws {Error} If the payload is not 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.Value; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Value + * @throws {Error} If the payload 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.Value; + + /** + * Verifies a Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Value; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @param message Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** NullValue enum. */ + enum NullValue { + NULL_VALUE = 0 + } + + /** Properties of a ListValue. */ + interface IListValue { + + /** ListValue values */ + values?: (google.protobuf.IValue[]|null); + } + + /** Represents a ListValue. */ + class ListValue implements IListValue { + + /** + * Constructs a new ListValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IListValue); + + /** ListValue values. */ + public values: google.protobuf.IValue[]; + + /** + * Creates a new ListValue instance using the specified properties. + * @param [properties] Properties to set + * @returns ListValue instance + */ + public static create(properties?: google.protobuf.IListValue): google.protobuf.ListValue; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @param message ListValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IListValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @param message ListValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IListValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListValue + * @throws {Error} If the payload is not 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.ListValue; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListValue + * @throws {Error} If the payload 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.ListValue; + + /** + * Verifies a ListValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ListValue; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @param message ListValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ListValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace rpc. */ + namespace rpc { + + /** Properties of a Status. */ + interface IStatus { + + /** Status code */ + code?: (number|null); + + /** Status message */ + message?: (string|null); + + /** Status details */ + details?: (google.protobuf.IAny[]|null); + } + + /** Represents a Status. */ + class Status implements IStatus { + + /** + * Constructs a new Status. + * @param [properties] Properties to set + */ + constructor(properties?: google.rpc.IStatus); + + /** Status code. */ + public code: number; + + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; + + /** + * Creates a new Status instance using the specified properties. + * @param [properties] Properties to set + * @returns Status instance + */ + public static create(properties?: google.rpc.IStatus): google.rpc.Status; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Status message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; + + /** + * Verifies a Status message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Status + */ + public static fromObject(object: { [k: string]: any }): google.rpc.Status; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Status to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Status + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace type. */ + namespace type { + + /** CalendarPeriod enum. */ + enum CalendarPeriod { + CALENDAR_PERIOD_UNSPECIFIED = 0, + DAY = 1, + WEEK = 2, + FORTNIGHT = 3, + MONTH = 4, + QUARTER = 5, + HALF = 6, + YEAR = 7 + } + } +} diff --git a/packages/google-cloud-monitoring/protos/protos.js b/packages/google-cloud-monitoring/protos/protos.js new file mode 100644 index 00000000000..1bd8a260358 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/protos.js @@ -0,0 +1,54007 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +(function(global, factory) { /* global define, require, module */ + + /* AMD */ if (typeof define === 'function' && define.amd) + define(["protobufjs/minimal"], factory); + + /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) + module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots._google_cloud_monitoring_protos || ($protobuf.roots._google_cloud_monitoring_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.monitoring = (function() { + + /** + * Namespace monitoring. + * @memberof google + * @namespace + */ + var monitoring = {}; + + monitoring.v3 = (function() { + + /** + * Namespace v3. + * @memberof google.monitoring + * @namespace + */ + var v3 = {}; + + v3.AlertPolicy = (function() { + + /** + * Properties of an AlertPolicy. + * @memberof google.monitoring.v3 + * @interface IAlertPolicy + * @property {string|null} [name] AlertPolicy name + * @property {string|null} [displayName] AlertPolicy displayName + * @property {google.monitoring.v3.AlertPolicy.IDocumentation|null} [documentation] AlertPolicy documentation + * @property {Object.|null} [userLabels] AlertPolicy userLabels + * @property {Array.|null} [conditions] AlertPolicy conditions + * @property {google.monitoring.v3.AlertPolicy.ConditionCombinerType|null} [combiner] AlertPolicy combiner + * @property {google.protobuf.IBoolValue|null} [enabled] AlertPolicy enabled + * @property {google.rpc.IStatus|null} [validity] AlertPolicy validity + * @property {Array.|null} [notificationChannels] AlertPolicy notificationChannels + * @property {google.monitoring.v3.IMutationRecord|null} [creationRecord] AlertPolicy creationRecord + * @property {google.monitoring.v3.IMutationRecord|null} [mutationRecord] AlertPolicy mutationRecord + */ + + /** + * Constructs a new AlertPolicy. + * @memberof google.monitoring.v3 + * @classdesc Represents an AlertPolicy. + * @implements IAlertPolicy + * @constructor + * @param {google.monitoring.v3.IAlertPolicy=} [properties] Properties to set + */ + function AlertPolicy(properties) { + this.userLabels = {}; + this.conditions = []; + this.notificationChannels = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AlertPolicy name. + * @member {string} name + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.name = ""; + + /** + * AlertPolicy displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.displayName = ""; + + /** + * AlertPolicy documentation. + * @member {google.monitoring.v3.AlertPolicy.IDocumentation|null|undefined} documentation + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.documentation = null; + + /** + * AlertPolicy userLabels. + * @member {Object.} userLabels + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.userLabels = $util.emptyObject; + + /** + * AlertPolicy conditions. + * @member {Array.} conditions + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.conditions = $util.emptyArray; + + /** + * AlertPolicy combiner. + * @member {google.monitoring.v3.AlertPolicy.ConditionCombinerType} combiner + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.combiner = 0; + + /** + * AlertPolicy enabled. + * @member {google.protobuf.IBoolValue|null|undefined} enabled + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.enabled = null; + + /** + * AlertPolicy validity. + * @member {google.rpc.IStatus|null|undefined} validity + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.validity = null; + + /** + * AlertPolicy notificationChannels. + * @member {Array.} notificationChannels + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.notificationChannels = $util.emptyArray; + + /** + * AlertPolicy creationRecord. + * @member {google.monitoring.v3.IMutationRecord|null|undefined} creationRecord + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.creationRecord = null; + + /** + * AlertPolicy mutationRecord. + * @member {google.monitoring.v3.IMutationRecord|null|undefined} mutationRecord + * @memberof google.monitoring.v3.AlertPolicy + * @instance + */ + AlertPolicy.prototype.mutationRecord = null; + + /** + * Creates a new AlertPolicy instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {google.monitoring.v3.IAlertPolicy=} [properties] Properties to set + * @returns {google.monitoring.v3.AlertPolicy} AlertPolicy instance + */ + AlertPolicy.create = function create(properties) { + return new AlertPolicy(properties); + }; + + /** + * Encodes the specified AlertPolicy message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {google.monitoring.v3.IAlertPolicy} message AlertPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AlertPolicy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.combiner != null && Object.hasOwnProperty.call(message, "combiner")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.combiner); + if (message.creationRecord != null && Object.hasOwnProperty.call(message, "creationRecord")) + $root.google.monitoring.v3.MutationRecord.encode(message.creationRecord, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.mutationRecord != null && Object.hasOwnProperty.call(message, "mutationRecord")) + $root.google.monitoring.v3.MutationRecord.encode(message.mutationRecord, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.conditions != null && message.conditions.length) + for (var i = 0; i < message.conditions.length; ++i) + $root.google.monitoring.v3.AlertPolicy.Condition.encode(message.conditions[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.documentation != null && Object.hasOwnProperty.call(message, "documentation")) + $root.google.monitoring.v3.AlertPolicy.Documentation.encode(message.documentation, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.notificationChannels != null && message.notificationChannels.length) + for (var i = 0; i < message.notificationChannels.length; ++i) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.notificationChannels[i]); + if (message.userLabels != null && Object.hasOwnProperty.call(message, "userLabels")) + for (var keys = Object.keys(message.userLabels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 16, wireType 2 =*/130).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userLabels[keys[i]]).ldelim(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + $root.google.protobuf.BoolValue.encode(message.enabled, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.validity != null && Object.hasOwnProperty.call(message, "validity")) + $root.google.rpc.Status.encode(message.validity, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AlertPolicy message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {google.monitoring.v3.IAlertPolicy} message AlertPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AlertPolicy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AlertPolicy message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.AlertPolicy} AlertPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AlertPolicy.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 13: { + message.documentation = $root.google.monitoring.v3.AlertPolicy.Documentation.decode(reader, reader.uint32()); + break; + } + case 16: { + if (message.userLabels === $util.emptyObject) + message.userLabels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.userLabels[key] = value; + break; + } + case 12: { + if (!(message.conditions && message.conditions.length)) + message.conditions = []; + message.conditions.push($root.google.monitoring.v3.AlertPolicy.Condition.decode(reader, reader.uint32())); + break; + } + case 6: { + message.combiner = reader.int32(); + break; + } + case 17: { + message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 18: { + message.validity = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 14: { + if (!(message.notificationChannels && message.notificationChannels.length)) + message.notificationChannels = []; + message.notificationChannels.push(reader.string()); + break; + } + case 10: { + message.creationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32()); + break; + } + case 11: { + message.mutationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AlertPolicy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.AlertPolicy} AlertPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AlertPolicy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AlertPolicy message. + * @function verify + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AlertPolicy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.documentation != null && message.hasOwnProperty("documentation")) { + var error = $root.google.monitoring.v3.AlertPolicy.Documentation.verify(message.documentation); + if (error) + return "documentation." + error; + } + if (message.userLabels != null && message.hasOwnProperty("userLabels")) { + if (!$util.isObject(message.userLabels)) + return "userLabels: object expected"; + var key = Object.keys(message.userLabels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.userLabels[key[i]])) + return "userLabels: string{k:string} expected"; + } + if (message.conditions != null && message.hasOwnProperty("conditions")) { + if (!Array.isArray(message.conditions)) + return "conditions: array expected"; + for (var i = 0; i < message.conditions.length; ++i) { + var error = $root.google.monitoring.v3.AlertPolicy.Condition.verify(message.conditions[i]); + if (error) + return "conditions." + error; + } + } + if (message.combiner != null && message.hasOwnProperty("combiner")) + switch (message.combiner) { + default: + return "combiner: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.enabled); + if (error) + return "enabled." + error; + } + if (message.validity != null && message.hasOwnProperty("validity")) { + var error = $root.google.rpc.Status.verify(message.validity); + if (error) + return "validity." + error; + } + if (message.notificationChannels != null && message.hasOwnProperty("notificationChannels")) { + if (!Array.isArray(message.notificationChannels)) + return "notificationChannels: array expected"; + for (var i = 0; i < message.notificationChannels.length; ++i) + if (!$util.isString(message.notificationChannels[i])) + return "notificationChannels: string[] expected"; + } + if (message.creationRecord != null && message.hasOwnProperty("creationRecord")) { + var error = $root.google.monitoring.v3.MutationRecord.verify(message.creationRecord); + if (error) + return "creationRecord." + error; + } + if (message.mutationRecord != null && message.hasOwnProperty("mutationRecord")) { + var error = $root.google.monitoring.v3.MutationRecord.verify(message.mutationRecord); + if (error) + return "mutationRecord." + error; + } + return null; + }; + + /** + * Creates an AlertPolicy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.AlertPolicy} AlertPolicy + */ + AlertPolicy.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.AlertPolicy) + return object; + var message = new $root.google.monitoring.v3.AlertPolicy(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.documentation != null) { + if (typeof object.documentation !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.documentation: object expected"); + message.documentation = $root.google.monitoring.v3.AlertPolicy.Documentation.fromObject(object.documentation); + } + if (object.userLabels) { + if (typeof object.userLabels !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.userLabels: object expected"); + message.userLabels = {}; + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } + if (object.conditions) { + if (!Array.isArray(object.conditions)) + throw TypeError(".google.monitoring.v3.AlertPolicy.conditions: array expected"); + message.conditions = []; + for (var i = 0; i < object.conditions.length; ++i) { + if (typeof object.conditions[i] !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.conditions: object expected"); + message.conditions[i] = $root.google.monitoring.v3.AlertPolicy.Condition.fromObject(object.conditions[i]); + } + } + switch (object.combiner) { + default: + if (typeof object.combiner === "number") { + message.combiner = object.combiner; + break; + } + break; + case "COMBINE_UNSPECIFIED": + case 0: + message.combiner = 0; + break; + case "AND": + case 1: + message.combiner = 1; + break; + case "OR": + case 2: + message.combiner = 2; + break; + case "AND_WITH_MATCHING_RESOURCE": + case 3: + message.combiner = 3; + break; + } + if (object.enabled != null) { + if (typeof object.enabled !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.enabled: object expected"); + message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled); + } + if (object.validity != null) { + if (typeof object.validity !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.validity: object expected"); + message.validity = $root.google.rpc.Status.fromObject(object.validity); + } + if (object.notificationChannels) { + if (!Array.isArray(object.notificationChannels)) + throw TypeError(".google.monitoring.v3.AlertPolicy.notificationChannels: array expected"); + message.notificationChannels = []; + for (var i = 0; i < object.notificationChannels.length; ++i) + message.notificationChannels[i] = String(object.notificationChannels[i]); + } + if (object.creationRecord != null) { + if (typeof object.creationRecord !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.creationRecord: object expected"); + message.creationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.creationRecord); + } + if (object.mutationRecord != null) { + if (typeof object.mutationRecord !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.mutationRecord: object expected"); + message.mutationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.mutationRecord); + } + return message; + }; + + /** + * Creates a plain object from an AlertPolicy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {google.monitoring.v3.AlertPolicy} message AlertPolicy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AlertPolicy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.conditions = []; + object.notificationChannels = []; + } + if (options.objects || options.defaults) + object.userLabels = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.combiner = options.enums === String ? "COMBINE_UNSPECIFIED" : 0; + object.creationRecord = null; + object.mutationRecord = null; + object.documentation = null; + object.enabled = null; + object.validity = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.combiner != null && message.hasOwnProperty("combiner")) + object.combiner = options.enums === String ? $root.google.monitoring.v3.AlertPolicy.ConditionCombinerType[message.combiner] === undefined ? message.combiner : $root.google.monitoring.v3.AlertPolicy.ConditionCombinerType[message.combiner] : message.combiner; + if (message.creationRecord != null && message.hasOwnProperty("creationRecord")) + object.creationRecord = $root.google.monitoring.v3.MutationRecord.toObject(message.creationRecord, options); + if (message.mutationRecord != null && message.hasOwnProperty("mutationRecord")) + object.mutationRecord = $root.google.monitoring.v3.MutationRecord.toObject(message.mutationRecord, options); + if (message.conditions && message.conditions.length) { + object.conditions = []; + for (var j = 0; j < message.conditions.length; ++j) + object.conditions[j] = $root.google.monitoring.v3.AlertPolicy.Condition.toObject(message.conditions[j], options); + } + if (message.documentation != null && message.hasOwnProperty("documentation")) + object.documentation = $root.google.monitoring.v3.AlertPolicy.Documentation.toObject(message.documentation, options); + if (message.notificationChannels && message.notificationChannels.length) { + object.notificationChannels = []; + for (var j = 0; j < message.notificationChannels.length; ++j) + object.notificationChannels[j] = message.notificationChannels[j]; + } + var keys2; + if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { + object.userLabels = {}; + for (var j = 0; j < keys2.length; ++j) + object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = $root.google.protobuf.BoolValue.toObject(message.enabled, options); + if (message.validity != null && message.hasOwnProperty("validity")) + object.validity = $root.google.rpc.Status.toObject(message.validity, options); + return object; + }; + + /** + * Converts this AlertPolicy to JSON. + * @function toJSON + * @memberof google.monitoring.v3.AlertPolicy + * @instance + * @returns {Object.} JSON object + */ + AlertPolicy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AlertPolicy + * @function getTypeUrl + * @memberof google.monitoring.v3.AlertPolicy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AlertPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.AlertPolicy"; + }; + + AlertPolicy.Documentation = (function() { + + /** + * Properties of a Documentation. + * @memberof google.monitoring.v3.AlertPolicy + * @interface IDocumentation + * @property {string|null} [content] Documentation content + * @property {string|null} [mimeType] Documentation mimeType + */ + + /** + * Constructs a new Documentation. + * @memberof google.monitoring.v3.AlertPolicy + * @classdesc Represents a Documentation. + * @implements IDocumentation + * @constructor + * @param {google.monitoring.v3.AlertPolicy.IDocumentation=} [properties] Properties to set + */ + function Documentation(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]]; + } + + /** + * Documentation content. + * @member {string} content + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @instance + */ + Documentation.prototype.content = ""; + + /** + * Documentation mimeType. + * @member {string} mimeType + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @instance + */ + Documentation.prototype.mimeType = ""; + + /** + * Creates a new Documentation instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {google.monitoring.v3.AlertPolicy.IDocumentation=} [properties] Properties to set + * @returns {google.monitoring.v3.AlertPolicy.Documentation} Documentation instance + */ + Documentation.create = function create(properties) { + return new Documentation(properties); + }; + + /** + * Encodes the specified Documentation message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Documentation.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {google.monitoring.v3.AlertPolicy.IDocumentation} message Documentation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Documentation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.content); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + return writer; + }; + + /** + * Encodes the specified Documentation message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Documentation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {google.monitoring.v3.AlertPolicy.IDocumentation} message Documentation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Documentation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Documentation message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.AlertPolicy.Documentation} Documentation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Documentation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Documentation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.content = reader.string(); + break; + } + case 2: { + message.mimeType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Documentation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.AlertPolicy.Documentation} Documentation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Documentation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Documentation message. + * @function verify + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Documentation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + return null; + }; + + /** + * Creates a Documentation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.AlertPolicy.Documentation} Documentation + */ + Documentation.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.AlertPolicy.Documentation) + return object; + var message = new $root.google.monitoring.v3.AlertPolicy.Documentation(); + if (object.content != null) + message.content = String(object.content); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + return message; + }; + + /** + * Creates a plain object from a Documentation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {google.monitoring.v3.AlertPolicy.Documentation} message Documentation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Documentation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.content = ""; + object.mimeType = ""; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + return object; + }; + + /** + * Converts this Documentation to JSON. + * @function toJSON + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @instance + * @returns {Object.} JSON object + */ + Documentation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Documentation + * @function getTypeUrl + * @memberof google.monitoring.v3.AlertPolicy.Documentation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Documentation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.AlertPolicy.Documentation"; + }; + + return Documentation; + })(); + + AlertPolicy.Condition = (function() { + + /** + * Properties of a Condition. + * @memberof google.monitoring.v3.AlertPolicy + * @interface ICondition + * @property {string|null} [name] Condition name + * @property {string|null} [displayName] Condition displayName + * @property {google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold|null} [conditionThreshold] Condition conditionThreshold + * @property {google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence|null} [conditionAbsent] Condition conditionAbsent + * @property {google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition|null} [conditionMonitoringQueryLanguage] Condition conditionMonitoringQueryLanguage + */ + + /** + * Constructs a new Condition. + * @memberof google.monitoring.v3.AlertPolicy + * @classdesc Represents a Condition. + * @implements ICondition + * @constructor + * @param {google.monitoring.v3.AlertPolicy.ICondition=} [properties] Properties to set + */ + function Condition(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]]; + } + + /** + * Condition name. + * @member {string} name + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @instance + */ + Condition.prototype.name = ""; + + /** + * Condition displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @instance + */ + Condition.prototype.displayName = ""; + + /** + * Condition conditionThreshold. + * @member {google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold|null|undefined} conditionThreshold + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @instance + */ + Condition.prototype.conditionThreshold = null; + + /** + * Condition conditionAbsent. + * @member {google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence|null|undefined} conditionAbsent + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @instance + */ + Condition.prototype.conditionAbsent = null; + + /** + * Condition conditionMonitoringQueryLanguage. + * @member {google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition|null|undefined} conditionMonitoringQueryLanguage + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @instance + */ + Condition.prototype.conditionMonitoringQueryLanguage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Condition condition. + * @member {"conditionThreshold"|"conditionAbsent"|"conditionMonitoringQueryLanguage"|undefined} condition + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @instance + */ + Object.defineProperty(Condition.prototype, "condition", { + get: $util.oneOfGetter($oneOfFields = ["conditionThreshold", "conditionAbsent", "conditionMonitoringQueryLanguage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Condition instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {google.monitoring.v3.AlertPolicy.ICondition=} [properties] Properties to set + * @returns {google.monitoring.v3.AlertPolicy.Condition} Condition instance + */ + Condition.create = function create(properties) { + return new Condition(properties); + }; + + /** + * Encodes the specified Condition message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {google.monitoring.v3.AlertPolicy.ICondition} message Condition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Condition.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conditionThreshold != null && Object.hasOwnProperty.call(message, "conditionThreshold")) + $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.encode(message.conditionThreshold, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.conditionAbsent != null && Object.hasOwnProperty.call(message, "conditionAbsent")) + $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.encode(message.conditionAbsent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.displayName); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.name); + if (message.conditionMonitoringQueryLanguage != null && Object.hasOwnProperty.call(message, "conditionMonitoringQueryLanguage")) + $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.encode(message.conditionMonitoringQueryLanguage, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Condition message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {google.monitoring.v3.AlertPolicy.ICondition} message Condition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Condition.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Condition message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.AlertPolicy.Condition} Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Condition.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 12: { + message.name = reader.string(); + break; + } + case 6: { + message.displayName = reader.string(); + break; + } + case 1: { + message.conditionThreshold = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.decode(reader, reader.uint32()); + break; + } + case 2: { + message.conditionAbsent = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.decode(reader, reader.uint32()); + break; + } + case 19: { + message.conditionMonitoringQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Condition message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.AlertPolicy.Condition} Condition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Condition.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Condition message. + * @function verify + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Condition.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.conditionThreshold != null && message.hasOwnProperty("conditionThreshold")) { + properties.condition = 1; + { + var error = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.verify(message.conditionThreshold); + if (error) + return "conditionThreshold." + error; + } + } + if (message.conditionAbsent != null && message.hasOwnProperty("conditionAbsent")) { + if (properties.condition === 1) + return "condition: multiple values"; + properties.condition = 1; + { + var error = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.verify(message.conditionAbsent); + if (error) + return "conditionAbsent." + error; + } + } + if (message.conditionMonitoringQueryLanguage != null && message.hasOwnProperty("conditionMonitoringQueryLanguage")) { + if (properties.condition === 1) + return "condition: multiple values"; + properties.condition = 1; + { + var error = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.verify(message.conditionMonitoringQueryLanguage); + if (error) + return "conditionMonitoringQueryLanguage." + error; + } + } + return null; + }; + + /** + * Creates a Condition message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.AlertPolicy.Condition} Condition + */ + Condition.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition) + return object; + var message = new $root.google.monitoring.v3.AlertPolicy.Condition(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.conditionThreshold != null) { + if (typeof object.conditionThreshold !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionThreshold: object expected"); + message.conditionThreshold = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.fromObject(object.conditionThreshold); + } + if (object.conditionAbsent != null) { + if (typeof object.conditionAbsent !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionAbsent: object expected"); + message.conditionAbsent = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.fromObject(object.conditionAbsent); + } + if (object.conditionMonitoringQueryLanguage != null) { + if (typeof object.conditionMonitoringQueryLanguage !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.conditionMonitoringQueryLanguage: object expected"); + message.conditionMonitoringQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.fromObject(object.conditionMonitoringQueryLanguage); + } + return message; + }; + + /** + * Creates a plain object from a Condition message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition} message Condition + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Condition.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.displayName = ""; + object.name = ""; + } + if (message.conditionThreshold != null && message.hasOwnProperty("conditionThreshold")) { + object.conditionThreshold = $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.toObject(message.conditionThreshold, options); + if (options.oneofs) + object.condition = "conditionThreshold"; + } + if (message.conditionAbsent != null && message.hasOwnProperty("conditionAbsent")) { + object.conditionAbsent = $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.toObject(message.conditionAbsent, options); + if (options.oneofs) + object.condition = "conditionAbsent"; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.conditionMonitoringQueryLanguage != null && message.hasOwnProperty("conditionMonitoringQueryLanguage")) { + object.conditionMonitoringQueryLanguage = $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.toObject(message.conditionMonitoringQueryLanguage, options); + if (options.oneofs) + object.condition = "conditionMonitoringQueryLanguage"; + } + return object; + }; + + /** + * Converts this Condition to JSON. + * @function toJSON + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @instance + * @returns {Object.} JSON object + */ + Condition.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Condition + * @function getTypeUrl + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Condition.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.AlertPolicy.Condition"; + }; + + Condition.Trigger = (function() { + + /** + * Properties of a Trigger. + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @interface ITrigger + * @property {number|null} [count] Trigger count + * @property {number|null} [percent] Trigger percent + */ + + /** + * Constructs a new Trigger. + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @classdesc Represents a Trigger. + * @implements ITrigger + * @constructor + * @param {google.monitoring.v3.AlertPolicy.Condition.ITrigger=} [properties] Properties to set + */ + function Trigger(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]]; + } + + /** + * Trigger count. + * @member {number|null|undefined} count + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @instance + */ + Trigger.prototype.count = null; + + /** + * Trigger percent. + * @member {number|null|undefined} percent + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @instance + */ + Trigger.prototype.percent = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Trigger type. + * @member {"count"|"percent"|undefined} type + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @instance + */ + Object.defineProperty(Trigger.prototype, "type", { + get: $util.oneOfGetter($oneOfFields = ["count", "percent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Trigger instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.ITrigger=} [properties] Properties to set + * @returns {google.monitoring.v3.AlertPolicy.Condition.Trigger} Trigger instance + */ + Trigger.create = function create(properties) { + return new Trigger(properties); + }; + + /** + * Encodes the specified Trigger message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.Trigger.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.ITrigger} message Trigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Trigger.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.count); + if (message.percent != null && Object.hasOwnProperty.call(message, "percent")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.percent); + return writer; + }; + + /** + * Encodes the specified Trigger message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.Trigger.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.ITrigger} message Trigger message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Trigger.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Trigger message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.AlertPolicy.Condition.Trigger} Trigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Trigger.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.Trigger(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.count = reader.int32(); + break; + } + case 2: { + message.percent = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Trigger message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.AlertPolicy.Condition.Trigger} Trigger + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Trigger.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Trigger message. + * @function verify + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Trigger.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.count != null && message.hasOwnProperty("count")) { + properties.type = 1; + if (!$util.isInteger(message.count)) + return "count: integer expected"; + } + if (message.percent != null && message.hasOwnProperty("percent")) { + if (properties.type === 1) + return "type: multiple values"; + properties.type = 1; + if (typeof message.percent !== "number") + return "percent: number expected"; + } + return null; + }; + + /** + * Creates a Trigger message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.AlertPolicy.Condition.Trigger} Trigger + */ + Trigger.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.Trigger) + return object; + var message = new $root.google.monitoring.v3.AlertPolicy.Condition.Trigger(); + if (object.count != null) + message.count = object.count | 0; + if (object.percent != null) + message.percent = Number(object.percent); + return message; + }; + + /** + * Creates a plain object from a Trigger message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.Trigger} message Trigger + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Trigger.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.count != null && message.hasOwnProperty("count")) { + object.count = message.count; + if (options.oneofs) + object.type = "count"; + } + if (message.percent != null && message.hasOwnProperty("percent")) { + object.percent = options.json && !isFinite(message.percent) ? String(message.percent) : message.percent; + if (options.oneofs) + object.type = "percent"; + } + return object; + }; + + /** + * Converts this Trigger to JSON. + * @function toJSON + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @instance + * @returns {Object.} JSON object + */ + Trigger.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Trigger + * @function getTypeUrl + * @memberof google.monitoring.v3.AlertPolicy.Condition.Trigger + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Trigger.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.AlertPolicy.Condition.Trigger"; + }; + + return Trigger; + })(); + + Condition.MetricThreshold = (function() { + + /** + * Properties of a MetricThreshold. + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @interface IMetricThreshold + * @property {string|null} [filter] MetricThreshold filter + * @property {Array.|null} [aggregations] MetricThreshold aggregations + * @property {string|null} [denominatorFilter] MetricThreshold denominatorFilter + * @property {Array.|null} [denominatorAggregations] MetricThreshold denominatorAggregations + * @property {google.monitoring.v3.ComparisonType|null} [comparison] MetricThreshold comparison + * @property {number|null} [thresholdValue] MetricThreshold thresholdValue + * @property {google.protobuf.IDuration|null} [duration] MetricThreshold duration + * @property {google.monitoring.v3.AlertPolicy.Condition.ITrigger|null} [trigger] MetricThreshold trigger + */ + + /** + * Constructs a new MetricThreshold. + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @classdesc Represents a MetricThreshold. + * @implements IMetricThreshold + * @constructor + * @param {google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold=} [properties] Properties to set + */ + function MetricThreshold(properties) { + this.aggregations = []; + this.denominatorAggregations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MetricThreshold filter. + * @member {string} filter + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + */ + MetricThreshold.prototype.filter = ""; + + /** + * MetricThreshold aggregations. + * @member {Array.} aggregations + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + */ + MetricThreshold.prototype.aggregations = $util.emptyArray; + + /** + * MetricThreshold denominatorFilter. + * @member {string} denominatorFilter + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + */ + MetricThreshold.prototype.denominatorFilter = ""; + + /** + * MetricThreshold denominatorAggregations. + * @member {Array.} denominatorAggregations + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + */ + MetricThreshold.prototype.denominatorAggregations = $util.emptyArray; + + /** + * MetricThreshold comparison. + * @member {google.monitoring.v3.ComparisonType} comparison + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + */ + MetricThreshold.prototype.comparison = 0; + + /** + * MetricThreshold thresholdValue. + * @member {number} thresholdValue + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + */ + MetricThreshold.prototype.thresholdValue = 0; + + /** + * MetricThreshold duration. + * @member {google.protobuf.IDuration|null|undefined} duration + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + */ + MetricThreshold.prototype.duration = null; + + /** + * MetricThreshold trigger. + * @member {google.monitoring.v3.AlertPolicy.Condition.ITrigger|null|undefined} trigger + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + */ + MetricThreshold.prototype.trigger = null; + + /** + * Creates a new MetricThreshold instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold=} [properties] Properties to set + * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricThreshold} MetricThreshold instance + */ + MetricThreshold.create = function create(properties) { + return new MetricThreshold(properties); + }; + + /** + * Encodes the specified MetricThreshold message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold} message MetricThreshold message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricThreshold.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.comparison != null && Object.hasOwnProperty.call(message, "comparison")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.comparison); + if (message.thresholdValue != null && Object.hasOwnProperty.call(message, "thresholdValue")) + writer.uint32(/* id 5, wireType 1 =*/41).double(message.thresholdValue); + if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) + $root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.encode(message.trigger, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.aggregations != null && message.aggregations.length) + for (var i = 0; i < message.aggregations.length; ++i) + $root.google.monitoring.v3.Aggregation.encode(message.aggregations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.denominatorFilter != null && Object.hasOwnProperty.call(message, "denominatorFilter")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.denominatorFilter); + if (message.denominatorAggregations != null && message.denominatorAggregations.length) + for (var i = 0; i < message.denominatorAggregations.length; ++i) + $root.google.monitoring.v3.Aggregation.encode(message.denominatorAggregations[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MetricThreshold message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMetricThreshold} message MetricThreshold message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricThreshold.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MetricThreshold message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricThreshold} MetricThreshold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricThreshold.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.filter = reader.string(); + break; + } + case 8: { + if (!(message.aggregations && message.aggregations.length)) + message.aggregations = []; + message.aggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32())); + break; + } + case 9: { + message.denominatorFilter = reader.string(); + break; + } + case 10: { + if (!(message.denominatorAggregations && message.denominatorAggregations.length)) + message.denominatorAggregations = []; + message.denominatorAggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32())); + break; + } + case 4: { + message.comparison = reader.int32(); + break; + } + case 5: { + message.thresholdValue = reader.double(); + break; + } + case 6: { + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 7: { + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MetricThreshold message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricThreshold} MetricThreshold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricThreshold.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MetricThreshold message. + * @function verify + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MetricThreshold.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.aggregations != null && message.hasOwnProperty("aggregations")) { + if (!Array.isArray(message.aggregations)) + return "aggregations: array expected"; + for (var i = 0; i < message.aggregations.length; ++i) { + var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregations[i]); + if (error) + return "aggregations." + error; + } + } + if (message.denominatorFilter != null && message.hasOwnProperty("denominatorFilter")) + if (!$util.isString(message.denominatorFilter)) + return "denominatorFilter: string expected"; + if (message.denominatorAggregations != null && message.hasOwnProperty("denominatorAggregations")) { + if (!Array.isArray(message.denominatorAggregations)) + return "denominatorAggregations: array expected"; + for (var i = 0; i < message.denominatorAggregations.length; ++i) { + var error = $root.google.monitoring.v3.Aggregation.verify(message.denominatorAggregations[i]); + if (error) + return "denominatorAggregations." + error; + } + } + if (message.comparison != null && message.hasOwnProperty("comparison")) + switch (message.comparison) { + default: + return "comparison: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.thresholdValue != null && message.hasOwnProperty("thresholdValue")) + if (typeof message.thresholdValue !== "number") + return "thresholdValue: number expected"; + if (message.duration != null && message.hasOwnProperty("duration")) { + var error = $root.google.protobuf.Duration.verify(message.duration); + if (error) + return "duration." + error; + } + if (message.trigger != null && message.hasOwnProperty("trigger")) { + var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger); + if (error) + return "trigger." + error; + } + return null; + }; + + /** + * Creates a MetricThreshold message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricThreshold} MetricThreshold + */ + MetricThreshold.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold) + return object; + var message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricThreshold(); + if (object.filter != null) + message.filter = String(object.filter); + if (object.aggregations) { + if (!Array.isArray(object.aggregations)) + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.aggregations: array expected"); + message.aggregations = []; + for (var i = 0; i < object.aggregations.length; ++i) { + if (typeof object.aggregations[i] !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.aggregations: object expected"); + message.aggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregations[i]); + } + } + if (object.denominatorFilter != null) + message.denominatorFilter = String(object.denominatorFilter); + if (object.denominatorAggregations) { + if (!Array.isArray(object.denominatorAggregations)) + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.denominatorAggregations: array expected"); + message.denominatorAggregations = []; + for (var i = 0; i < object.denominatorAggregations.length; ++i) { + if (typeof object.denominatorAggregations[i] !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.denominatorAggregations: object expected"); + message.denominatorAggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.denominatorAggregations[i]); + } + } + switch (object.comparison) { + default: + if (typeof object.comparison === "number") { + message.comparison = object.comparison; + break; + } + break; + case "COMPARISON_UNSPECIFIED": + case 0: + message.comparison = 0; + break; + case "COMPARISON_GT": + case 1: + message.comparison = 1; + break; + case "COMPARISON_GE": + case 2: + message.comparison = 2; + break; + case "COMPARISON_LT": + case 3: + message.comparison = 3; + break; + case "COMPARISON_LE": + case 4: + message.comparison = 4; + break; + case "COMPARISON_EQ": + case 5: + message.comparison = 5; + break; + case "COMPARISON_NE": + case 6: + message.comparison = 6; + break; + } + if (object.thresholdValue != null) + message.thresholdValue = Number(object.thresholdValue); + if (object.duration != null) { + if (typeof object.duration !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.duration: object expected"); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + } + if (object.trigger != null) { + if (typeof object.trigger !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricThreshold.trigger: object expected"); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger); + } + return message; + }; + + /** + * Creates a plain object from a MetricThreshold message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.MetricThreshold} message MetricThreshold + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MetricThreshold.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.aggregations = []; + object.denominatorAggregations = []; + } + if (options.defaults) { + object.filter = ""; + object.comparison = options.enums === String ? "COMPARISON_UNSPECIFIED" : 0; + object.thresholdValue = 0; + object.duration = null; + object.trigger = null; + object.denominatorFilter = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.comparison != null && message.hasOwnProperty("comparison")) + object.comparison = options.enums === String ? $root.google.monitoring.v3.ComparisonType[message.comparison] === undefined ? message.comparison : $root.google.monitoring.v3.ComparisonType[message.comparison] : message.comparison; + if (message.thresholdValue != null && message.hasOwnProperty("thresholdValue")) + object.thresholdValue = options.json && !isFinite(message.thresholdValue) ? String(message.thresholdValue) : message.thresholdValue; + if (message.duration != null && message.hasOwnProperty("duration")) + object.duration = $root.google.protobuf.Duration.toObject(message.duration, options); + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.toObject(message.trigger, options); + if (message.aggregations && message.aggregations.length) { + object.aggregations = []; + for (var j = 0; j < message.aggregations.length; ++j) + object.aggregations[j] = $root.google.monitoring.v3.Aggregation.toObject(message.aggregations[j], options); + } + if (message.denominatorFilter != null && message.hasOwnProperty("denominatorFilter")) + object.denominatorFilter = message.denominatorFilter; + if (message.denominatorAggregations && message.denominatorAggregations.length) { + object.denominatorAggregations = []; + for (var j = 0; j < message.denominatorAggregations.length; ++j) + object.denominatorAggregations[j] = $root.google.monitoring.v3.Aggregation.toObject(message.denominatorAggregations[j], options); + } + return object; + }; + + /** + * Converts this MetricThreshold to JSON. + * @function toJSON + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @instance + * @returns {Object.} JSON object + */ + MetricThreshold.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MetricThreshold + * @function getTypeUrl + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricThreshold + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MetricThreshold.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.AlertPolicy.Condition.MetricThreshold"; + }; + + return MetricThreshold; + })(); + + Condition.MetricAbsence = (function() { + + /** + * Properties of a MetricAbsence. + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @interface IMetricAbsence + * @property {string|null} [filter] MetricAbsence filter + * @property {Array.|null} [aggregations] MetricAbsence aggregations + * @property {google.protobuf.IDuration|null} [duration] MetricAbsence duration + * @property {google.monitoring.v3.AlertPolicy.Condition.ITrigger|null} [trigger] MetricAbsence trigger + */ + + /** + * Constructs a new MetricAbsence. + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @classdesc Represents a MetricAbsence. + * @implements IMetricAbsence + * @constructor + * @param {google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence=} [properties] Properties to set + */ + function MetricAbsence(properties) { + this.aggregations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MetricAbsence filter. + * @member {string} filter + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @instance + */ + MetricAbsence.prototype.filter = ""; + + /** + * MetricAbsence aggregations. + * @member {Array.} aggregations + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @instance + */ + MetricAbsence.prototype.aggregations = $util.emptyArray; + + /** + * MetricAbsence duration. + * @member {google.protobuf.IDuration|null|undefined} duration + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @instance + */ + MetricAbsence.prototype.duration = null; + + /** + * MetricAbsence trigger. + * @member {google.monitoring.v3.AlertPolicy.Condition.ITrigger|null|undefined} trigger + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @instance + */ + MetricAbsence.prototype.trigger = null; + + /** + * Creates a new MetricAbsence instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence=} [properties] Properties to set + * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricAbsence} MetricAbsence instance + */ + MetricAbsence.create = function create(properties) { + return new MetricAbsence(properties); + }; + + /** + * Encodes the specified MetricAbsence message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence} message MetricAbsence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricAbsence.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) + $root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.encode(message.trigger, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.aggregations != null && message.aggregations.length) + for (var i = 0; i < message.aggregations.length; ++i) + $root.google.monitoring.v3.Aggregation.encode(message.aggregations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MetricAbsence message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMetricAbsence} message MetricAbsence message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricAbsence.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MetricAbsence message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricAbsence} MetricAbsence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricAbsence.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.filter = reader.string(); + break; + } + case 5: { + if (!(message.aggregations && message.aggregations.length)) + message.aggregations = []; + message.aggregations.push($root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 3: { + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MetricAbsence message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricAbsence} MetricAbsence + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricAbsence.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MetricAbsence message. + * @function verify + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MetricAbsence.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.aggregations != null && message.hasOwnProperty("aggregations")) { + if (!Array.isArray(message.aggregations)) + return "aggregations: array expected"; + for (var i = 0; i < message.aggregations.length; ++i) { + var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregations[i]); + if (error) + return "aggregations." + error; + } + } + if (message.duration != null && message.hasOwnProperty("duration")) { + var error = $root.google.protobuf.Duration.verify(message.duration); + if (error) + return "duration." + error; + } + if (message.trigger != null && message.hasOwnProperty("trigger")) { + var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger); + if (error) + return "trigger." + error; + } + return null; + }; + + /** + * Creates a MetricAbsence message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.AlertPolicy.Condition.MetricAbsence} MetricAbsence + */ + MetricAbsence.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence) + return object; + var message = new $root.google.monitoring.v3.AlertPolicy.Condition.MetricAbsence(); + if (object.filter != null) + message.filter = String(object.filter); + if (object.aggregations) { + if (!Array.isArray(object.aggregations)) + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.aggregations: array expected"); + message.aggregations = []; + for (var i = 0; i < object.aggregations.length; ++i) { + if (typeof object.aggregations[i] !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.aggregations: object expected"); + message.aggregations[i] = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregations[i]); + } + } + if (object.duration != null) { + if (typeof object.duration !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.duration: object expected"); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + } + if (object.trigger != null) { + if (typeof object.trigger !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MetricAbsence.trigger: object expected"); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger); + } + return message; + }; + + /** + * Creates a plain object from a MetricAbsence message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.MetricAbsence} message MetricAbsence + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MetricAbsence.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.aggregations = []; + if (options.defaults) { + object.filter = ""; + object.duration = null; + object.trigger = null; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.duration != null && message.hasOwnProperty("duration")) + object.duration = $root.google.protobuf.Duration.toObject(message.duration, options); + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.toObject(message.trigger, options); + if (message.aggregations && message.aggregations.length) { + object.aggregations = []; + for (var j = 0; j < message.aggregations.length; ++j) + object.aggregations[j] = $root.google.monitoring.v3.Aggregation.toObject(message.aggregations[j], options); + } + return object; + }; + + /** + * Converts this MetricAbsence to JSON. + * @function toJSON + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @instance + * @returns {Object.} JSON object + */ + MetricAbsence.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MetricAbsence + * @function getTypeUrl + * @memberof google.monitoring.v3.AlertPolicy.Condition.MetricAbsence + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MetricAbsence.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.AlertPolicy.Condition.MetricAbsence"; + }; + + return MetricAbsence; + })(); + + Condition.MonitoringQueryLanguageCondition = (function() { + + /** + * Properties of a MonitoringQueryLanguageCondition. + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @interface IMonitoringQueryLanguageCondition + * @property {string|null} [query] MonitoringQueryLanguageCondition query + * @property {google.protobuf.IDuration|null} [duration] MonitoringQueryLanguageCondition duration + * @property {google.monitoring.v3.AlertPolicy.Condition.ITrigger|null} [trigger] MonitoringQueryLanguageCondition trigger + */ + + /** + * Constructs a new MonitoringQueryLanguageCondition. + * @memberof google.monitoring.v3.AlertPolicy.Condition + * @classdesc Represents a MonitoringQueryLanguageCondition. + * @implements IMonitoringQueryLanguageCondition + * @constructor + * @param {google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition=} [properties] Properties to set + */ + function MonitoringQueryLanguageCondition(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]]; + } + + /** + * MonitoringQueryLanguageCondition query. + * @member {string} query + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @instance + */ + MonitoringQueryLanguageCondition.prototype.query = ""; + + /** + * MonitoringQueryLanguageCondition duration. + * @member {google.protobuf.IDuration|null|undefined} duration + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @instance + */ + MonitoringQueryLanguageCondition.prototype.duration = null; + + /** + * MonitoringQueryLanguageCondition trigger. + * @member {google.monitoring.v3.AlertPolicy.Condition.ITrigger|null|undefined} trigger + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @instance + */ + MonitoringQueryLanguageCondition.prototype.trigger = null; + + /** + * Creates a new MonitoringQueryLanguageCondition instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition=} [properties] Properties to set + * @returns {google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition} MonitoringQueryLanguageCondition instance + */ + MonitoringQueryLanguageCondition.create = function create(properties) { + return new MonitoringQueryLanguageCondition(properties); + }; + + /** + * Encodes the specified MonitoringQueryLanguageCondition message. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition} message MonitoringQueryLanguageCondition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoringQueryLanguageCondition.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.query); + if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) + $root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.trigger != null && Object.hasOwnProperty.call(message, "trigger")) + $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.encode(message.trigger, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MonitoringQueryLanguageCondition message, length delimited. Does not implicitly {@link google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.IMonitoringQueryLanguageCondition} message MonitoringQueryLanguageCondition message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoringQueryLanguageCondition.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MonitoringQueryLanguageCondition message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition} MonitoringQueryLanguageCondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoringQueryLanguageCondition.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.query = reader.string(); + break; + } + case 2: { + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 3: { + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MonitoringQueryLanguageCondition message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition} MonitoringQueryLanguageCondition + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoringQueryLanguageCondition.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MonitoringQueryLanguageCondition message. + * @function verify + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MonitoringQueryLanguageCondition.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: string expected"; + if (message.duration != null && message.hasOwnProperty("duration")) { + var error = $root.google.protobuf.Duration.verify(message.duration); + if (error) + return "duration." + error; + } + if (message.trigger != null && message.hasOwnProperty("trigger")) { + var error = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.verify(message.trigger); + if (error) + return "trigger." + error; + } + return null; + }; + + /** + * Creates a MonitoringQueryLanguageCondition message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition} MonitoringQueryLanguageCondition + */ + MonitoringQueryLanguageCondition.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition) + return object; + var message = new $root.google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition(); + if (object.query != null) + message.query = String(object.query); + if (object.duration != null) { + if (typeof object.duration !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.duration: object expected"); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + } + if (object.trigger != null) { + if (typeof object.trigger !== "object") + throw TypeError(".google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition.trigger: object expected"); + message.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.fromObject(object.trigger); + } + return message; + }; + + /** + * Creates a plain object from a MonitoringQueryLanguageCondition message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition} message MonitoringQueryLanguageCondition + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MonitoringQueryLanguageCondition.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.query = ""; + object.duration = null; + object.trigger = null; + } + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + if (message.duration != null && message.hasOwnProperty("duration")) + object.duration = $root.google.protobuf.Duration.toObject(message.duration, options); + if (message.trigger != null && message.hasOwnProperty("trigger")) + object.trigger = $root.google.monitoring.v3.AlertPolicy.Condition.Trigger.toObject(message.trigger, options); + return object; + }; + + /** + * Converts this MonitoringQueryLanguageCondition to JSON. + * @function toJSON + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @instance + * @returns {Object.} JSON object + */ + MonitoringQueryLanguageCondition.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MonitoringQueryLanguageCondition + * @function getTypeUrl + * @memberof google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MonitoringQueryLanguageCondition.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.AlertPolicy.Condition.MonitoringQueryLanguageCondition"; + }; + + return MonitoringQueryLanguageCondition; + })(); + + return Condition; + })(); + + /** + * ConditionCombinerType enum. + * @name google.monitoring.v3.AlertPolicy.ConditionCombinerType + * @enum {number} + * @property {number} COMBINE_UNSPECIFIED=0 COMBINE_UNSPECIFIED value + * @property {number} AND=1 AND value + * @property {number} OR=2 OR value + * @property {number} AND_WITH_MATCHING_RESOURCE=3 AND_WITH_MATCHING_RESOURCE value + */ + AlertPolicy.ConditionCombinerType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "COMBINE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AND"] = 1; + values[valuesById[2] = "OR"] = 2; + values[valuesById[3] = "AND_WITH_MATCHING_RESOURCE"] = 3; + return values; + })(); + + return AlertPolicy; + })(); + + v3.TypedValue = (function() { + + /** + * Properties of a TypedValue. + * @memberof google.monitoring.v3 + * @interface ITypedValue + * @property {boolean|null} [boolValue] TypedValue boolValue + * @property {number|Long|null} [int64Value] TypedValue int64Value + * @property {number|null} [doubleValue] TypedValue doubleValue + * @property {string|null} [stringValue] TypedValue stringValue + * @property {google.api.IDistribution|null} [distributionValue] TypedValue distributionValue + */ + + /** + * Constructs a new TypedValue. + * @memberof google.monitoring.v3 + * @classdesc Represents a TypedValue. + * @implements ITypedValue + * @constructor + * @param {google.monitoring.v3.ITypedValue=} [properties] Properties to set + */ + function TypedValue(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]]; + } + + /** + * TypedValue boolValue. + * @member {boolean|null|undefined} boolValue + * @memberof google.monitoring.v3.TypedValue + * @instance + */ + TypedValue.prototype.boolValue = null; + + /** + * TypedValue int64Value. + * @member {number|Long|null|undefined} int64Value + * @memberof google.monitoring.v3.TypedValue + * @instance + */ + TypedValue.prototype.int64Value = null; + + /** + * TypedValue doubleValue. + * @member {number|null|undefined} doubleValue + * @memberof google.monitoring.v3.TypedValue + * @instance + */ + TypedValue.prototype.doubleValue = null; + + /** + * TypedValue stringValue. + * @member {string|null|undefined} stringValue + * @memberof google.monitoring.v3.TypedValue + * @instance + */ + TypedValue.prototype.stringValue = null; + + /** + * TypedValue distributionValue. + * @member {google.api.IDistribution|null|undefined} distributionValue + * @memberof google.monitoring.v3.TypedValue + * @instance + */ + TypedValue.prototype.distributionValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TypedValue value. + * @member {"boolValue"|"int64Value"|"doubleValue"|"stringValue"|"distributionValue"|undefined} value + * @memberof google.monitoring.v3.TypedValue + * @instance + */ + Object.defineProperty(TypedValue.prototype, "value", { + get: $util.oneOfGetter($oneOfFields = ["boolValue", "int64Value", "doubleValue", "stringValue", "distributionValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TypedValue instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {google.monitoring.v3.ITypedValue=} [properties] Properties to set + * @returns {google.monitoring.v3.TypedValue} TypedValue instance + */ + TypedValue.create = function create(properties) { + return new TypedValue(properties); + }; + + /** + * Encodes the specified TypedValue message. Does not implicitly {@link google.monitoring.v3.TypedValue.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {google.monitoring.v3.ITypedValue} message TypedValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TypedValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.boolValue); + if (message.int64Value != null && Object.hasOwnProperty.call(message, "int64Value")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.int64Value); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.stringValue); + if (message.distributionValue != null && Object.hasOwnProperty.call(message, "distributionValue")) + $root.google.api.Distribution.encode(message.distributionValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TypedValue message, length delimited. Does not implicitly {@link google.monitoring.v3.TypedValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {google.monitoring.v3.ITypedValue} message TypedValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TypedValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TypedValue message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TypedValue} TypedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypedValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TypedValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.boolValue = reader.bool(); + break; + } + case 2: { + message.int64Value = reader.int64(); + break; + } + case 3: { + message.doubleValue = reader.double(); + break; + } + case 4: { + message.stringValue = reader.string(); + break; + } + case 5: { + message.distributionValue = $root.google.api.Distribution.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TypedValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TypedValue} TypedValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypedValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TypedValue message. + * @function verify + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TypedValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + properties.value = 1; + if (typeof message.boolValue !== "boolean") + return "boolValue: boolean expected"; + } + if (message.int64Value != null && message.hasOwnProperty("int64Value")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + if (!$util.isInteger(message.int64Value) && !(message.int64Value && $util.isInteger(message.int64Value.low) && $util.isInteger(message.int64Value.high))) + return "int64Value: integer|Long expected"; + } + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + if (message.distributionValue != null && message.hasOwnProperty("distributionValue")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + { + var error = $root.google.api.Distribution.verify(message.distributionValue); + if (error) + return "distributionValue." + error; + } + } + return null; + }; + + /** + * Creates a TypedValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TypedValue} TypedValue + */ + TypedValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TypedValue) + return object; + var message = new $root.google.monitoring.v3.TypedValue(); + if (object.boolValue != null) + message.boolValue = Boolean(object.boolValue); + if (object.int64Value != null) + if ($util.Long) + (message.int64Value = $util.Long.fromValue(object.int64Value)).unsigned = false; + else if (typeof object.int64Value === "string") + message.int64Value = parseInt(object.int64Value, 10); + else if (typeof object.int64Value === "number") + message.int64Value = object.int64Value; + else if (typeof object.int64Value === "object") + message.int64Value = new $util.LongBits(object.int64Value.low >>> 0, object.int64Value.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + if (object.distributionValue != null) { + if (typeof object.distributionValue !== "object") + throw TypeError(".google.monitoring.v3.TypedValue.distributionValue: object expected"); + message.distributionValue = $root.google.api.Distribution.fromObject(object.distributionValue); + } + return message; + }; + + /** + * Creates a plain object from a TypedValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {google.monitoring.v3.TypedValue} message TypedValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TypedValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + object.boolValue = message.boolValue; + if (options.oneofs) + object.value = "boolValue"; + } + if (message.int64Value != null && message.hasOwnProperty("int64Value")) { + if (typeof message.int64Value === "number") + object.int64Value = options.longs === String ? String(message.int64Value) : message.int64Value; + else + object.int64Value = options.longs === String ? $util.Long.prototype.toString.call(message.int64Value) : options.longs === Number ? new $util.LongBits(message.int64Value.low >>> 0, message.int64Value.high >>> 0).toNumber() : message.int64Value; + if (options.oneofs) + object.value = "int64Value"; + } + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) { + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (options.oneofs) + object.value = "doubleValue"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.value = "stringValue"; + } + if (message.distributionValue != null && message.hasOwnProperty("distributionValue")) { + object.distributionValue = $root.google.api.Distribution.toObject(message.distributionValue, options); + if (options.oneofs) + object.value = "distributionValue"; + } + return object; + }; + + /** + * Converts this TypedValue to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TypedValue + * @instance + * @returns {Object.} JSON object + */ + TypedValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TypedValue + * @function getTypeUrl + * @memberof google.monitoring.v3.TypedValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TypedValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TypedValue"; + }; + + return TypedValue; + })(); + + v3.TimeInterval = (function() { + + /** + * Properties of a TimeInterval. + * @memberof google.monitoring.v3 + * @interface ITimeInterval + * @property {google.protobuf.ITimestamp|null} [endTime] TimeInterval endTime + * @property {google.protobuf.ITimestamp|null} [startTime] TimeInterval startTime + */ + + /** + * Constructs a new TimeInterval. + * @memberof google.monitoring.v3 + * @classdesc Represents a TimeInterval. + * @implements ITimeInterval + * @constructor + * @param {google.monitoring.v3.ITimeInterval=} [properties] Properties to set + */ + function TimeInterval(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]]; + } + + /** + * TimeInterval endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.monitoring.v3.TimeInterval + * @instance + */ + TimeInterval.prototype.endTime = null; + + /** + * TimeInterval startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.monitoring.v3.TimeInterval + * @instance + */ + TimeInterval.prototype.startTime = null; + + /** + * Creates a new TimeInterval instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {google.monitoring.v3.ITimeInterval=} [properties] Properties to set + * @returns {google.monitoring.v3.TimeInterval} TimeInterval instance + */ + TimeInterval.create = function create(properties) { + return new TimeInterval(properties); + }; + + /** + * Encodes the specified TimeInterval message. Does not implicitly {@link google.monitoring.v3.TimeInterval.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {google.monitoring.v3.ITimeInterval} message TimeInterval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeInterval.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TimeInterval message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeInterval.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {google.monitoring.v3.ITimeInterval} message TimeInterval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeInterval.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeInterval message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TimeInterval} TimeInterval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeInterval.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeInterval(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeInterval message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TimeInterval} TimeInterval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeInterval.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeInterval message. + * @function verify + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeInterval.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + return null; + }; + + /** + * Creates a TimeInterval message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TimeInterval} TimeInterval + */ + TimeInterval.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TimeInterval) + return object; + var message = new $root.google.monitoring.v3.TimeInterval(); + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.monitoring.v3.TimeInterval.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.monitoring.v3.TimeInterval.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + return message; + }; + + /** + * Creates a plain object from a TimeInterval message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {google.monitoring.v3.TimeInterval} message TimeInterval + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeInterval.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + 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); + return object; + }; + + /** + * Converts this TimeInterval to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TimeInterval + * @instance + * @returns {Object.} JSON object + */ + TimeInterval.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TimeInterval + * @function getTypeUrl + * @memberof google.monitoring.v3.TimeInterval + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeInterval.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TimeInterval"; + }; + + return TimeInterval; + })(); + + v3.Aggregation = (function() { + + /** + * Properties of an Aggregation. + * @memberof google.monitoring.v3 + * @interface IAggregation + * @property {google.protobuf.IDuration|null} [alignmentPeriod] Aggregation alignmentPeriod + * @property {google.monitoring.v3.Aggregation.Aligner|null} [perSeriesAligner] Aggregation perSeriesAligner + * @property {google.monitoring.v3.Aggregation.Reducer|null} [crossSeriesReducer] Aggregation crossSeriesReducer + * @property {Array.|null} [groupByFields] Aggregation groupByFields + */ + + /** + * Constructs a new Aggregation. + * @memberof google.monitoring.v3 + * @classdesc Represents an Aggregation. + * @implements IAggregation + * @constructor + * @param {google.monitoring.v3.IAggregation=} [properties] Properties to set + */ + function Aggregation(properties) { + this.groupByFields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Aggregation alignmentPeriod. + * @member {google.protobuf.IDuration|null|undefined} alignmentPeriod + * @memberof google.monitoring.v3.Aggregation + * @instance + */ + Aggregation.prototype.alignmentPeriod = null; + + /** + * Aggregation perSeriesAligner. + * @member {google.monitoring.v3.Aggregation.Aligner} perSeriesAligner + * @memberof google.monitoring.v3.Aggregation + * @instance + */ + Aggregation.prototype.perSeriesAligner = 0; + + /** + * Aggregation crossSeriesReducer. + * @member {google.monitoring.v3.Aggregation.Reducer} crossSeriesReducer + * @memberof google.monitoring.v3.Aggregation + * @instance + */ + Aggregation.prototype.crossSeriesReducer = 0; + + /** + * Aggregation groupByFields. + * @member {Array.} groupByFields + * @memberof google.monitoring.v3.Aggregation + * @instance + */ + Aggregation.prototype.groupByFields = $util.emptyArray; + + /** + * Creates a new Aggregation instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {google.monitoring.v3.IAggregation=} [properties] Properties to set + * @returns {google.monitoring.v3.Aggregation} Aggregation instance + */ + Aggregation.create = function create(properties) { + return new Aggregation(properties); + }; + + /** + * Encodes the specified Aggregation message. Does not implicitly {@link google.monitoring.v3.Aggregation.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {google.monitoring.v3.IAggregation} message Aggregation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Aggregation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.alignmentPeriod != null && Object.hasOwnProperty.call(message, "alignmentPeriod")) + $root.google.protobuf.Duration.encode(message.alignmentPeriod, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.perSeriesAligner != null && Object.hasOwnProperty.call(message, "perSeriesAligner")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.perSeriesAligner); + if (message.crossSeriesReducer != null && Object.hasOwnProperty.call(message, "crossSeriesReducer")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.crossSeriesReducer); + if (message.groupByFields != null && message.groupByFields.length) + for (var i = 0; i < message.groupByFields.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.groupByFields[i]); + return writer; + }; + + /** + * Encodes the specified Aggregation message, length delimited. Does not implicitly {@link google.monitoring.v3.Aggregation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {google.monitoring.v3.IAggregation} message Aggregation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Aggregation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Aggregation message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Aggregation} Aggregation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Aggregation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Aggregation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.alignmentPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 2: { + message.perSeriesAligner = reader.int32(); + break; + } + case 4: { + message.crossSeriesReducer = reader.int32(); + break; + } + case 5: { + if (!(message.groupByFields && message.groupByFields.length)) + message.groupByFields = []; + message.groupByFields.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Aggregation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Aggregation} Aggregation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Aggregation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Aggregation message. + * @function verify + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Aggregation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.alignmentPeriod != null && message.hasOwnProperty("alignmentPeriod")) { + var error = $root.google.protobuf.Duration.verify(message.alignmentPeriod); + if (error) + return "alignmentPeriod." + error; + } + if (message.perSeriesAligner != null && message.hasOwnProperty("perSeriesAligner")) + switch (message.perSeriesAligner) { + default: + return "perSeriesAligner: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 24: + case 17: + case 18: + case 19: + case 20: + case 21: + case 23: + break; + } + if (message.crossSeriesReducer != null && message.hasOwnProperty("crossSeriesReducer")) + switch (message.crossSeriesReducer) { + default: + return "crossSeriesReducer: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 15: + case 8: + case 9: + case 10: + case 11: + case 12: + break; + } + if (message.groupByFields != null && message.hasOwnProperty("groupByFields")) { + if (!Array.isArray(message.groupByFields)) + return "groupByFields: array expected"; + for (var i = 0; i < message.groupByFields.length; ++i) + if (!$util.isString(message.groupByFields[i])) + return "groupByFields: string[] expected"; + } + return null; + }; + + /** + * Creates an Aggregation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Aggregation} Aggregation + */ + Aggregation.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Aggregation) + return object; + var message = new $root.google.monitoring.v3.Aggregation(); + if (object.alignmentPeriod != null) { + if (typeof object.alignmentPeriod !== "object") + throw TypeError(".google.monitoring.v3.Aggregation.alignmentPeriod: object expected"); + message.alignmentPeriod = $root.google.protobuf.Duration.fromObject(object.alignmentPeriod); + } + switch (object.perSeriesAligner) { + default: + if (typeof object.perSeriesAligner === "number") { + message.perSeriesAligner = object.perSeriesAligner; + break; + } + break; + case "ALIGN_NONE": + case 0: + message.perSeriesAligner = 0; + break; + case "ALIGN_DELTA": + case 1: + message.perSeriesAligner = 1; + break; + case "ALIGN_RATE": + case 2: + message.perSeriesAligner = 2; + break; + case "ALIGN_INTERPOLATE": + case 3: + message.perSeriesAligner = 3; + break; + case "ALIGN_NEXT_OLDER": + case 4: + message.perSeriesAligner = 4; + break; + case "ALIGN_MIN": + case 10: + message.perSeriesAligner = 10; + break; + case "ALIGN_MAX": + case 11: + message.perSeriesAligner = 11; + break; + case "ALIGN_MEAN": + case 12: + message.perSeriesAligner = 12; + break; + case "ALIGN_COUNT": + case 13: + message.perSeriesAligner = 13; + break; + case "ALIGN_SUM": + case 14: + message.perSeriesAligner = 14; + break; + case "ALIGN_STDDEV": + case 15: + message.perSeriesAligner = 15; + break; + case "ALIGN_COUNT_TRUE": + case 16: + message.perSeriesAligner = 16; + break; + case "ALIGN_COUNT_FALSE": + case 24: + message.perSeriesAligner = 24; + break; + case "ALIGN_FRACTION_TRUE": + case 17: + message.perSeriesAligner = 17; + break; + case "ALIGN_PERCENTILE_99": + case 18: + message.perSeriesAligner = 18; + break; + case "ALIGN_PERCENTILE_95": + case 19: + message.perSeriesAligner = 19; + break; + case "ALIGN_PERCENTILE_50": + case 20: + message.perSeriesAligner = 20; + break; + case "ALIGN_PERCENTILE_05": + case 21: + message.perSeriesAligner = 21; + break; + case "ALIGN_PERCENT_CHANGE": + case 23: + message.perSeriesAligner = 23; + break; + } + switch (object.crossSeriesReducer) { + default: + if (typeof object.crossSeriesReducer === "number") { + message.crossSeriesReducer = object.crossSeriesReducer; + break; + } + break; + case "REDUCE_NONE": + case 0: + message.crossSeriesReducer = 0; + break; + case "REDUCE_MEAN": + case 1: + message.crossSeriesReducer = 1; + break; + case "REDUCE_MIN": + case 2: + message.crossSeriesReducer = 2; + break; + case "REDUCE_MAX": + case 3: + message.crossSeriesReducer = 3; + break; + case "REDUCE_SUM": + case 4: + message.crossSeriesReducer = 4; + break; + case "REDUCE_STDDEV": + case 5: + message.crossSeriesReducer = 5; + break; + case "REDUCE_COUNT": + case 6: + message.crossSeriesReducer = 6; + break; + case "REDUCE_COUNT_TRUE": + case 7: + message.crossSeriesReducer = 7; + break; + case "REDUCE_COUNT_FALSE": + case 15: + message.crossSeriesReducer = 15; + break; + case "REDUCE_FRACTION_TRUE": + case 8: + message.crossSeriesReducer = 8; + break; + case "REDUCE_PERCENTILE_99": + case 9: + message.crossSeriesReducer = 9; + break; + case "REDUCE_PERCENTILE_95": + case 10: + message.crossSeriesReducer = 10; + break; + case "REDUCE_PERCENTILE_50": + case 11: + message.crossSeriesReducer = 11; + break; + case "REDUCE_PERCENTILE_05": + case 12: + message.crossSeriesReducer = 12; + break; + } + if (object.groupByFields) { + if (!Array.isArray(object.groupByFields)) + throw TypeError(".google.monitoring.v3.Aggregation.groupByFields: array expected"); + message.groupByFields = []; + for (var i = 0; i < object.groupByFields.length; ++i) + message.groupByFields[i] = String(object.groupByFields[i]); + } + return message; + }; + + /** + * Creates a plain object from an Aggregation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {google.monitoring.v3.Aggregation} message Aggregation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Aggregation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.groupByFields = []; + if (options.defaults) { + object.alignmentPeriod = null; + object.perSeriesAligner = options.enums === String ? "ALIGN_NONE" : 0; + object.crossSeriesReducer = options.enums === String ? "REDUCE_NONE" : 0; + } + if (message.alignmentPeriod != null && message.hasOwnProperty("alignmentPeriod")) + object.alignmentPeriod = $root.google.protobuf.Duration.toObject(message.alignmentPeriod, options); + if (message.perSeriesAligner != null && message.hasOwnProperty("perSeriesAligner")) + object.perSeriesAligner = options.enums === String ? $root.google.monitoring.v3.Aggregation.Aligner[message.perSeriesAligner] === undefined ? message.perSeriesAligner : $root.google.monitoring.v3.Aggregation.Aligner[message.perSeriesAligner] : message.perSeriesAligner; + if (message.crossSeriesReducer != null && message.hasOwnProperty("crossSeriesReducer")) + object.crossSeriesReducer = options.enums === String ? $root.google.monitoring.v3.Aggregation.Reducer[message.crossSeriesReducer] === undefined ? message.crossSeriesReducer : $root.google.monitoring.v3.Aggregation.Reducer[message.crossSeriesReducer] : message.crossSeriesReducer; + if (message.groupByFields && message.groupByFields.length) { + object.groupByFields = []; + for (var j = 0; j < message.groupByFields.length; ++j) + object.groupByFields[j] = message.groupByFields[j]; + } + return object; + }; + + /** + * Converts this Aggregation to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Aggregation + * @instance + * @returns {Object.} JSON object + */ + Aggregation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Aggregation + * @function getTypeUrl + * @memberof google.monitoring.v3.Aggregation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Aggregation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Aggregation"; + }; + + /** + * Aligner enum. + * @name google.monitoring.v3.Aggregation.Aligner + * @enum {number} + * @property {number} ALIGN_NONE=0 ALIGN_NONE value + * @property {number} ALIGN_DELTA=1 ALIGN_DELTA value + * @property {number} ALIGN_RATE=2 ALIGN_RATE value + * @property {number} ALIGN_INTERPOLATE=3 ALIGN_INTERPOLATE value + * @property {number} ALIGN_NEXT_OLDER=4 ALIGN_NEXT_OLDER value + * @property {number} ALIGN_MIN=10 ALIGN_MIN value + * @property {number} ALIGN_MAX=11 ALIGN_MAX value + * @property {number} ALIGN_MEAN=12 ALIGN_MEAN value + * @property {number} ALIGN_COUNT=13 ALIGN_COUNT value + * @property {number} ALIGN_SUM=14 ALIGN_SUM value + * @property {number} ALIGN_STDDEV=15 ALIGN_STDDEV value + * @property {number} ALIGN_COUNT_TRUE=16 ALIGN_COUNT_TRUE value + * @property {number} ALIGN_COUNT_FALSE=24 ALIGN_COUNT_FALSE value + * @property {number} ALIGN_FRACTION_TRUE=17 ALIGN_FRACTION_TRUE value + * @property {number} ALIGN_PERCENTILE_99=18 ALIGN_PERCENTILE_99 value + * @property {number} ALIGN_PERCENTILE_95=19 ALIGN_PERCENTILE_95 value + * @property {number} ALIGN_PERCENTILE_50=20 ALIGN_PERCENTILE_50 value + * @property {number} ALIGN_PERCENTILE_05=21 ALIGN_PERCENTILE_05 value + * @property {number} ALIGN_PERCENT_CHANGE=23 ALIGN_PERCENT_CHANGE value + */ + Aggregation.Aligner = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ALIGN_NONE"] = 0; + values[valuesById[1] = "ALIGN_DELTA"] = 1; + values[valuesById[2] = "ALIGN_RATE"] = 2; + values[valuesById[3] = "ALIGN_INTERPOLATE"] = 3; + values[valuesById[4] = "ALIGN_NEXT_OLDER"] = 4; + values[valuesById[10] = "ALIGN_MIN"] = 10; + values[valuesById[11] = "ALIGN_MAX"] = 11; + values[valuesById[12] = "ALIGN_MEAN"] = 12; + values[valuesById[13] = "ALIGN_COUNT"] = 13; + values[valuesById[14] = "ALIGN_SUM"] = 14; + values[valuesById[15] = "ALIGN_STDDEV"] = 15; + values[valuesById[16] = "ALIGN_COUNT_TRUE"] = 16; + values[valuesById[24] = "ALIGN_COUNT_FALSE"] = 24; + values[valuesById[17] = "ALIGN_FRACTION_TRUE"] = 17; + values[valuesById[18] = "ALIGN_PERCENTILE_99"] = 18; + values[valuesById[19] = "ALIGN_PERCENTILE_95"] = 19; + values[valuesById[20] = "ALIGN_PERCENTILE_50"] = 20; + values[valuesById[21] = "ALIGN_PERCENTILE_05"] = 21; + values[valuesById[23] = "ALIGN_PERCENT_CHANGE"] = 23; + return values; + })(); + + /** + * Reducer enum. + * @name google.monitoring.v3.Aggregation.Reducer + * @enum {number} + * @property {number} REDUCE_NONE=0 REDUCE_NONE value + * @property {number} REDUCE_MEAN=1 REDUCE_MEAN value + * @property {number} REDUCE_MIN=2 REDUCE_MIN value + * @property {number} REDUCE_MAX=3 REDUCE_MAX value + * @property {number} REDUCE_SUM=4 REDUCE_SUM value + * @property {number} REDUCE_STDDEV=5 REDUCE_STDDEV value + * @property {number} REDUCE_COUNT=6 REDUCE_COUNT value + * @property {number} REDUCE_COUNT_TRUE=7 REDUCE_COUNT_TRUE value + * @property {number} REDUCE_COUNT_FALSE=15 REDUCE_COUNT_FALSE value + * @property {number} REDUCE_FRACTION_TRUE=8 REDUCE_FRACTION_TRUE value + * @property {number} REDUCE_PERCENTILE_99=9 REDUCE_PERCENTILE_99 value + * @property {number} REDUCE_PERCENTILE_95=10 REDUCE_PERCENTILE_95 value + * @property {number} REDUCE_PERCENTILE_50=11 REDUCE_PERCENTILE_50 value + * @property {number} REDUCE_PERCENTILE_05=12 REDUCE_PERCENTILE_05 value + */ + Aggregation.Reducer = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REDUCE_NONE"] = 0; + values[valuesById[1] = "REDUCE_MEAN"] = 1; + values[valuesById[2] = "REDUCE_MIN"] = 2; + values[valuesById[3] = "REDUCE_MAX"] = 3; + values[valuesById[4] = "REDUCE_SUM"] = 4; + values[valuesById[5] = "REDUCE_STDDEV"] = 5; + values[valuesById[6] = "REDUCE_COUNT"] = 6; + values[valuesById[7] = "REDUCE_COUNT_TRUE"] = 7; + values[valuesById[15] = "REDUCE_COUNT_FALSE"] = 15; + values[valuesById[8] = "REDUCE_FRACTION_TRUE"] = 8; + values[valuesById[9] = "REDUCE_PERCENTILE_99"] = 9; + values[valuesById[10] = "REDUCE_PERCENTILE_95"] = 10; + values[valuesById[11] = "REDUCE_PERCENTILE_50"] = 11; + values[valuesById[12] = "REDUCE_PERCENTILE_05"] = 12; + return values; + })(); + + return Aggregation; + })(); + + /** + * ComparisonType enum. + * @name google.monitoring.v3.ComparisonType + * @enum {number} + * @property {number} COMPARISON_UNSPECIFIED=0 COMPARISON_UNSPECIFIED value + * @property {number} COMPARISON_GT=1 COMPARISON_GT value + * @property {number} COMPARISON_GE=2 COMPARISON_GE value + * @property {number} COMPARISON_LT=3 COMPARISON_LT value + * @property {number} COMPARISON_LE=4 COMPARISON_LE value + * @property {number} COMPARISON_EQ=5 COMPARISON_EQ value + * @property {number} COMPARISON_NE=6 COMPARISON_NE value + */ + v3.ComparisonType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "COMPARISON_UNSPECIFIED"] = 0; + values[valuesById[1] = "COMPARISON_GT"] = 1; + values[valuesById[2] = "COMPARISON_GE"] = 2; + values[valuesById[3] = "COMPARISON_LT"] = 3; + values[valuesById[4] = "COMPARISON_LE"] = 4; + values[valuesById[5] = "COMPARISON_EQ"] = 5; + values[valuesById[6] = "COMPARISON_NE"] = 6; + return values; + })(); + + /** + * ServiceTier enum. + * @name google.monitoring.v3.ServiceTier + * @enum {number} + * @property {number} SERVICE_TIER_UNSPECIFIED=0 SERVICE_TIER_UNSPECIFIED value + * @property {number} SERVICE_TIER_BASIC=1 SERVICE_TIER_BASIC value + * @property {number} SERVICE_TIER_PREMIUM=2 SERVICE_TIER_PREMIUM value + */ + v3.ServiceTier = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SERVICE_TIER_UNSPECIFIED"] = 0; + values[valuesById[1] = "SERVICE_TIER_BASIC"] = 1; + values[valuesById[2] = "SERVICE_TIER_PREMIUM"] = 2; + return values; + })(); + + v3.MutationRecord = (function() { + + /** + * Properties of a MutationRecord. + * @memberof google.monitoring.v3 + * @interface IMutationRecord + * @property {google.protobuf.ITimestamp|null} [mutateTime] MutationRecord mutateTime + * @property {string|null} [mutatedBy] MutationRecord mutatedBy + */ + + /** + * Constructs a new MutationRecord. + * @memberof google.monitoring.v3 + * @classdesc Represents a MutationRecord. + * @implements IMutationRecord + * @constructor + * @param {google.monitoring.v3.IMutationRecord=} [properties] Properties to set + */ + function MutationRecord(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]]; + } + + /** + * MutationRecord mutateTime. + * @member {google.protobuf.ITimestamp|null|undefined} mutateTime + * @memberof google.monitoring.v3.MutationRecord + * @instance + */ + MutationRecord.prototype.mutateTime = null; + + /** + * MutationRecord mutatedBy. + * @member {string} mutatedBy + * @memberof google.monitoring.v3.MutationRecord + * @instance + */ + MutationRecord.prototype.mutatedBy = ""; + + /** + * Creates a new MutationRecord instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {google.monitoring.v3.IMutationRecord=} [properties] Properties to set + * @returns {google.monitoring.v3.MutationRecord} MutationRecord instance + */ + MutationRecord.create = function create(properties) { + return new MutationRecord(properties); + }; + + /** + * Encodes the specified MutationRecord message. Does not implicitly {@link google.monitoring.v3.MutationRecord.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {google.monitoring.v3.IMutationRecord} message MutationRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MutationRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mutateTime != null && Object.hasOwnProperty.call(message, "mutateTime")) + $root.google.protobuf.Timestamp.encode(message.mutateTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mutatedBy != null && Object.hasOwnProperty.call(message, "mutatedBy")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mutatedBy); + return writer; + }; + + /** + * Encodes the specified MutationRecord message, length delimited. Does not implicitly {@link google.monitoring.v3.MutationRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {google.monitoring.v3.IMutationRecord} message MutationRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MutationRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MutationRecord message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.MutationRecord} MutationRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MutationRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.MutationRecord(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mutateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.mutatedBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MutationRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.MutationRecord} MutationRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MutationRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MutationRecord message. + * @function verify + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MutationRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mutateTime != null && message.hasOwnProperty("mutateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.mutateTime); + if (error) + return "mutateTime." + error; + } + if (message.mutatedBy != null && message.hasOwnProperty("mutatedBy")) + if (!$util.isString(message.mutatedBy)) + return "mutatedBy: string expected"; + return null; + }; + + /** + * Creates a MutationRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.MutationRecord} MutationRecord + */ + MutationRecord.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.MutationRecord) + return object; + var message = new $root.google.monitoring.v3.MutationRecord(); + if (object.mutateTime != null) { + if (typeof object.mutateTime !== "object") + throw TypeError(".google.monitoring.v3.MutationRecord.mutateTime: object expected"); + message.mutateTime = $root.google.protobuf.Timestamp.fromObject(object.mutateTime); + } + if (object.mutatedBy != null) + message.mutatedBy = String(object.mutatedBy); + return message; + }; + + /** + * Creates a plain object from a MutationRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {google.monitoring.v3.MutationRecord} message MutationRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MutationRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.mutateTime = null; + object.mutatedBy = ""; + } + if (message.mutateTime != null && message.hasOwnProperty("mutateTime")) + object.mutateTime = $root.google.protobuf.Timestamp.toObject(message.mutateTime, options); + if (message.mutatedBy != null && message.hasOwnProperty("mutatedBy")) + object.mutatedBy = message.mutatedBy; + return object; + }; + + /** + * Converts this MutationRecord to JSON. + * @function toJSON + * @memberof google.monitoring.v3.MutationRecord + * @instance + * @returns {Object.} JSON object + */ + MutationRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MutationRecord + * @function getTypeUrl + * @memberof google.monitoring.v3.MutationRecord + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MutationRecord.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.MutationRecord"; + }; + + return MutationRecord; + })(); + + v3.AlertPolicyService = (function() { + + /** + * Constructs a new AlertPolicyService service. + * @memberof google.monitoring.v3 + * @classdesc Represents an AlertPolicyService + * @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 AlertPolicyService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (AlertPolicyService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = AlertPolicyService; + + /** + * Creates new AlertPolicyService service using the specified rpc implementation. + * @function create + * @memberof google.monitoring.v3.AlertPolicyService + * @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 {AlertPolicyService} RPC service. Useful where requests and/or responses are streamed. + */ + AlertPolicyService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|listAlertPolicies}. + * @memberof google.monitoring.v3.AlertPolicyService + * @typedef ListAlertPoliciesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListAlertPoliciesResponse} [response] ListAlertPoliciesResponse + */ + + /** + * Calls ListAlertPolicies. + * @function listAlertPolicies + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.IListAlertPoliciesRequest} request ListAlertPoliciesRequest message or plain object + * @param {google.monitoring.v3.AlertPolicyService.ListAlertPoliciesCallback} callback Node-style callback called with the error, if any, and ListAlertPoliciesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AlertPolicyService.prototype.listAlertPolicies = function listAlertPolicies(request, callback) { + return this.rpcCall(listAlertPolicies, $root.google.monitoring.v3.ListAlertPoliciesRequest, $root.google.monitoring.v3.ListAlertPoliciesResponse, request, callback); + }, "name", { value: "ListAlertPolicies" }); + + /** + * Calls ListAlertPolicies. + * @function listAlertPolicies + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.IListAlertPoliciesRequest} request ListAlertPoliciesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|getAlertPolicy}. + * @memberof google.monitoring.v3.AlertPolicyService + * @typedef GetAlertPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.AlertPolicy} [response] AlertPolicy + */ + + /** + * Calls GetAlertPolicy. + * @function getAlertPolicy + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.IGetAlertPolicyRequest} request GetAlertPolicyRequest message or plain object + * @param {google.monitoring.v3.AlertPolicyService.GetAlertPolicyCallback} callback Node-style callback called with the error, if any, and AlertPolicy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AlertPolicyService.prototype.getAlertPolicy = function getAlertPolicy(request, callback) { + return this.rpcCall(getAlertPolicy, $root.google.monitoring.v3.GetAlertPolicyRequest, $root.google.monitoring.v3.AlertPolicy, request, callback); + }, "name", { value: "GetAlertPolicy" }); + + /** + * Calls GetAlertPolicy. + * @function getAlertPolicy + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.IGetAlertPolicyRequest} request GetAlertPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|createAlertPolicy}. + * @memberof google.monitoring.v3.AlertPolicyService + * @typedef CreateAlertPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.AlertPolicy} [response] AlertPolicy + */ + + /** + * Calls CreateAlertPolicy. + * @function createAlertPolicy + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.ICreateAlertPolicyRequest} request CreateAlertPolicyRequest message or plain object + * @param {google.monitoring.v3.AlertPolicyService.CreateAlertPolicyCallback} callback Node-style callback called with the error, if any, and AlertPolicy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AlertPolicyService.prototype.createAlertPolicy = function createAlertPolicy(request, callback) { + return this.rpcCall(createAlertPolicy, $root.google.monitoring.v3.CreateAlertPolicyRequest, $root.google.monitoring.v3.AlertPolicy, request, callback); + }, "name", { value: "CreateAlertPolicy" }); + + /** + * Calls CreateAlertPolicy. + * @function createAlertPolicy + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.ICreateAlertPolicyRequest} request CreateAlertPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|deleteAlertPolicy}. + * @memberof google.monitoring.v3.AlertPolicyService + * @typedef DeleteAlertPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteAlertPolicy. + * @function deleteAlertPolicy + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.IDeleteAlertPolicyRequest} request DeleteAlertPolicyRequest message or plain object + * @param {google.monitoring.v3.AlertPolicyService.DeleteAlertPolicyCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AlertPolicyService.prototype.deleteAlertPolicy = function deleteAlertPolicy(request, callback) { + return this.rpcCall(deleteAlertPolicy, $root.google.monitoring.v3.DeleteAlertPolicyRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteAlertPolicy" }); + + /** + * Calls DeleteAlertPolicy. + * @function deleteAlertPolicy + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.IDeleteAlertPolicyRequest} request DeleteAlertPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.AlertPolicyService|updateAlertPolicy}. + * @memberof google.monitoring.v3.AlertPolicyService + * @typedef UpdateAlertPolicyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.AlertPolicy} [response] AlertPolicy + */ + + /** + * Calls UpdateAlertPolicy. + * @function updateAlertPolicy + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.IUpdateAlertPolicyRequest} request UpdateAlertPolicyRequest message or plain object + * @param {google.monitoring.v3.AlertPolicyService.UpdateAlertPolicyCallback} callback Node-style callback called with the error, if any, and AlertPolicy + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AlertPolicyService.prototype.updateAlertPolicy = function updateAlertPolicy(request, callback) { + return this.rpcCall(updateAlertPolicy, $root.google.monitoring.v3.UpdateAlertPolicyRequest, $root.google.monitoring.v3.AlertPolicy, request, callback); + }, "name", { value: "UpdateAlertPolicy" }); + + /** + * Calls UpdateAlertPolicy. + * @function updateAlertPolicy + * @memberof google.monitoring.v3.AlertPolicyService + * @instance + * @param {google.monitoring.v3.IUpdateAlertPolicyRequest} request UpdateAlertPolicyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return AlertPolicyService; + })(); + + v3.CreateAlertPolicyRequest = (function() { + + /** + * Properties of a CreateAlertPolicyRequest. + * @memberof google.monitoring.v3 + * @interface ICreateAlertPolicyRequest + * @property {string|null} [name] CreateAlertPolicyRequest name + * @property {google.monitoring.v3.IAlertPolicy|null} [alertPolicy] CreateAlertPolicyRequest alertPolicy + */ + + /** + * Constructs a new CreateAlertPolicyRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateAlertPolicyRequest. + * @implements ICreateAlertPolicyRequest + * @constructor + * @param {google.monitoring.v3.ICreateAlertPolicyRequest=} [properties] Properties to set + */ + function CreateAlertPolicyRequest(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]]; + } + + /** + * CreateAlertPolicyRequest name. + * @member {string} name + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @instance + */ + CreateAlertPolicyRequest.prototype.name = ""; + + /** + * CreateAlertPolicyRequest alertPolicy. + * @member {google.monitoring.v3.IAlertPolicy|null|undefined} alertPolicy + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @instance + */ + CreateAlertPolicyRequest.prototype.alertPolicy = null; + + /** + * Creates a new CreateAlertPolicyRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {google.monitoring.v3.ICreateAlertPolicyRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateAlertPolicyRequest} CreateAlertPolicyRequest instance + */ + CreateAlertPolicyRequest.create = function create(properties) { + return new CreateAlertPolicyRequest(properties); + }; + + /** + * Encodes the specified CreateAlertPolicyRequest message. Does not implicitly {@link google.monitoring.v3.CreateAlertPolicyRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {google.monitoring.v3.ICreateAlertPolicyRequest} message CreateAlertPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAlertPolicyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.alertPolicy != null && Object.hasOwnProperty.call(message, "alertPolicy")) + $root.google.monitoring.v3.AlertPolicy.encode(message.alertPolicy, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified CreateAlertPolicyRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateAlertPolicyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {google.monitoring.v3.ICreateAlertPolicyRequest} message CreateAlertPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateAlertPolicyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateAlertPolicyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateAlertPolicyRequest} CreateAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAlertPolicyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateAlertPolicyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + case 2: { + message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateAlertPolicyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateAlertPolicyRequest} CreateAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateAlertPolicyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateAlertPolicyRequest message. + * @function verify + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateAlertPolicyRequest.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.alertPolicy != null && message.hasOwnProperty("alertPolicy")) { + var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicy); + if (error) + return "alertPolicy." + error; + } + return null; + }; + + /** + * Creates a CreateAlertPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateAlertPolicyRequest} CreateAlertPolicyRequest + */ + CreateAlertPolicyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateAlertPolicyRequest) + return object; + var message = new $root.google.monitoring.v3.CreateAlertPolicyRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.alertPolicy != null) { + if (typeof object.alertPolicy !== "object") + throw TypeError(".google.monitoring.v3.CreateAlertPolicyRequest.alertPolicy: object expected"); + message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicy); + } + return message; + }; + + /** + * Creates a plain object from a CreateAlertPolicyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {google.monitoring.v3.CreateAlertPolicyRequest} message CreateAlertPolicyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateAlertPolicyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.alertPolicy = null; + object.name = ""; + } + if (message.alertPolicy != null && message.hasOwnProperty("alertPolicy")) + object.alertPolicy = $root.google.monitoring.v3.AlertPolicy.toObject(message.alertPolicy, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CreateAlertPolicyRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @instance + * @returns {Object.} JSON object + */ + CreateAlertPolicyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateAlertPolicyRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateAlertPolicyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateAlertPolicyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateAlertPolicyRequest"; + }; + + return CreateAlertPolicyRequest; + })(); + + v3.GetAlertPolicyRequest = (function() { + + /** + * Properties of a GetAlertPolicyRequest. + * @memberof google.monitoring.v3 + * @interface IGetAlertPolicyRequest + * @property {string|null} [name] GetAlertPolicyRequest name + */ + + /** + * Constructs a new GetAlertPolicyRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetAlertPolicyRequest. + * @implements IGetAlertPolicyRequest + * @constructor + * @param {google.monitoring.v3.IGetAlertPolicyRequest=} [properties] Properties to set + */ + function GetAlertPolicyRequest(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]]; + } + + /** + * GetAlertPolicyRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @instance + */ + GetAlertPolicyRequest.prototype.name = ""; + + /** + * Creates a new GetAlertPolicyRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IGetAlertPolicyRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetAlertPolicyRequest} GetAlertPolicyRequest instance + */ + GetAlertPolicyRequest.create = function create(properties) { + return new GetAlertPolicyRequest(properties); + }; + + /** + * Encodes the specified GetAlertPolicyRequest message. Does not implicitly {@link google.monitoring.v3.GetAlertPolicyRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IGetAlertPolicyRequest} message GetAlertPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAlertPolicyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetAlertPolicyRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetAlertPolicyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IGetAlertPolicyRequest} message GetAlertPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAlertPolicyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetAlertPolicyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetAlertPolicyRequest} GetAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAlertPolicyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetAlertPolicyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetAlertPolicyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetAlertPolicyRequest} GetAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAlertPolicyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetAlertPolicyRequest message. + * @function verify + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAlertPolicyRequest.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 GetAlertPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetAlertPolicyRequest} GetAlertPolicyRequest + */ + GetAlertPolicyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetAlertPolicyRequest) + return object; + var message = new $root.google.monitoring.v3.GetAlertPolicyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetAlertPolicyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {google.monitoring.v3.GetAlertPolicyRequest} message GetAlertPolicyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAlertPolicyRequest.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 GetAlertPolicyRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @instance + * @returns {Object.} JSON object + */ + GetAlertPolicyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetAlertPolicyRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetAlertPolicyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetAlertPolicyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetAlertPolicyRequest"; + }; + + return GetAlertPolicyRequest; + })(); + + v3.ListAlertPoliciesRequest = (function() { + + /** + * Properties of a ListAlertPoliciesRequest. + * @memberof google.monitoring.v3 + * @interface IListAlertPoliciesRequest + * @property {string|null} [name] ListAlertPoliciesRequest name + * @property {string|null} [filter] ListAlertPoliciesRequest filter + * @property {string|null} [orderBy] ListAlertPoliciesRequest orderBy + * @property {number|null} [pageSize] ListAlertPoliciesRequest pageSize + * @property {string|null} [pageToken] ListAlertPoliciesRequest pageToken + */ + + /** + * Constructs a new ListAlertPoliciesRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListAlertPoliciesRequest. + * @implements IListAlertPoliciesRequest + * @constructor + * @param {google.monitoring.v3.IListAlertPoliciesRequest=} [properties] Properties to set + */ + function ListAlertPoliciesRequest(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]]; + } + + /** + * ListAlertPoliciesRequest name. + * @member {string} name + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @instance + */ + ListAlertPoliciesRequest.prototype.name = ""; + + /** + * ListAlertPoliciesRequest filter. + * @member {string} filter + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @instance + */ + ListAlertPoliciesRequest.prototype.filter = ""; + + /** + * ListAlertPoliciesRequest orderBy. + * @member {string} orderBy + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @instance + */ + ListAlertPoliciesRequest.prototype.orderBy = ""; + + /** + * ListAlertPoliciesRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @instance + */ + ListAlertPoliciesRequest.prototype.pageSize = 0; + + /** + * ListAlertPoliciesRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @instance + */ + ListAlertPoliciesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListAlertPoliciesRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {google.monitoring.v3.IListAlertPoliciesRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListAlertPoliciesRequest} ListAlertPoliciesRequest instance + */ + ListAlertPoliciesRequest.create = function create(properties) { + return new ListAlertPoliciesRequest(properties); + }; + + /** + * Encodes the specified ListAlertPoliciesRequest message. Does not implicitly {@link google.monitoring.v3.ListAlertPoliciesRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {google.monitoring.v3.IListAlertPoliciesRequest} message ListAlertPoliciesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAlertPoliciesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListAlertPoliciesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListAlertPoliciesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {google.monitoring.v3.IListAlertPoliciesRequest} message ListAlertPoliciesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAlertPoliciesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAlertPoliciesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListAlertPoliciesRequest} ListAlertPoliciesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAlertPoliciesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListAlertPoliciesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.name = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.orderBy = 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 ListAlertPoliciesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListAlertPoliciesRequest} ListAlertPoliciesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAlertPoliciesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAlertPoliciesRequest message. + * @function verify + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAlertPoliciesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: 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 ListAlertPoliciesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListAlertPoliciesRequest} ListAlertPoliciesRequest + */ + ListAlertPoliciesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListAlertPoliciesRequest) + return object; + var message = new $root.google.monitoring.v3.ListAlertPoliciesRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + 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 ListAlertPoliciesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {google.monitoring.v3.ListAlertPoliciesRequest} message ListAlertPoliciesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAlertPoliciesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListAlertPoliciesRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @instance + * @returns {Object.} JSON object + */ + ListAlertPoliciesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListAlertPoliciesRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListAlertPoliciesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListAlertPoliciesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListAlertPoliciesRequest"; + }; + + return ListAlertPoliciesRequest; + })(); + + v3.ListAlertPoliciesResponse = (function() { + + /** + * Properties of a ListAlertPoliciesResponse. + * @memberof google.monitoring.v3 + * @interface IListAlertPoliciesResponse + * @property {Array.|null} [alertPolicies] ListAlertPoliciesResponse alertPolicies + * @property {string|null} [nextPageToken] ListAlertPoliciesResponse nextPageToken + * @property {number|null} [totalSize] ListAlertPoliciesResponse totalSize + */ + + /** + * Constructs a new ListAlertPoliciesResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListAlertPoliciesResponse. + * @implements IListAlertPoliciesResponse + * @constructor + * @param {google.monitoring.v3.IListAlertPoliciesResponse=} [properties] Properties to set + */ + function ListAlertPoliciesResponse(properties) { + this.alertPolicies = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListAlertPoliciesResponse alertPolicies. + * @member {Array.} alertPolicies + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @instance + */ + ListAlertPoliciesResponse.prototype.alertPolicies = $util.emptyArray; + + /** + * ListAlertPoliciesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @instance + */ + ListAlertPoliciesResponse.prototype.nextPageToken = ""; + + /** + * ListAlertPoliciesResponse totalSize. + * @member {number} totalSize + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @instance + */ + ListAlertPoliciesResponse.prototype.totalSize = 0; + + /** + * Creates a new ListAlertPoliciesResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {google.monitoring.v3.IListAlertPoliciesResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListAlertPoliciesResponse} ListAlertPoliciesResponse instance + */ + ListAlertPoliciesResponse.create = function create(properties) { + return new ListAlertPoliciesResponse(properties); + }; + + /** + * Encodes the specified ListAlertPoliciesResponse message. Does not implicitly {@link google.monitoring.v3.ListAlertPoliciesResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {google.monitoring.v3.IListAlertPoliciesResponse} message ListAlertPoliciesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAlertPoliciesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.alertPolicies != null && message.alertPolicies.length) + for (var i = 0; i < message.alertPolicies.length; ++i) + $root.google.monitoring.v3.AlertPolicy.encode(message.alertPolicies[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.totalSize); + return writer; + }; + + /** + * Encodes the specified ListAlertPoliciesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListAlertPoliciesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {google.monitoring.v3.IListAlertPoliciesResponse} message ListAlertPoliciesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAlertPoliciesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAlertPoliciesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListAlertPoliciesResponse} ListAlertPoliciesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAlertPoliciesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListAlertPoliciesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (!(message.alertPolicies && message.alertPolicies.length)) + message.alertPolicies = []; + message.alertPolicies.push($root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 4: { + message.totalSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAlertPoliciesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListAlertPoliciesResponse} ListAlertPoliciesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAlertPoliciesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAlertPoliciesResponse message. + * @function verify + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAlertPoliciesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.alertPolicies != null && message.hasOwnProperty("alertPolicies")) { + if (!Array.isArray(message.alertPolicies)) + return "alertPolicies: array expected"; + for (var i = 0; i < message.alertPolicies.length; ++i) { + var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicies[i]); + if (error) + return "alertPolicies." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + return null; + }; + + /** + * Creates a ListAlertPoliciesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListAlertPoliciesResponse} ListAlertPoliciesResponse + */ + ListAlertPoliciesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListAlertPoliciesResponse) + return object; + var message = new $root.google.monitoring.v3.ListAlertPoliciesResponse(); + if (object.alertPolicies) { + if (!Array.isArray(object.alertPolicies)) + throw TypeError(".google.monitoring.v3.ListAlertPoliciesResponse.alertPolicies: array expected"); + message.alertPolicies = []; + for (var i = 0; i < object.alertPolicies.length; ++i) { + if (typeof object.alertPolicies[i] !== "object") + throw TypeError(".google.monitoring.v3.ListAlertPoliciesResponse.alertPolicies: object expected"); + message.alertPolicies[i] = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicies[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListAlertPoliciesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {google.monitoring.v3.ListAlertPoliciesResponse} message ListAlertPoliciesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAlertPoliciesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.alertPolicies = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.alertPolicies && message.alertPolicies.length) { + object.alertPolicies = []; + for (var j = 0; j < message.alertPolicies.length; ++j) + object.alertPolicies[j] = $root.google.monitoring.v3.AlertPolicy.toObject(message.alertPolicies[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + return object; + }; + + /** + * Converts this ListAlertPoliciesResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @instance + * @returns {Object.} JSON object + */ + ListAlertPoliciesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListAlertPoliciesResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListAlertPoliciesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListAlertPoliciesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListAlertPoliciesResponse"; + }; + + return ListAlertPoliciesResponse; + })(); + + v3.UpdateAlertPolicyRequest = (function() { + + /** + * Properties of an UpdateAlertPolicyRequest. + * @memberof google.monitoring.v3 + * @interface IUpdateAlertPolicyRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateAlertPolicyRequest updateMask + * @property {google.monitoring.v3.IAlertPolicy|null} [alertPolicy] UpdateAlertPolicyRequest alertPolicy + */ + + /** + * Constructs a new UpdateAlertPolicyRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents an UpdateAlertPolicyRequest. + * @implements IUpdateAlertPolicyRequest + * @constructor + * @param {google.monitoring.v3.IUpdateAlertPolicyRequest=} [properties] Properties to set + */ + function UpdateAlertPolicyRequest(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]]; + } + + /** + * UpdateAlertPolicyRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @instance + */ + UpdateAlertPolicyRequest.prototype.updateMask = null; + + /** + * UpdateAlertPolicyRequest alertPolicy. + * @member {google.monitoring.v3.IAlertPolicy|null|undefined} alertPolicy + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @instance + */ + UpdateAlertPolicyRequest.prototype.alertPolicy = null; + + /** + * Creates a new UpdateAlertPolicyRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IUpdateAlertPolicyRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.UpdateAlertPolicyRequest} UpdateAlertPolicyRequest instance + */ + UpdateAlertPolicyRequest.create = function create(properties) { + return new UpdateAlertPolicyRequest(properties); + }; + + /** + * Encodes the specified UpdateAlertPolicyRequest message. Does not implicitly {@link google.monitoring.v3.UpdateAlertPolicyRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IUpdateAlertPolicyRequest} message UpdateAlertPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAlertPolicyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.alertPolicy != null && Object.hasOwnProperty.call(message, "alertPolicy")) + $root.google.monitoring.v3.AlertPolicy.encode(message.alertPolicy, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateAlertPolicyRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateAlertPolicyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IUpdateAlertPolicyRequest} message UpdateAlertPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAlertPolicyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateAlertPolicyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UpdateAlertPolicyRequest} UpdateAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAlertPolicyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateAlertPolicyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateAlertPolicyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UpdateAlertPolicyRequest} UpdateAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAlertPolicyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateAlertPolicyRequest message. + * @function verify + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateAlertPolicyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.alertPolicy != null && message.hasOwnProperty("alertPolicy")) { + var error = $root.google.monitoring.v3.AlertPolicy.verify(message.alertPolicy); + if (error) + return "alertPolicy." + error; + } + return null; + }; + + /** + * Creates an UpdateAlertPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UpdateAlertPolicyRequest} UpdateAlertPolicyRequest + */ + UpdateAlertPolicyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UpdateAlertPolicyRequest) + return object; + var message = new $root.google.monitoring.v3.UpdateAlertPolicyRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.monitoring.v3.UpdateAlertPolicyRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.alertPolicy != null) { + if (typeof object.alertPolicy !== "object") + throw TypeError(".google.monitoring.v3.UpdateAlertPolicyRequest.alertPolicy: object expected"); + message.alertPolicy = $root.google.monitoring.v3.AlertPolicy.fromObject(object.alertPolicy); + } + return message; + }; + + /** + * Creates a plain object from an UpdateAlertPolicyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {google.monitoring.v3.UpdateAlertPolicyRequest} message UpdateAlertPolicyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateAlertPolicyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.updateMask = null; + object.alertPolicy = null; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.alertPolicy != null && message.hasOwnProperty("alertPolicy")) + object.alertPolicy = $root.google.monitoring.v3.AlertPolicy.toObject(message.alertPolicy, options); + return object; + }; + + /** + * Converts this UpdateAlertPolicyRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateAlertPolicyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateAlertPolicyRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.UpdateAlertPolicyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateAlertPolicyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UpdateAlertPolicyRequest"; + }; + + return UpdateAlertPolicyRequest; + })(); + + v3.DeleteAlertPolicyRequest = (function() { + + /** + * Properties of a DeleteAlertPolicyRequest. + * @memberof google.monitoring.v3 + * @interface IDeleteAlertPolicyRequest + * @property {string|null} [name] DeleteAlertPolicyRequest name + */ + + /** + * Constructs a new DeleteAlertPolicyRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a DeleteAlertPolicyRequest. + * @implements IDeleteAlertPolicyRequest + * @constructor + * @param {google.monitoring.v3.IDeleteAlertPolicyRequest=} [properties] Properties to set + */ + function DeleteAlertPolicyRequest(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]]; + } + + /** + * DeleteAlertPolicyRequest name. + * @member {string} name + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @instance + */ + DeleteAlertPolicyRequest.prototype.name = ""; + + /** + * Creates a new DeleteAlertPolicyRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IDeleteAlertPolicyRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.DeleteAlertPolicyRequest} DeleteAlertPolicyRequest instance + */ + DeleteAlertPolicyRequest.create = function create(properties) { + return new DeleteAlertPolicyRequest(properties); + }; + + /** + * Encodes the specified DeleteAlertPolicyRequest message. Does not implicitly {@link google.monitoring.v3.DeleteAlertPolicyRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IDeleteAlertPolicyRequest} message DeleteAlertPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAlertPolicyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteAlertPolicyRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteAlertPolicyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {google.monitoring.v3.IDeleteAlertPolicyRequest} message DeleteAlertPolicyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAlertPolicyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteAlertPolicyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DeleteAlertPolicyRequest} DeleteAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAlertPolicyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteAlertPolicyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteAlertPolicyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DeleteAlertPolicyRequest} DeleteAlertPolicyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAlertPolicyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteAlertPolicyRequest message. + * @function verify + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteAlertPolicyRequest.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 DeleteAlertPolicyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DeleteAlertPolicyRequest} DeleteAlertPolicyRequest + */ + DeleteAlertPolicyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DeleteAlertPolicyRequest) + return object; + var message = new $root.google.monitoring.v3.DeleteAlertPolicyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteAlertPolicyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {google.monitoring.v3.DeleteAlertPolicyRequest} message DeleteAlertPolicyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteAlertPolicyRequest.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 DeleteAlertPolicyRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteAlertPolicyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteAlertPolicyRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.DeleteAlertPolicyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteAlertPolicyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DeleteAlertPolicyRequest"; + }; + + return DeleteAlertPolicyRequest; + })(); + + v3.DroppedLabels = (function() { + + /** + * Properties of a DroppedLabels. + * @memberof google.monitoring.v3 + * @interface IDroppedLabels + * @property {Object.|null} [label] DroppedLabels label + */ + + /** + * Constructs a new DroppedLabels. + * @memberof google.monitoring.v3 + * @classdesc Represents a DroppedLabels. + * @implements IDroppedLabels + * @constructor + * @param {google.monitoring.v3.IDroppedLabels=} [properties] Properties to set + */ + function DroppedLabels(properties) { + this.label = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DroppedLabels label. + * @member {Object.} label + * @memberof google.monitoring.v3.DroppedLabels + * @instance + */ + DroppedLabels.prototype.label = $util.emptyObject; + + /** + * Creates a new DroppedLabels instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {google.monitoring.v3.IDroppedLabels=} [properties] Properties to set + * @returns {google.monitoring.v3.DroppedLabels} DroppedLabels instance + */ + DroppedLabels.create = function create(properties) { + return new DroppedLabels(properties); + }; + + /** + * Encodes the specified DroppedLabels message. Does not implicitly {@link google.monitoring.v3.DroppedLabels.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {google.monitoring.v3.IDroppedLabels} message DroppedLabels message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DroppedLabels.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + for (var keys = Object.keys(message.label), i = 0; i < keys.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.label[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified DroppedLabels message, length delimited. Does not implicitly {@link google.monitoring.v3.DroppedLabels.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {google.monitoring.v3.IDroppedLabels} message DroppedLabels message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DroppedLabels.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DroppedLabels message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DroppedLabels} DroppedLabels + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DroppedLabels.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DroppedLabels(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (message.label === $util.emptyObject) + message.label = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.label[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DroppedLabels message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DroppedLabels} DroppedLabels + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DroppedLabels.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DroppedLabels message. + * @function verify + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DroppedLabels.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.label != null && message.hasOwnProperty("label")) { + if (!$util.isObject(message.label)) + return "label: object expected"; + var key = Object.keys(message.label); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.label[key[i]])) + return "label: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a DroppedLabels message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DroppedLabels} DroppedLabels + */ + DroppedLabels.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DroppedLabels) + return object; + var message = new $root.google.monitoring.v3.DroppedLabels(); + if (object.label) { + if (typeof object.label !== "object") + throw TypeError(".google.monitoring.v3.DroppedLabels.label: object expected"); + message.label = {}; + for (var keys = Object.keys(object.label), i = 0; i < keys.length; ++i) + message.label[keys[i]] = String(object.label[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a DroppedLabels message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {google.monitoring.v3.DroppedLabels} message DroppedLabels + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DroppedLabels.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.label = {}; + var keys2; + if (message.label && (keys2 = Object.keys(message.label)).length) { + object.label = {}; + for (var j = 0; j < keys2.length; ++j) + object.label[keys2[j]] = message.label[keys2[j]]; + } + return object; + }; + + /** + * Converts this DroppedLabels to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DroppedLabels + * @instance + * @returns {Object.} JSON object + */ + DroppedLabels.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DroppedLabels + * @function getTypeUrl + * @memberof google.monitoring.v3.DroppedLabels + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DroppedLabels.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DroppedLabels"; + }; + + return DroppedLabels; + })(); + + v3.Group = (function() { + + /** + * Properties of a Group. + * @memberof google.monitoring.v3 + * @interface IGroup + * @property {string|null} [name] Group name + * @property {string|null} [displayName] Group displayName + * @property {string|null} [parentName] Group parentName + * @property {string|null} [filter] Group filter + * @property {boolean|null} [isCluster] Group isCluster + */ + + /** + * Constructs a new Group. + * @memberof google.monitoring.v3 + * @classdesc Represents a Group. + * @implements IGroup + * @constructor + * @param {google.monitoring.v3.IGroup=} [properties] Properties to set + */ + function Group(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]]; + } + + /** + * Group name. + * @member {string} name + * @memberof google.monitoring.v3.Group + * @instance + */ + Group.prototype.name = ""; + + /** + * Group displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.Group + * @instance + */ + Group.prototype.displayName = ""; + + /** + * Group parentName. + * @member {string} parentName + * @memberof google.monitoring.v3.Group + * @instance + */ + Group.prototype.parentName = ""; + + /** + * Group filter. + * @member {string} filter + * @memberof google.monitoring.v3.Group + * @instance + */ + Group.prototype.filter = ""; + + /** + * Group isCluster. + * @member {boolean} isCluster + * @memberof google.monitoring.v3.Group + * @instance + */ + Group.prototype.isCluster = false; + + /** + * Creates a new Group instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Group + * @static + * @param {google.monitoring.v3.IGroup=} [properties] Properties to set + * @returns {google.monitoring.v3.Group} Group instance + */ + Group.create = function create(properties) { + return new Group(properties); + }; + + /** + * Encodes the specified Group message. Does not implicitly {@link google.monitoring.v3.Group.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Group + * @static + * @param {google.monitoring.v3.IGroup} message Group message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Group.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.parentName != null && Object.hasOwnProperty.call(message, "parentName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.parentName); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.isCluster != null && Object.hasOwnProperty.call(message, "isCluster")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.isCluster); + return writer; + }; + + /** + * Encodes the specified Group message, length delimited. Does not implicitly {@link google.monitoring.v3.Group.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Group + * @static + * @param {google.monitoring.v3.IGroup} message Group message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Group.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Group message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Group + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Group} Group + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Group.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Group(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.parentName = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.isCluster = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Group message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Group + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Group} Group + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Group.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Group message. + * @function verify + * @memberof google.monitoring.v3.Group + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Group.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.parentName != null && message.hasOwnProperty("parentName")) + if (!$util.isString(message.parentName)) + return "parentName: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.isCluster != null && message.hasOwnProperty("isCluster")) + if (typeof message.isCluster !== "boolean") + return "isCluster: boolean expected"; + return null; + }; + + /** + * Creates a Group message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Group + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Group} Group + */ + Group.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Group) + return object; + var message = new $root.google.monitoring.v3.Group(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.parentName != null) + message.parentName = String(object.parentName); + if (object.filter != null) + message.filter = String(object.filter); + if (object.isCluster != null) + message.isCluster = Boolean(object.isCluster); + return message; + }; + + /** + * Creates a plain object from a Group message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Group + * @static + * @param {google.monitoring.v3.Group} message Group + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Group.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.parentName = ""; + object.filter = ""; + object.isCluster = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.parentName != null && message.hasOwnProperty("parentName")) + object.parentName = message.parentName; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.isCluster != null && message.hasOwnProperty("isCluster")) + object.isCluster = message.isCluster; + return object; + }; + + /** + * Converts this Group to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Group + * @instance + * @returns {Object.} JSON object + */ + Group.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Group + * @function getTypeUrl + * @memberof google.monitoring.v3.Group + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Group.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Group"; + }; + + return Group; + })(); + + v3.GroupService = (function() { + + /** + * Constructs a new GroupService service. + * @memberof google.monitoring.v3 + * @classdesc Represents a GroupService + * @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 GroupService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (GroupService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = GroupService; + + /** + * Creates new GroupService service using the specified rpc implementation. + * @function create + * @memberof google.monitoring.v3.GroupService + * @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 {GroupService} RPC service. Useful where requests and/or responses are streamed. + */ + GroupService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|listGroups}. + * @memberof google.monitoring.v3.GroupService + * @typedef ListGroupsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListGroupsResponse} [response] ListGroupsResponse + */ + + /** + * Calls ListGroups. + * @function listGroups + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IListGroupsRequest} request ListGroupsRequest message or plain object + * @param {google.monitoring.v3.GroupService.ListGroupsCallback} callback Node-style callback called with the error, if any, and ListGroupsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(GroupService.prototype.listGroups = function listGroups(request, callback) { + return this.rpcCall(listGroups, $root.google.monitoring.v3.ListGroupsRequest, $root.google.monitoring.v3.ListGroupsResponse, request, callback); + }, "name", { value: "ListGroups" }); + + /** + * Calls ListGroups. + * @function listGroups + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IListGroupsRequest} request ListGroupsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|getGroup}. + * @memberof google.monitoring.v3.GroupService + * @typedef GetGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.Group} [response] Group + */ + + /** + * Calls GetGroup. + * @function getGroup + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IGetGroupRequest} request GetGroupRequest message or plain object + * @param {google.monitoring.v3.GroupService.GetGroupCallback} callback Node-style callback called with the error, if any, and Group + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(GroupService.prototype.getGroup = function getGroup(request, callback) { + return this.rpcCall(getGroup, $root.google.monitoring.v3.GetGroupRequest, $root.google.monitoring.v3.Group, request, callback); + }, "name", { value: "GetGroup" }); + + /** + * Calls GetGroup. + * @function getGroup + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IGetGroupRequest} request GetGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|createGroup}. + * @memberof google.monitoring.v3.GroupService + * @typedef CreateGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.Group} [response] Group + */ + + /** + * Calls CreateGroup. + * @function createGroup + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.ICreateGroupRequest} request CreateGroupRequest message or plain object + * @param {google.monitoring.v3.GroupService.CreateGroupCallback} callback Node-style callback called with the error, if any, and Group + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(GroupService.prototype.createGroup = function createGroup(request, callback) { + return this.rpcCall(createGroup, $root.google.monitoring.v3.CreateGroupRequest, $root.google.monitoring.v3.Group, request, callback); + }, "name", { value: "CreateGroup" }); + + /** + * Calls CreateGroup. + * @function createGroup + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.ICreateGroupRequest} request CreateGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|updateGroup}. + * @memberof google.monitoring.v3.GroupService + * @typedef UpdateGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.Group} [response] Group + */ + + /** + * Calls UpdateGroup. + * @function updateGroup + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IUpdateGroupRequest} request UpdateGroupRequest message or plain object + * @param {google.monitoring.v3.GroupService.UpdateGroupCallback} callback Node-style callback called with the error, if any, and Group + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(GroupService.prototype.updateGroup = function updateGroup(request, callback) { + return this.rpcCall(updateGroup, $root.google.monitoring.v3.UpdateGroupRequest, $root.google.monitoring.v3.Group, request, callback); + }, "name", { value: "UpdateGroup" }); + + /** + * Calls UpdateGroup. + * @function updateGroup + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IUpdateGroupRequest} request UpdateGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|deleteGroup}. + * @memberof google.monitoring.v3.GroupService + * @typedef DeleteGroupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteGroup. + * @function deleteGroup + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IDeleteGroupRequest} request DeleteGroupRequest message or plain object + * @param {google.monitoring.v3.GroupService.DeleteGroupCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(GroupService.prototype.deleteGroup = function deleteGroup(request, callback) { + return this.rpcCall(deleteGroup, $root.google.monitoring.v3.DeleteGroupRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteGroup" }); + + /** + * Calls DeleteGroup. + * @function deleteGroup + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IDeleteGroupRequest} request DeleteGroupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.GroupService|listGroupMembers}. + * @memberof google.monitoring.v3.GroupService + * @typedef ListGroupMembersCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListGroupMembersResponse} [response] ListGroupMembersResponse + */ + + /** + * Calls ListGroupMembers. + * @function listGroupMembers + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IListGroupMembersRequest} request ListGroupMembersRequest message or plain object + * @param {google.monitoring.v3.GroupService.ListGroupMembersCallback} callback Node-style callback called with the error, if any, and ListGroupMembersResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(GroupService.prototype.listGroupMembers = function listGroupMembers(request, callback) { + return this.rpcCall(listGroupMembers, $root.google.monitoring.v3.ListGroupMembersRequest, $root.google.monitoring.v3.ListGroupMembersResponse, request, callback); + }, "name", { value: "ListGroupMembers" }); + + /** + * Calls ListGroupMembers. + * @function listGroupMembers + * @memberof google.monitoring.v3.GroupService + * @instance + * @param {google.monitoring.v3.IListGroupMembersRequest} request ListGroupMembersRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return GroupService; + })(); + + v3.ListGroupsRequest = (function() { + + /** + * Properties of a ListGroupsRequest. + * @memberof google.monitoring.v3 + * @interface IListGroupsRequest + * @property {string|null} [name] ListGroupsRequest name + * @property {string|null} [childrenOfGroup] ListGroupsRequest childrenOfGroup + * @property {string|null} [ancestorsOfGroup] ListGroupsRequest ancestorsOfGroup + * @property {string|null} [descendantsOfGroup] ListGroupsRequest descendantsOfGroup + * @property {number|null} [pageSize] ListGroupsRequest pageSize + * @property {string|null} [pageToken] ListGroupsRequest pageToken + */ + + /** + * Constructs a new ListGroupsRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListGroupsRequest. + * @implements IListGroupsRequest + * @constructor + * @param {google.monitoring.v3.IListGroupsRequest=} [properties] Properties to set + */ + function ListGroupsRequest(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]]; + } + + /** + * ListGroupsRequest name. + * @member {string} name + * @memberof google.monitoring.v3.ListGroupsRequest + * @instance + */ + ListGroupsRequest.prototype.name = ""; + + /** + * ListGroupsRequest childrenOfGroup. + * @member {string|null|undefined} childrenOfGroup + * @memberof google.monitoring.v3.ListGroupsRequest + * @instance + */ + ListGroupsRequest.prototype.childrenOfGroup = null; + + /** + * ListGroupsRequest ancestorsOfGroup. + * @member {string|null|undefined} ancestorsOfGroup + * @memberof google.monitoring.v3.ListGroupsRequest + * @instance + */ + ListGroupsRequest.prototype.ancestorsOfGroup = null; + + /** + * ListGroupsRequest descendantsOfGroup. + * @member {string|null|undefined} descendantsOfGroup + * @memberof google.monitoring.v3.ListGroupsRequest + * @instance + */ + ListGroupsRequest.prototype.descendantsOfGroup = null; + + /** + * ListGroupsRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListGroupsRequest + * @instance + */ + ListGroupsRequest.prototype.pageSize = 0; + + /** + * ListGroupsRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListGroupsRequest + * @instance + */ + ListGroupsRequest.prototype.pageToken = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ListGroupsRequest filter. + * @member {"childrenOfGroup"|"ancestorsOfGroup"|"descendantsOfGroup"|undefined} filter + * @memberof google.monitoring.v3.ListGroupsRequest + * @instance + */ + Object.defineProperty(ListGroupsRequest.prototype, "filter", { + get: $util.oneOfGetter($oneOfFields = ["childrenOfGroup", "ancestorsOfGroup", "descendantsOfGroup"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ListGroupsRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {google.monitoring.v3.IListGroupsRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListGroupsRequest} ListGroupsRequest instance + */ + ListGroupsRequest.create = function create(properties) { + return new ListGroupsRequest(properties); + }; + + /** + * Encodes the specified ListGroupsRequest message. Does not implicitly {@link google.monitoring.v3.ListGroupsRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {google.monitoring.v3.IListGroupsRequest} message ListGroupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGroupsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.childrenOfGroup != null && Object.hasOwnProperty.call(message, "childrenOfGroup")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childrenOfGroup); + if (message.ancestorsOfGroup != null && Object.hasOwnProperty.call(message, "ancestorsOfGroup")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.ancestorsOfGroup); + if (message.descendantsOfGroup != null && Object.hasOwnProperty.call(message, "descendantsOfGroup")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.descendantsOfGroup); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListGroupsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListGroupsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {google.monitoring.v3.IListGroupsRequest} message ListGroupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGroupsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGroupsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListGroupsRequest} ListGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGroupsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListGroupsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 7: { + message.name = reader.string(); + break; + } + case 2: { + message.childrenOfGroup = reader.string(); + break; + } + case 3: { + message.ancestorsOfGroup = reader.string(); + break; + } + case 4: { + message.descendantsOfGroup = 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 ListGroupsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListGroupsRequest} ListGroupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGroupsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGroupsRequest message. + * @function verify + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGroupsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.childrenOfGroup != null && message.hasOwnProperty("childrenOfGroup")) { + properties.filter = 1; + if (!$util.isString(message.childrenOfGroup)) + return "childrenOfGroup: string expected"; + } + if (message.ancestorsOfGroup != null && message.hasOwnProperty("ancestorsOfGroup")) { + if (properties.filter === 1) + return "filter: multiple values"; + properties.filter = 1; + if (!$util.isString(message.ancestorsOfGroup)) + return "ancestorsOfGroup: string expected"; + } + if (message.descendantsOfGroup != null && message.hasOwnProperty("descendantsOfGroup")) { + if (properties.filter === 1) + return "filter: multiple values"; + properties.filter = 1; + if (!$util.isString(message.descendantsOfGroup)) + return "descendantsOfGroup: 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 ListGroupsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListGroupsRequest} ListGroupsRequest + */ + ListGroupsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListGroupsRequest) + return object; + var message = new $root.google.monitoring.v3.ListGroupsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.childrenOfGroup != null) + message.childrenOfGroup = String(object.childrenOfGroup); + if (object.ancestorsOfGroup != null) + message.ancestorsOfGroup = String(object.ancestorsOfGroup); + if (object.descendantsOfGroup != null) + message.descendantsOfGroup = String(object.descendantsOfGroup); + 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 ListGroupsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {google.monitoring.v3.ListGroupsRequest} message ListGroupsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGroupsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.childrenOfGroup != null && message.hasOwnProperty("childrenOfGroup")) { + object.childrenOfGroup = message.childrenOfGroup; + if (options.oneofs) + object.filter = "childrenOfGroup"; + } + if (message.ancestorsOfGroup != null && message.hasOwnProperty("ancestorsOfGroup")) { + object.ancestorsOfGroup = message.ancestorsOfGroup; + if (options.oneofs) + object.filter = "ancestorsOfGroup"; + } + if (message.descendantsOfGroup != null && message.hasOwnProperty("descendantsOfGroup")) { + object.descendantsOfGroup = message.descendantsOfGroup; + if (options.oneofs) + object.filter = "descendantsOfGroup"; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListGroupsRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListGroupsRequest + * @instance + * @returns {Object.} JSON object + */ + ListGroupsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListGroupsRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListGroupsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListGroupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListGroupsRequest"; + }; + + return ListGroupsRequest; + })(); + + v3.ListGroupsResponse = (function() { + + /** + * Properties of a ListGroupsResponse. + * @memberof google.monitoring.v3 + * @interface IListGroupsResponse + * @property {Array.|null} [group] ListGroupsResponse group + * @property {string|null} [nextPageToken] ListGroupsResponse nextPageToken + */ + + /** + * Constructs a new ListGroupsResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListGroupsResponse. + * @implements IListGroupsResponse + * @constructor + * @param {google.monitoring.v3.IListGroupsResponse=} [properties] Properties to set + */ + function ListGroupsResponse(properties) { + this.group = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListGroupsResponse group. + * @member {Array.} group + * @memberof google.monitoring.v3.ListGroupsResponse + * @instance + */ + ListGroupsResponse.prototype.group = $util.emptyArray; + + /** + * ListGroupsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListGroupsResponse + * @instance + */ + ListGroupsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListGroupsResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {google.monitoring.v3.IListGroupsResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListGroupsResponse} ListGroupsResponse instance + */ + ListGroupsResponse.create = function create(properties) { + return new ListGroupsResponse(properties); + }; + + /** + * Encodes the specified ListGroupsResponse message. Does not implicitly {@link google.monitoring.v3.ListGroupsResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {google.monitoring.v3.IListGroupsResponse} message ListGroupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGroupsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.group != null && message.group.length) + for (var i = 0; i < message.group.length; ++i) + $root.google.monitoring.v3.Group.encode(message.group[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListGroupsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListGroupsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {google.monitoring.v3.IListGroupsResponse} message ListGroupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGroupsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGroupsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListGroupsResponse} ListGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGroupsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListGroupsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.group && message.group.length)) + message.group = []; + message.group.push($root.google.monitoring.v3.Group.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListGroupsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListGroupsResponse} ListGroupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGroupsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGroupsResponse message. + * @function verify + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGroupsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.group != null && message.hasOwnProperty("group")) { + if (!Array.isArray(message.group)) + return "group: array expected"; + for (var i = 0; i < message.group.length; ++i) { + var error = $root.google.monitoring.v3.Group.verify(message.group[i]); + if (error) + return "group." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListGroupsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListGroupsResponse} ListGroupsResponse + */ + ListGroupsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListGroupsResponse) + return object; + var message = new $root.google.monitoring.v3.ListGroupsResponse(); + if (object.group) { + if (!Array.isArray(object.group)) + throw TypeError(".google.monitoring.v3.ListGroupsResponse.group: array expected"); + message.group = []; + for (var i = 0; i < object.group.length; ++i) { + if (typeof object.group[i] !== "object") + throw TypeError(".google.monitoring.v3.ListGroupsResponse.group: object expected"); + message.group[i] = $root.google.monitoring.v3.Group.fromObject(object.group[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListGroupsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {google.monitoring.v3.ListGroupsResponse} message ListGroupsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGroupsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.group = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.group && message.group.length) { + object.group = []; + for (var j = 0; j < message.group.length; ++j) + object.group[j] = $root.google.monitoring.v3.Group.toObject(message.group[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListGroupsResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListGroupsResponse + * @instance + * @returns {Object.} JSON object + */ + ListGroupsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListGroupsResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListGroupsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListGroupsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListGroupsResponse"; + }; + + return ListGroupsResponse; + })(); + + v3.GetGroupRequest = (function() { + + /** + * Properties of a GetGroupRequest. + * @memberof google.monitoring.v3 + * @interface IGetGroupRequest + * @property {string|null} [name] GetGroupRequest name + */ + + /** + * Constructs a new GetGroupRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetGroupRequest. + * @implements IGetGroupRequest + * @constructor + * @param {google.monitoring.v3.IGetGroupRequest=} [properties] Properties to set + */ + function GetGroupRequest(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]]; + } + + /** + * GetGroupRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetGroupRequest + * @instance + */ + GetGroupRequest.prototype.name = ""; + + /** + * Creates a new GetGroupRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {google.monitoring.v3.IGetGroupRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetGroupRequest} GetGroupRequest instance + */ + GetGroupRequest.create = function create(properties) { + return new GetGroupRequest(properties); + }; + + /** + * Encodes the specified GetGroupRequest message. Does not implicitly {@link google.monitoring.v3.GetGroupRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {google.monitoring.v3.IGetGroupRequest} message GetGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGroupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetGroupRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetGroupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {google.monitoring.v3.IGetGroupRequest} message GetGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetGroupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetGroupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetGroupRequest} GetGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGroupRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetGroupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetGroupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetGroupRequest} GetGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetGroupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetGroupRequest message. + * @function verify + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetGroupRequest.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 GetGroupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetGroupRequest} GetGroupRequest + */ + GetGroupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetGroupRequest) + return object; + var message = new $root.google.monitoring.v3.GetGroupRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetGroupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {google.monitoring.v3.GetGroupRequest} message GetGroupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetGroupRequest.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 GetGroupRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetGroupRequest + * @instance + * @returns {Object.} JSON object + */ + GetGroupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetGroupRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetGroupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetGroupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetGroupRequest"; + }; + + return GetGroupRequest; + })(); + + v3.CreateGroupRequest = (function() { + + /** + * Properties of a CreateGroupRequest. + * @memberof google.monitoring.v3 + * @interface ICreateGroupRequest + * @property {string|null} [name] CreateGroupRequest name + * @property {google.monitoring.v3.IGroup|null} [group] CreateGroupRequest group + * @property {boolean|null} [validateOnly] CreateGroupRequest validateOnly + */ + + /** + * Constructs a new CreateGroupRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateGroupRequest. + * @implements ICreateGroupRequest + * @constructor + * @param {google.monitoring.v3.ICreateGroupRequest=} [properties] Properties to set + */ + function CreateGroupRequest(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]]; + } + + /** + * CreateGroupRequest name. + * @member {string} name + * @memberof google.monitoring.v3.CreateGroupRequest + * @instance + */ + CreateGroupRequest.prototype.name = ""; + + /** + * CreateGroupRequest group. + * @member {google.monitoring.v3.IGroup|null|undefined} group + * @memberof google.monitoring.v3.CreateGroupRequest + * @instance + */ + CreateGroupRequest.prototype.group = null; + + /** + * CreateGroupRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.monitoring.v3.CreateGroupRequest + * @instance + */ + CreateGroupRequest.prototype.validateOnly = false; + + /** + * Creates a new CreateGroupRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {google.monitoring.v3.ICreateGroupRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateGroupRequest} CreateGroupRequest instance + */ + CreateGroupRequest.create = function create(properties) { + return new CreateGroupRequest(properties); + }; + + /** + * Encodes the specified CreateGroupRequest message. Does not implicitly {@link google.monitoring.v3.CreateGroupRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {google.monitoring.v3.ICreateGroupRequest} message CreateGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGroupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.group != null && Object.hasOwnProperty.call(message, "group")) + $root.google.monitoring.v3.Group.encode(message.group, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.validateOnly); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + return writer; + }; + + /** + * Encodes the specified CreateGroupRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateGroupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {google.monitoring.v3.ICreateGroupRequest} message CreateGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateGroupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateGroupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateGroupRequest} CreateGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGroupRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateGroupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.name = reader.string(); + break; + } + case 2: { + message.group = $root.google.monitoring.v3.Group.decode(reader, reader.uint32()); + break; + } + case 3: { + message.validateOnly = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateGroupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateGroupRequest} CreateGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateGroupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateGroupRequest message. + * @function verify + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateGroupRequest.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.group != null && message.hasOwnProperty("group")) { + var error = $root.google.monitoring.v3.Group.verify(message.group); + if (error) + return "group." + error; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates a CreateGroupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateGroupRequest} CreateGroupRequest + */ + CreateGroupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateGroupRequest) + return object; + var message = new $root.google.monitoring.v3.CreateGroupRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.group != null) { + if (typeof object.group !== "object") + throw TypeError(".google.monitoring.v3.CreateGroupRequest.group: object expected"); + message.group = $root.google.monitoring.v3.Group.fromObject(object.group); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from a CreateGroupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {google.monitoring.v3.CreateGroupRequest} message CreateGroupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateGroupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.group = null; + object.validateOnly = false; + object.name = ""; + } + if (message.group != null && message.hasOwnProperty("group")) + object.group = $root.google.monitoring.v3.Group.toObject(message.group, options); + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CreateGroupRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateGroupRequest + * @instance + * @returns {Object.} JSON object + */ + CreateGroupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateGroupRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateGroupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateGroupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateGroupRequest"; + }; + + return CreateGroupRequest; + })(); + + v3.UpdateGroupRequest = (function() { + + /** + * Properties of an UpdateGroupRequest. + * @memberof google.monitoring.v3 + * @interface IUpdateGroupRequest + * @property {google.monitoring.v3.IGroup|null} [group] UpdateGroupRequest group + * @property {boolean|null} [validateOnly] UpdateGroupRequest validateOnly + */ + + /** + * Constructs a new UpdateGroupRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents an UpdateGroupRequest. + * @implements IUpdateGroupRequest + * @constructor + * @param {google.monitoring.v3.IUpdateGroupRequest=} [properties] Properties to set + */ + function UpdateGroupRequest(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]]; + } + + /** + * UpdateGroupRequest group. + * @member {google.monitoring.v3.IGroup|null|undefined} group + * @memberof google.monitoring.v3.UpdateGroupRequest + * @instance + */ + UpdateGroupRequest.prototype.group = null; + + /** + * UpdateGroupRequest validateOnly. + * @member {boolean} validateOnly + * @memberof google.monitoring.v3.UpdateGroupRequest + * @instance + */ + UpdateGroupRequest.prototype.validateOnly = false; + + /** + * Creates a new UpdateGroupRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {google.monitoring.v3.IUpdateGroupRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.UpdateGroupRequest} UpdateGroupRequest instance + */ + UpdateGroupRequest.create = function create(properties) { + return new UpdateGroupRequest(properties); + }; + + /** + * Encodes the specified UpdateGroupRequest message. Does not implicitly {@link google.monitoring.v3.UpdateGroupRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {google.monitoring.v3.IUpdateGroupRequest} message UpdateGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateGroupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.group != null && Object.hasOwnProperty.call(message, "group")) + $root.google.monitoring.v3.Group.encode(message.group, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.validateOnly != null && Object.hasOwnProperty.call(message, "validateOnly")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.validateOnly); + return writer; + }; + + /** + * Encodes the specified UpdateGroupRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateGroupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {google.monitoring.v3.IUpdateGroupRequest} message UpdateGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateGroupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateGroupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UpdateGroupRequest} UpdateGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateGroupRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateGroupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.group = $root.google.monitoring.v3.Group.decode(reader, reader.uint32()); + break; + } + case 3: { + message.validateOnly = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateGroupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UpdateGroupRequest} UpdateGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateGroupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateGroupRequest message. + * @function verify + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateGroupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.group != null && message.hasOwnProperty("group")) { + var error = $root.google.monitoring.v3.Group.verify(message.group); + if (error) + return "group." + error; + } + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + if (typeof message.validateOnly !== "boolean") + return "validateOnly: boolean expected"; + return null; + }; + + /** + * Creates an UpdateGroupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UpdateGroupRequest} UpdateGroupRequest + */ + UpdateGroupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UpdateGroupRequest) + return object; + var message = new $root.google.monitoring.v3.UpdateGroupRequest(); + if (object.group != null) { + if (typeof object.group !== "object") + throw TypeError(".google.monitoring.v3.UpdateGroupRequest.group: object expected"); + message.group = $root.google.monitoring.v3.Group.fromObject(object.group); + } + if (object.validateOnly != null) + message.validateOnly = Boolean(object.validateOnly); + return message; + }; + + /** + * Creates a plain object from an UpdateGroupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {google.monitoring.v3.UpdateGroupRequest} message UpdateGroupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateGroupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.group = null; + object.validateOnly = false; + } + if (message.group != null && message.hasOwnProperty("group")) + object.group = $root.google.monitoring.v3.Group.toObject(message.group, options); + if (message.validateOnly != null && message.hasOwnProperty("validateOnly")) + object.validateOnly = message.validateOnly; + return object; + }; + + /** + * Converts this UpdateGroupRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UpdateGroupRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateGroupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateGroupRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.UpdateGroupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateGroupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UpdateGroupRequest"; + }; + + return UpdateGroupRequest; + })(); + + v3.DeleteGroupRequest = (function() { + + /** + * Properties of a DeleteGroupRequest. + * @memberof google.monitoring.v3 + * @interface IDeleteGroupRequest + * @property {string|null} [name] DeleteGroupRequest name + * @property {boolean|null} [recursive] DeleteGroupRequest recursive + */ + + /** + * Constructs a new DeleteGroupRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a DeleteGroupRequest. + * @implements IDeleteGroupRequest + * @constructor + * @param {google.monitoring.v3.IDeleteGroupRequest=} [properties] Properties to set + */ + function DeleteGroupRequest(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]]; + } + + /** + * DeleteGroupRequest name. + * @member {string} name + * @memberof google.monitoring.v3.DeleteGroupRequest + * @instance + */ + DeleteGroupRequest.prototype.name = ""; + + /** + * DeleteGroupRequest recursive. + * @member {boolean} recursive + * @memberof google.monitoring.v3.DeleteGroupRequest + * @instance + */ + DeleteGroupRequest.prototype.recursive = false; + + /** + * Creates a new DeleteGroupRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {google.monitoring.v3.IDeleteGroupRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.DeleteGroupRequest} DeleteGroupRequest instance + */ + DeleteGroupRequest.create = function create(properties) { + return new DeleteGroupRequest(properties); + }; + + /** + * Encodes the specified DeleteGroupRequest message. Does not implicitly {@link google.monitoring.v3.DeleteGroupRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {google.monitoring.v3.IDeleteGroupRequest} message DeleteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGroupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.recursive != null && Object.hasOwnProperty.call(message, "recursive")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.recursive); + return writer; + }; + + /** + * Encodes the specified DeleteGroupRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteGroupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {google.monitoring.v3.IDeleteGroupRequest} message DeleteGroupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteGroupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteGroupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DeleteGroupRequest} DeleteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGroupRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteGroupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + case 4: { + message.recursive = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteGroupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DeleteGroupRequest} DeleteGroupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteGroupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteGroupRequest message. + * @function verify + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteGroupRequest.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.recursive != null && message.hasOwnProperty("recursive")) + if (typeof message.recursive !== "boolean") + return "recursive: boolean expected"; + return null; + }; + + /** + * Creates a DeleteGroupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DeleteGroupRequest} DeleteGroupRequest + */ + DeleteGroupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DeleteGroupRequest) + return object; + var message = new $root.google.monitoring.v3.DeleteGroupRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.recursive != null) + message.recursive = Boolean(object.recursive); + return message; + }; + + /** + * Creates a plain object from a DeleteGroupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {google.monitoring.v3.DeleteGroupRequest} message DeleteGroupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteGroupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.recursive = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.recursive != null && message.hasOwnProperty("recursive")) + object.recursive = message.recursive; + return object; + }; + + /** + * Converts this DeleteGroupRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DeleteGroupRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteGroupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteGroupRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.DeleteGroupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteGroupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DeleteGroupRequest"; + }; + + return DeleteGroupRequest; + })(); + + v3.ListGroupMembersRequest = (function() { + + /** + * Properties of a ListGroupMembersRequest. + * @memberof google.monitoring.v3 + * @interface IListGroupMembersRequest + * @property {string|null} [name] ListGroupMembersRequest name + * @property {number|null} [pageSize] ListGroupMembersRequest pageSize + * @property {string|null} [pageToken] ListGroupMembersRequest pageToken + * @property {string|null} [filter] ListGroupMembersRequest filter + * @property {google.monitoring.v3.ITimeInterval|null} [interval] ListGroupMembersRequest interval + */ + + /** + * Constructs a new ListGroupMembersRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListGroupMembersRequest. + * @implements IListGroupMembersRequest + * @constructor + * @param {google.monitoring.v3.IListGroupMembersRequest=} [properties] Properties to set + */ + function ListGroupMembersRequest(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]]; + } + + /** + * ListGroupMembersRequest name. + * @member {string} name + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @instance + */ + ListGroupMembersRequest.prototype.name = ""; + + /** + * ListGroupMembersRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @instance + */ + ListGroupMembersRequest.prototype.pageSize = 0; + + /** + * ListGroupMembersRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @instance + */ + ListGroupMembersRequest.prototype.pageToken = ""; + + /** + * ListGroupMembersRequest filter. + * @member {string} filter + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @instance + */ + ListGroupMembersRequest.prototype.filter = ""; + + /** + * ListGroupMembersRequest interval. + * @member {google.monitoring.v3.ITimeInterval|null|undefined} interval + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @instance + */ + ListGroupMembersRequest.prototype.interval = null; + + /** + * Creates a new ListGroupMembersRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {google.monitoring.v3.IListGroupMembersRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListGroupMembersRequest} ListGroupMembersRequest instance + */ + ListGroupMembersRequest.create = function create(properties) { + return new ListGroupMembersRequest(properties); + }; + + /** + * Encodes the specified ListGroupMembersRequest message. Does not implicitly {@link google.monitoring.v3.ListGroupMembersRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {google.monitoring.v3.IListGroupMembersRequest} message ListGroupMembersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGroupMembersRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.monitoring.v3.TimeInterval.encode(message.interval, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListGroupMembersRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListGroupMembersRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {google.monitoring.v3.IListGroupMembersRequest} message ListGroupMembersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGroupMembersRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGroupMembersRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListGroupMembersRequest} ListGroupMembersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGroupMembersRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListGroupMembersRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 7: { + message.name = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListGroupMembersRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListGroupMembersRequest} ListGroupMembersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGroupMembersRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGroupMembersRequest message. + * @function verify + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGroupMembersRequest.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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.interval != null && message.hasOwnProperty("interval")) { + var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval); + if (error) + return "interval." + error; + } + return null; + }; + + /** + * Creates a ListGroupMembersRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListGroupMembersRequest} ListGroupMembersRequest + */ + ListGroupMembersRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListGroupMembersRequest) + return object; + var message = new $root.google.monitoring.v3.ListGroupMembersRequest(); + 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); + if (object.filter != null) + message.filter = String(object.filter); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.monitoring.v3.ListGroupMembersRequest.interval: object expected"); + message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval); + } + return message; + }; + + /** + * Creates a plain object from a ListGroupMembersRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {google.monitoring.v3.ListGroupMembersRequest} message ListGroupMembersRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGroupMembersRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.interval = null; + object.name = ""; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.interval != null && message.hasOwnProperty("interval")) + object.interval = $root.google.monitoring.v3.TimeInterval.toObject(message.interval, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListGroupMembersRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @instance + * @returns {Object.} JSON object + */ + ListGroupMembersRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListGroupMembersRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListGroupMembersRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListGroupMembersRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListGroupMembersRequest"; + }; + + return ListGroupMembersRequest; + })(); + + v3.ListGroupMembersResponse = (function() { + + /** + * Properties of a ListGroupMembersResponse. + * @memberof google.monitoring.v3 + * @interface IListGroupMembersResponse + * @property {Array.|null} [members] ListGroupMembersResponse members + * @property {string|null} [nextPageToken] ListGroupMembersResponse nextPageToken + * @property {number|null} [totalSize] ListGroupMembersResponse totalSize + */ + + /** + * Constructs a new ListGroupMembersResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListGroupMembersResponse. + * @implements IListGroupMembersResponse + * @constructor + * @param {google.monitoring.v3.IListGroupMembersResponse=} [properties] Properties to set + */ + function ListGroupMembersResponse(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]]; + } + + /** + * ListGroupMembersResponse members. + * @member {Array.} members + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @instance + */ + ListGroupMembersResponse.prototype.members = $util.emptyArray; + + /** + * ListGroupMembersResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @instance + */ + ListGroupMembersResponse.prototype.nextPageToken = ""; + + /** + * ListGroupMembersResponse totalSize. + * @member {number} totalSize + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @instance + */ + ListGroupMembersResponse.prototype.totalSize = 0; + + /** + * Creates a new ListGroupMembersResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {google.monitoring.v3.IListGroupMembersResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListGroupMembersResponse} ListGroupMembersResponse instance + */ + ListGroupMembersResponse.create = function create(properties) { + return new ListGroupMembersResponse(properties); + }; + + /** + * Encodes the specified ListGroupMembersResponse message. Does not implicitly {@link google.monitoring.v3.ListGroupMembersResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {google.monitoring.v3.IListGroupMembersResponse} message ListGroupMembersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGroupMembersResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.members != null && message.members.length) + for (var i = 0; i < message.members.length; ++i) + $root.google.api.MonitoredResource.encode(message.members[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + return writer; + }; + + /** + * Encodes the specified ListGroupMembersResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListGroupMembersResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {google.monitoring.v3.IListGroupMembersResponse} message ListGroupMembersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListGroupMembersResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListGroupMembersResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListGroupMembersResponse} ListGroupMembersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGroupMembersResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListGroupMembersResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.members && message.members.length)) + message.members = []; + message.members.push($root.google.api.MonitoredResource.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + message.totalSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListGroupMembersResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListGroupMembersResponse} ListGroupMembersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListGroupMembersResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListGroupMembersResponse message. + * @function verify + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListGroupMembersResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object 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) { + var error = $root.google.api.MonitoredResource.verify(message.members[i]); + if (error) + return "members." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + return null; + }; + + /** + * Creates a ListGroupMembersResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListGroupMembersResponse} ListGroupMembersResponse + */ + ListGroupMembersResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListGroupMembersResponse) + return object; + var message = new $root.google.monitoring.v3.ListGroupMembersResponse(); + if (object.members) { + if (!Array.isArray(object.members)) + throw TypeError(".google.monitoring.v3.ListGroupMembersResponse.members: array expected"); + message.members = []; + for (var i = 0; i < object.members.length; ++i) { + if (typeof object.members[i] !== "object") + throw TypeError(".google.monitoring.v3.ListGroupMembersResponse.members: object expected"); + message.members[i] = $root.google.api.MonitoredResource.fromObject(object.members[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListGroupMembersResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {google.monitoring.v3.ListGroupMembersResponse} message ListGroupMembersResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListGroupMembersResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.members = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.members && message.members.length) { + object.members = []; + for (var j = 0; j < message.members.length; ++j) + object.members[j] = $root.google.api.MonitoredResource.toObject(message.members[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + return object; + }; + + /** + * Converts this ListGroupMembersResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @instance + * @returns {Object.} JSON object + */ + ListGroupMembersResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListGroupMembersResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListGroupMembersResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListGroupMembersResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListGroupMembersResponse"; + }; + + return ListGroupMembersResponse; + })(); + + v3.Point = (function() { + + /** + * Properties of a Point. + * @memberof google.monitoring.v3 + * @interface IPoint + * @property {google.monitoring.v3.ITimeInterval|null} [interval] Point interval + * @property {google.monitoring.v3.ITypedValue|null} [value] Point value + */ + + /** + * Constructs a new Point. + * @memberof google.monitoring.v3 + * @classdesc Represents a Point. + * @implements IPoint + * @constructor + * @param {google.monitoring.v3.IPoint=} [properties] Properties to set + */ + function Point(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]]; + } + + /** + * Point interval. + * @member {google.monitoring.v3.ITimeInterval|null|undefined} interval + * @memberof google.monitoring.v3.Point + * @instance + */ + Point.prototype.interval = null; + + /** + * Point value. + * @member {google.monitoring.v3.ITypedValue|null|undefined} value + * @memberof google.monitoring.v3.Point + * @instance + */ + Point.prototype.value = null; + + /** + * Creates a new Point instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Point + * @static + * @param {google.monitoring.v3.IPoint=} [properties] Properties to set + * @returns {google.monitoring.v3.Point} Point instance + */ + Point.create = function create(properties) { + return new Point(properties); + }; + + /** + * Encodes the specified Point message. Does not implicitly {@link google.monitoring.v3.Point.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Point + * @static + * @param {google.monitoring.v3.IPoint} message Point message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Point.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.monitoring.v3.TimeInterval.encode(message.interval, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + $root.google.monitoring.v3.TypedValue.encode(message.value, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Point message, length delimited. Does not implicitly {@link google.monitoring.v3.Point.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Point + * @static + * @param {google.monitoring.v3.IPoint} message Point message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Point.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Point message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Point + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Point} Point + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Point.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Point(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + break; + } + case 2: { + message.value = $root.google.monitoring.v3.TypedValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Point message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Point + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Point} Point + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Point.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Point message. + * @function verify + * @memberof google.monitoring.v3.Point + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Point.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.interval != null && message.hasOwnProperty("interval")) { + var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval); + if (error) + return "interval." + error; + } + if (message.value != null && message.hasOwnProperty("value")) { + var error = $root.google.monitoring.v3.TypedValue.verify(message.value); + if (error) + return "value." + error; + } + return null; + }; + + /** + * Creates a Point message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Point + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Point} Point + */ + Point.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Point) + return object; + var message = new $root.google.monitoring.v3.Point(); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.monitoring.v3.Point.interval: object expected"); + message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval); + } + if (object.value != null) { + if (typeof object.value !== "object") + throw TypeError(".google.monitoring.v3.Point.value: object expected"); + message.value = $root.google.monitoring.v3.TypedValue.fromObject(object.value); + } + return message; + }; + + /** + * Creates a plain object from a Point message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Point + * @static + * @param {google.monitoring.v3.Point} message Point + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Point.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.interval = null; + object.value = null; + } + if (message.interval != null && message.hasOwnProperty("interval")) + object.interval = $root.google.monitoring.v3.TimeInterval.toObject(message.interval, options); + if (message.value != null && message.hasOwnProperty("value")) + object.value = $root.google.monitoring.v3.TypedValue.toObject(message.value, options); + return object; + }; + + /** + * Converts this Point to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Point + * @instance + * @returns {Object.} JSON object + */ + Point.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Point + * @function getTypeUrl + * @memberof google.monitoring.v3.Point + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Point.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Point"; + }; + + return Point; + })(); + + v3.TimeSeries = (function() { + + /** + * Properties of a TimeSeries. + * @memberof google.monitoring.v3 + * @interface ITimeSeries + * @property {google.api.IMetric|null} [metric] TimeSeries metric + * @property {google.api.IMonitoredResource|null} [resource] TimeSeries resource + * @property {google.api.IMonitoredResourceMetadata|null} [metadata] TimeSeries metadata + * @property {google.api.MetricDescriptor.MetricKind|null} [metricKind] TimeSeries metricKind + * @property {google.api.MetricDescriptor.ValueType|null} [valueType] TimeSeries valueType + * @property {Array.|null} [points] TimeSeries points + * @property {string|null} [unit] TimeSeries unit + */ + + /** + * Constructs a new TimeSeries. + * @memberof google.monitoring.v3 + * @classdesc Represents a TimeSeries. + * @implements ITimeSeries + * @constructor + * @param {google.monitoring.v3.ITimeSeries=} [properties] Properties to set + */ + function TimeSeries(properties) { + this.points = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeSeries metric. + * @member {google.api.IMetric|null|undefined} metric + * @memberof google.monitoring.v3.TimeSeries + * @instance + */ + TimeSeries.prototype.metric = null; + + /** + * TimeSeries resource. + * @member {google.api.IMonitoredResource|null|undefined} resource + * @memberof google.monitoring.v3.TimeSeries + * @instance + */ + TimeSeries.prototype.resource = null; + + /** + * TimeSeries metadata. + * @member {google.api.IMonitoredResourceMetadata|null|undefined} metadata + * @memberof google.monitoring.v3.TimeSeries + * @instance + */ + TimeSeries.prototype.metadata = null; + + /** + * TimeSeries metricKind. + * @member {google.api.MetricDescriptor.MetricKind} metricKind + * @memberof google.monitoring.v3.TimeSeries + * @instance + */ + TimeSeries.prototype.metricKind = 0; + + /** + * TimeSeries valueType. + * @member {google.api.MetricDescriptor.ValueType} valueType + * @memberof google.monitoring.v3.TimeSeries + * @instance + */ + TimeSeries.prototype.valueType = 0; + + /** + * TimeSeries points. + * @member {Array.} points + * @memberof google.monitoring.v3.TimeSeries + * @instance + */ + TimeSeries.prototype.points = $util.emptyArray; + + /** + * TimeSeries unit. + * @member {string} unit + * @memberof google.monitoring.v3.TimeSeries + * @instance + */ + TimeSeries.prototype.unit = ""; + + /** + * Creates a new TimeSeries instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {google.monitoring.v3.ITimeSeries=} [properties] Properties to set + * @returns {google.monitoring.v3.TimeSeries} TimeSeries instance + */ + TimeSeries.create = function create(properties) { + return new TimeSeries(properties); + }; + + /** + * Encodes the specified TimeSeries message. Does not implicitly {@link google.monitoring.v3.TimeSeries.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {google.monitoring.v3.ITimeSeries} message TimeSeries message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeSeries.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metric != null && Object.hasOwnProperty.call(message, "metric")) + $root.google.api.Metric.encode(message.metric, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + $root.google.api.MonitoredResource.encode(message.resource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metricKind != null && Object.hasOwnProperty.call(message, "metricKind")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.metricKind); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.valueType); + if (message.points != null && message.points.length) + for (var i = 0; i < message.points.length; ++i) + $root.google.monitoring.v3.Point.encode(message.points[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.api.MonitoredResourceMetadata.encode(message.metadata, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.unit); + return writer; + }; + + /** + * Encodes the specified TimeSeries message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeries.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {google.monitoring.v3.ITimeSeries} message TimeSeries message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeSeries.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeSeries message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TimeSeries} TimeSeries + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeSeries.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeries(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.metric = $root.google.api.Metric.decode(reader, reader.uint32()); + break; + } + case 2: { + message.resource = $root.google.api.MonitoredResource.decode(reader, reader.uint32()); + break; + } + case 7: { + message.metadata = $root.google.api.MonitoredResourceMetadata.decode(reader, reader.uint32()); + break; + } + case 3: { + message.metricKind = reader.int32(); + break; + } + case 4: { + message.valueType = reader.int32(); + break; + } + case 5: { + if (!(message.points && message.points.length)) + message.points = []; + message.points.push($root.google.monitoring.v3.Point.decode(reader, reader.uint32())); + break; + } + case 8: { + message.unit = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeSeries message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TimeSeries} TimeSeries + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeSeries.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeSeries message. + * @function verify + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeSeries.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metric != null && message.hasOwnProperty("metric")) { + var error = $root.google.api.Metric.verify(message.metric); + if (error) + return "metric." + error; + } + if (message.resource != null && message.hasOwnProperty("resource")) { + var error = $root.google.api.MonitoredResource.verify(message.resource); + if (error) + return "resource." + error; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.api.MonitoredResourceMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.metricKind != null && message.hasOwnProperty("metricKind")) + switch (message.metricKind) { + default: + return "metricKind: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + switch (message.valueType) { + default: + return "valueType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.points != null && message.hasOwnProperty("points")) { + if (!Array.isArray(message.points)) + return "points: array expected"; + for (var i = 0; i < message.points.length; ++i) { + var error = $root.google.monitoring.v3.Point.verify(message.points[i]); + if (error) + return "points." + error; + } + } + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a TimeSeries message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TimeSeries} TimeSeries + */ + TimeSeries.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TimeSeries) + return object; + var message = new $root.google.monitoring.v3.TimeSeries(); + if (object.metric != null) { + if (typeof object.metric !== "object") + throw TypeError(".google.monitoring.v3.TimeSeries.metric: object expected"); + message.metric = $root.google.api.Metric.fromObject(object.metric); + } + if (object.resource != null) { + if (typeof object.resource !== "object") + throw TypeError(".google.monitoring.v3.TimeSeries.resource: object expected"); + message.resource = $root.google.api.MonitoredResource.fromObject(object.resource); + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.monitoring.v3.TimeSeries.metadata: object expected"); + message.metadata = $root.google.api.MonitoredResourceMetadata.fromObject(object.metadata); + } + switch (object.metricKind) { + default: + if (typeof object.metricKind === "number") { + message.metricKind = object.metricKind; + break; + } + break; + case "METRIC_KIND_UNSPECIFIED": + case 0: + message.metricKind = 0; + break; + case "GAUGE": + case 1: + message.metricKind = 1; + break; + case "DELTA": + case 2: + message.metricKind = 2; + break; + case "CUMULATIVE": + case 3: + message.metricKind = 3; + break; + } + switch (object.valueType) { + default: + if (typeof object.valueType === "number") { + message.valueType = object.valueType; + break; + } + break; + case "VALUE_TYPE_UNSPECIFIED": + case 0: + message.valueType = 0; + break; + case "BOOL": + case 1: + message.valueType = 1; + break; + case "INT64": + case 2: + message.valueType = 2; + break; + case "DOUBLE": + case 3: + message.valueType = 3; + break; + case "STRING": + case 4: + message.valueType = 4; + break; + case "DISTRIBUTION": + case 5: + message.valueType = 5; + break; + case "MONEY": + case 6: + message.valueType = 6; + break; + } + if (object.points) { + if (!Array.isArray(object.points)) + throw TypeError(".google.monitoring.v3.TimeSeries.points: array expected"); + message.points = []; + for (var i = 0; i < object.points.length; ++i) { + if (typeof object.points[i] !== "object") + throw TypeError(".google.monitoring.v3.TimeSeries.points: object expected"); + message.points[i] = $root.google.monitoring.v3.Point.fromObject(object.points[i]); + } + } + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a TimeSeries message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {google.monitoring.v3.TimeSeries} message TimeSeries + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeSeries.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.points = []; + if (options.defaults) { + object.metric = null; + object.resource = null; + object.metricKind = options.enums === String ? "METRIC_KIND_UNSPECIFIED" : 0; + object.valueType = options.enums === String ? "VALUE_TYPE_UNSPECIFIED" : 0; + object.metadata = null; + object.unit = ""; + } + if (message.metric != null && message.hasOwnProperty("metric")) + object.metric = $root.google.api.Metric.toObject(message.metric, options); + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = $root.google.api.MonitoredResource.toObject(message.resource, options); + if (message.metricKind != null && message.hasOwnProperty("metricKind")) + object.metricKind = options.enums === String ? $root.google.api.MetricDescriptor.MetricKind[message.metricKind] === undefined ? message.metricKind : $root.google.api.MetricDescriptor.MetricKind[message.metricKind] : message.metricKind; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = options.enums === String ? $root.google.api.MetricDescriptor.ValueType[message.valueType] === undefined ? message.valueType : $root.google.api.MetricDescriptor.ValueType[message.valueType] : message.valueType; + if (message.points && message.points.length) { + object.points = []; + for (var j = 0; j < message.points.length; ++j) + object.points[j] = $root.google.monitoring.v3.Point.toObject(message.points[j], options); + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.api.MonitoredResourceMetadata.toObject(message.metadata, options); + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this TimeSeries to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TimeSeries + * @instance + * @returns {Object.} JSON object + */ + TimeSeries.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TimeSeries + * @function getTypeUrl + * @memberof google.monitoring.v3.TimeSeries + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeSeries.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TimeSeries"; + }; + + return TimeSeries; + })(); + + v3.TimeSeriesDescriptor = (function() { + + /** + * Properties of a TimeSeriesDescriptor. + * @memberof google.monitoring.v3 + * @interface ITimeSeriesDescriptor + * @property {Array.|null} [labelDescriptors] TimeSeriesDescriptor labelDescriptors + * @property {Array.|null} [pointDescriptors] TimeSeriesDescriptor pointDescriptors + */ + + /** + * Constructs a new TimeSeriesDescriptor. + * @memberof google.monitoring.v3 + * @classdesc Represents a TimeSeriesDescriptor. + * @implements ITimeSeriesDescriptor + * @constructor + * @param {google.monitoring.v3.ITimeSeriesDescriptor=} [properties] Properties to set + */ + function TimeSeriesDescriptor(properties) { + this.labelDescriptors = []; + this.pointDescriptors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeSeriesDescriptor labelDescriptors. + * @member {Array.} labelDescriptors + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @instance + */ + TimeSeriesDescriptor.prototype.labelDescriptors = $util.emptyArray; + + /** + * TimeSeriesDescriptor pointDescriptors. + * @member {Array.} pointDescriptors + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @instance + */ + TimeSeriesDescriptor.prototype.pointDescriptors = $util.emptyArray; + + /** + * Creates a new TimeSeriesDescriptor instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {google.monitoring.v3.ITimeSeriesDescriptor=} [properties] Properties to set + * @returns {google.monitoring.v3.TimeSeriesDescriptor} TimeSeriesDescriptor instance + */ + TimeSeriesDescriptor.create = function create(properties) { + return new TimeSeriesDescriptor(properties); + }; + + /** + * Encodes the specified TimeSeriesDescriptor message. Does not implicitly {@link google.monitoring.v3.TimeSeriesDescriptor.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {google.monitoring.v3.ITimeSeriesDescriptor} message TimeSeriesDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeSeriesDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.labelDescriptors != null && message.labelDescriptors.length) + for (var i = 0; i < message.labelDescriptors.length; ++i) + $root.google.api.LabelDescriptor.encode(message.labelDescriptors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pointDescriptors != null && message.pointDescriptors.length) + for (var i = 0; i < message.pointDescriptors.length; ++i) + $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.encode(message.pointDescriptors[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TimeSeriesDescriptor message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {google.monitoring.v3.ITimeSeriesDescriptor} message TimeSeriesDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeSeriesDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeSeriesDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TimeSeriesDescriptor} TimeSeriesDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeSeriesDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.labelDescriptors && message.labelDescriptors.length)) + message.labelDescriptors = []; + message.labelDescriptors.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.pointDescriptors && message.pointDescriptors.length)) + message.pointDescriptors = []; + message.pointDescriptors.push($root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeSeriesDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TimeSeriesDescriptor} TimeSeriesDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeSeriesDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeSeriesDescriptor message. + * @function verify + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeSeriesDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.labelDescriptors != null && message.hasOwnProperty("labelDescriptors")) { + if (!Array.isArray(message.labelDescriptors)) + return "labelDescriptors: array expected"; + for (var i = 0; i < message.labelDescriptors.length; ++i) { + var error = $root.google.api.LabelDescriptor.verify(message.labelDescriptors[i]); + if (error) + return "labelDescriptors." + error; + } + } + if (message.pointDescriptors != null && message.hasOwnProperty("pointDescriptors")) { + if (!Array.isArray(message.pointDescriptors)) + return "pointDescriptors: array expected"; + for (var i = 0; i < message.pointDescriptors.length; ++i) { + var error = $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.verify(message.pointDescriptors[i]); + if (error) + return "pointDescriptors." + error; + } + } + return null; + }; + + /** + * Creates a TimeSeriesDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TimeSeriesDescriptor} TimeSeriesDescriptor + */ + TimeSeriesDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TimeSeriesDescriptor) + return object; + var message = new $root.google.monitoring.v3.TimeSeriesDescriptor(); + if (object.labelDescriptors) { + if (!Array.isArray(object.labelDescriptors)) + throw TypeError(".google.monitoring.v3.TimeSeriesDescriptor.labelDescriptors: array expected"); + message.labelDescriptors = []; + for (var i = 0; i < object.labelDescriptors.length; ++i) { + if (typeof object.labelDescriptors[i] !== "object") + throw TypeError(".google.monitoring.v3.TimeSeriesDescriptor.labelDescriptors: object expected"); + message.labelDescriptors[i] = $root.google.api.LabelDescriptor.fromObject(object.labelDescriptors[i]); + } + } + if (object.pointDescriptors) { + if (!Array.isArray(object.pointDescriptors)) + throw TypeError(".google.monitoring.v3.TimeSeriesDescriptor.pointDescriptors: array expected"); + message.pointDescriptors = []; + for (var i = 0; i < object.pointDescriptors.length; ++i) { + if (typeof object.pointDescriptors[i] !== "object") + throw TypeError(".google.monitoring.v3.TimeSeriesDescriptor.pointDescriptors: object expected"); + message.pointDescriptors[i] = $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.fromObject(object.pointDescriptors[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TimeSeriesDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {google.monitoring.v3.TimeSeriesDescriptor} message TimeSeriesDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeSeriesDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.labelDescriptors = []; + object.pointDescriptors = []; + } + if (message.labelDescriptors && message.labelDescriptors.length) { + object.labelDescriptors = []; + for (var j = 0; j < message.labelDescriptors.length; ++j) + object.labelDescriptors[j] = $root.google.api.LabelDescriptor.toObject(message.labelDescriptors[j], options); + } + if (message.pointDescriptors && message.pointDescriptors.length) { + object.pointDescriptors = []; + for (var j = 0; j < message.pointDescriptors.length; ++j) + object.pointDescriptors[j] = $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.toObject(message.pointDescriptors[j], options); + } + return object; + }; + + /** + * Converts this TimeSeriesDescriptor to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @instance + * @returns {Object.} JSON object + */ + TimeSeriesDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TimeSeriesDescriptor + * @function getTypeUrl + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeSeriesDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TimeSeriesDescriptor"; + }; + + TimeSeriesDescriptor.ValueDescriptor = (function() { + + /** + * Properties of a ValueDescriptor. + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @interface IValueDescriptor + * @property {string|null} [key] ValueDescriptor key + * @property {google.api.MetricDescriptor.ValueType|null} [valueType] ValueDescriptor valueType + * @property {google.api.MetricDescriptor.MetricKind|null} [metricKind] ValueDescriptor metricKind + * @property {string|null} [unit] ValueDescriptor unit + */ + + /** + * Constructs a new ValueDescriptor. + * @memberof google.monitoring.v3.TimeSeriesDescriptor + * @classdesc Represents a ValueDescriptor. + * @implements IValueDescriptor + * @constructor + * @param {google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor=} [properties] Properties to set + */ + function ValueDescriptor(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]]; + } + + /** + * ValueDescriptor key. + * @member {string} key + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @instance + */ + ValueDescriptor.prototype.key = ""; + + /** + * ValueDescriptor valueType. + * @member {google.api.MetricDescriptor.ValueType} valueType + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @instance + */ + ValueDescriptor.prototype.valueType = 0; + + /** + * ValueDescriptor metricKind. + * @member {google.api.MetricDescriptor.MetricKind} metricKind + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @instance + */ + ValueDescriptor.prototype.metricKind = 0; + + /** + * ValueDescriptor unit. + * @member {string} unit + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @instance + */ + ValueDescriptor.prototype.unit = ""; + + /** + * Creates a new ValueDescriptor instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor=} [properties] Properties to set + * @returns {google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor} ValueDescriptor instance + */ + ValueDescriptor.create = function create(properties) { + return new ValueDescriptor(properties); + }; + + /** + * Encodes the specified ValueDescriptor message. Does not implicitly {@link google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor} message ValueDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValueDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.valueType); + if (message.metricKind != null && Object.hasOwnProperty.call(message, "metricKind")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.metricKind); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.unit); + return writer; + }; + + /** + * Encodes the specified ValueDescriptor message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {google.monitoring.v3.TimeSeriesDescriptor.IValueDescriptor} message ValueDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValueDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValueDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor} ValueDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValueDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.valueType = reader.int32(); + break; + } + case 3: { + message.metricKind = reader.int32(); + break; + } + case 4: { + message.unit = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValueDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor} ValueDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValueDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValueDescriptor message. + * @function verify + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValueDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.valueType != null && message.hasOwnProperty("valueType")) + switch (message.valueType) { + default: + return "valueType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.metricKind != null && message.hasOwnProperty("metricKind")) + switch (message.metricKind) { + default: + return "metricKind: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a ValueDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor} ValueDescriptor + */ + ValueDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor) + return object; + var message = new $root.google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor(); + if (object.key != null) + message.key = String(object.key); + switch (object.valueType) { + default: + if (typeof object.valueType === "number") { + message.valueType = object.valueType; + break; + } + break; + case "VALUE_TYPE_UNSPECIFIED": + case 0: + message.valueType = 0; + break; + case "BOOL": + case 1: + message.valueType = 1; + break; + case "INT64": + case 2: + message.valueType = 2; + break; + case "DOUBLE": + case 3: + message.valueType = 3; + break; + case "STRING": + case 4: + message.valueType = 4; + break; + case "DISTRIBUTION": + case 5: + message.valueType = 5; + break; + case "MONEY": + case 6: + message.valueType = 6; + break; + } + switch (object.metricKind) { + default: + if (typeof object.metricKind === "number") { + message.metricKind = object.metricKind; + break; + } + break; + case "METRIC_KIND_UNSPECIFIED": + case 0: + message.metricKind = 0; + break; + case "GAUGE": + case 1: + message.metricKind = 1; + break; + case "DELTA": + case 2: + message.metricKind = 2; + break; + case "CUMULATIVE": + case 3: + message.metricKind = 3; + break; + } + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a ValueDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor} message ValueDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValueDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = ""; + object.valueType = options.enums === String ? "VALUE_TYPE_UNSPECIFIED" : 0; + object.metricKind = options.enums === String ? "METRIC_KIND_UNSPECIFIED" : 0; + object.unit = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = options.enums === String ? $root.google.api.MetricDescriptor.ValueType[message.valueType] === undefined ? message.valueType : $root.google.api.MetricDescriptor.ValueType[message.valueType] : message.valueType; + if (message.metricKind != null && message.hasOwnProperty("metricKind")) + object.metricKind = options.enums === String ? $root.google.api.MetricDescriptor.MetricKind[message.metricKind] === undefined ? message.metricKind : $root.google.api.MetricDescriptor.MetricKind[message.metricKind] : message.metricKind; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this ValueDescriptor to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @instance + * @returns {Object.} JSON object + */ + ValueDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ValueDescriptor + * @function getTypeUrl + * @memberof google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ValueDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TimeSeriesDescriptor.ValueDescriptor"; + }; + + return ValueDescriptor; + })(); + + return TimeSeriesDescriptor; + })(); + + v3.TimeSeriesData = (function() { + + /** + * Properties of a TimeSeriesData. + * @memberof google.monitoring.v3 + * @interface ITimeSeriesData + * @property {Array.|null} [labelValues] TimeSeriesData labelValues + * @property {Array.|null} [pointData] TimeSeriesData pointData + */ + + /** + * Constructs a new TimeSeriesData. + * @memberof google.monitoring.v3 + * @classdesc Represents a TimeSeriesData. + * @implements ITimeSeriesData + * @constructor + * @param {google.monitoring.v3.ITimeSeriesData=} [properties] Properties to set + */ + function TimeSeriesData(properties) { + this.labelValues = []; + this.pointData = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TimeSeriesData labelValues. + * @member {Array.} labelValues + * @memberof google.monitoring.v3.TimeSeriesData + * @instance + */ + TimeSeriesData.prototype.labelValues = $util.emptyArray; + + /** + * TimeSeriesData pointData. + * @member {Array.} pointData + * @memberof google.monitoring.v3.TimeSeriesData + * @instance + */ + TimeSeriesData.prototype.pointData = $util.emptyArray; + + /** + * Creates a new TimeSeriesData instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {google.monitoring.v3.ITimeSeriesData=} [properties] Properties to set + * @returns {google.monitoring.v3.TimeSeriesData} TimeSeriesData instance + */ + TimeSeriesData.create = function create(properties) { + return new TimeSeriesData(properties); + }; + + /** + * Encodes the specified TimeSeriesData message. Does not implicitly {@link google.monitoring.v3.TimeSeriesData.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {google.monitoring.v3.ITimeSeriesData} message TimeSeriesData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeSeriesData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.labelValues != null && message.labelValues.length) + for (var i = 0; i < message.labelValues.length; ++i) + $root.google.monitoring.v3.LabelValue.encode(message.labelValues[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pointData != null && message.pointData.length) + for (var i = 0; i < message.pointData.length; ++i) + $root.google.monitoring.v3.TimeSeriesData.PointData.encode(message.pointData[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TimeSeriesData message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {google.monitoring.v3.ITimeSeriesData} message TimeSeriesData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeSeriesData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeSeriesData message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TimeSeriesData} TimeSeriesData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeSeriesData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.labelValues && message.labelValues.length)) + message.labelValues = []; + message.labelValues.push($root.google.monitoring.v3.LabelValue.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.pointData && message.pointData.length)) + message.pointData = []; + message.pointData.push($root.google.monitoring.v3.TimeSeriesData.PointData.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeSeriesData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TimeSeriesData} TimeSeriesData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeSeriesData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeSeriesData message. + * @function verify + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeSeriesData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.labelValues != null && message.hasOwnProperty("labelValues")) { + if (!Array.isArray(message.labelValues)) + return "labelValues: array expected"; + for (var i = 0; i < message.labelValues.length; ++i) { + var error = $root.google.monitoring.v3.LabelValue.verify(message.labelValues[i]); + if (error) + return "labelValues." + error; + } + } + if (message.pointData != null && message.hasOwnProperty("pointData")) { + if (!Array.isArray(message.pointData)) + return "pointData: array expected"; + for (var i = 0; i < message.pointData.length; ++i) { + var error = $root.google.monitoring.v3.TimeSeriesData.PointData.verify(message.pointData[i]); + if (error) + return "pointData." + error; + } + } + return null; + }; + + /** + * Creates a TimeSeriesData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TimeSeriesData} TimeSeriesData + */ + TimeSeriesData.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TimeSeriesData) + return object; + var message = new $root.google.monitoring.v3.TimeSeriesData(); + if (object.labelValues) { + if (!Array.isArray(object.labelValues)) + throw TypeError(".google.monitoring.v3.TimeSeriesData.labelValues: array expected"); + message.labelValues = []; + for (var i = 0; i < object.labelValues.length; ++i) { + if (typeof object.labelValues[i] !== "object") + throw TypeError(".google.monitoring.v3.TimeSeriesData.labelValues: object expected"); + message.labelValues[i] = $root.google.monitoring.v3.LabelValue.fromObject(object.labelValues[i]); + } + } + if (object.pointData) { + if (!Array.isArray(object.pointData)) + throw TypeError(".google.monitoring.v3.TimeSeriesData.pointData: array expected"); + message.pointData = []; + for (var i = 0; i < object.pointData.length; ++i) { + if (typeof object.pointData[i] !== "object") + throw TypeError(".google.monitoring.v3.TimeSeriesData.pointData: object expected"); + message.pointData[i] = $root.google.monitoring.v3.TimeSeriesData.PointData.fromObject(object.pointData[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TimeSeriesData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {google.monitoring.v3.TimeSeriesData} message TimeSeriesData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeSeriesData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.labelValues = []; + object.pointData = []; + } + if (message.labelValues && message.labelValues.length) { + object.labelValues = []; + for (var j = 0; j < message.labelValues.length; ++j) + object.labelValues[j] = $root.google.monitoring.v3.LabelValue.toObject(message.labelValues[j], options); + } + if (message.pointData && message.pointData.length) { + object.pointData = []; + for (var j = 0; j < message.pointData.length; ++j) + object.pointData[j] = $root.google.monitoring.v3.TimeSeriesData.PointData.toObject(message.pointData[j], options); + } + return object; + }; + + /** + * Converts this TimeSeriesData to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TimeSeriesData + * @instance + * @returns {Object.} JSON object + */ + TimeSeriesData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TimeSeriesData + * @function getTypeUrl + * @memberof google.monitoring.v3.TimeSeriesData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeSeriesData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TimeSeriesData"; + }; + + TimeSeriesData.PointData = (function() { + + /** + * Properties of a PointData. + * @memberof google.monitoring.v3.TimeSeriesData + * @interface IPointData + * @property {Array.|null} [values] PointData values + * @property {google.monitoring.v3.ITimeInterval|null} [timeInterval] PointData timeInterval + */ + + /** + * Constructs a new PointData. + * @memberof google.monitoring.v3.TimeSeriesData + * @classdesc Represents a PointData. + * @implements IPointData + * @constructor + * @param {google.monitoring.v3.TimeSeriesData.IPointData=} [properties] Properties to set + */ + function PointData(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PointData values. + * @member {Array.} values + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @instance + */ + PointData.prototype.values = $util.emptyArray; + + /** + * PointData timeInterval. + * @member {google.monitoring.v3.ITimeInterval|null|undefined} timeInterval + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @instance + */ + PointData.prototype.timeInterval = null; + + /** + * Creates a new PointData instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {google.monitoring.v3.TimeSeriesData.IPointData=} [properties] Properties to set + * @returns {google.monitoring.v3.TimeSeriesData.PointData} PointData instance + */ + PointData.create = function create(properties) { + return new PointData(properties); + }; + + /** + * Encodes the specified PointData message. Does not implicitly {@link google.monitoring.v3.TimeSeriesData.PointData.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {google.monitoring.v3.TimeSeriesData.IPointData} message PointData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PointData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.monitoring.v3.TypedValue.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.timeInterval != null && Object.hasOwnProperty.call(message, "timeInterval")) + $root.google.monitoring.v3.TimeInterval.encode(message.timeInterval, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PointData message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesData.PointData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {google.monitoring.v3.TimeSeriesData.IPointData} message PointData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PointData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PointData message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TimeSeriesData.PointData} PointData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PointData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesData.PointData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.monitoring.v3.TypedValue.decode(reader, reader.uint32())); + break; + } + case 2: { + message.timeInterval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PointData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TimeSeriesData.PointData} PointData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PointData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PointData message. + * @function verify + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PointData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.monitoring.v3.TypedValue.verify(message.values[i]); + if (error) + return "values." + error; + } + } + if (message.timeInterval != null && message.hasOwnProperty("timeInterval")) { + var error = $root.google.monitoring.v3.TimeInterval.verify(message.timeInterval); + if (error) + return "timeInterval." + error; + } + return null; + }; + + /** + * Creates a PointData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TimeSeriesData.PointData} PointData + */ + PointData.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TimeSeriesData.PointData) + return object; + var message = new $root.google.monitoring.v3.TimeSeriesData.PointData(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.monitoring.v3.TimeSeriesData.PointData.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.monitoring.v3.TimeSeriesData.PointData.values: object expected"); + message.values[i] = $root.google.monitoring.v3.TypedValue.fromObject(object.values[i]); + } + } + if (object.timeInterval != null) { + if (typeof object.timeInterval !== "object") + throw TypeError(".google.monitoring.v3.TimeSeriesData.PointData.timeInterval: object expected"); + message.timeInterval = $root.google.monitoring.v3.TimeInterval.fromObject(object.timeInterval); + } + return message; + }; + + /** + * Creates a plain object from a PointData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {google.monitoring.v3.TimeSeriesData.PointData} message PointData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PointData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (options.defaults) + object.timeInterval = null; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.monitoring.v3.TypedValue.toObject(message.values[j], options); + } + if (message.timeInterval != null && message.hasOwnProperty("timeInterval")) + object.timeInterval = $root.google.monitoring.v3.TimeInterval.toObject(message.timeInterval, options); + return object; + }; + + /** + * Converts this PointData to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @instance + * @returns {Object.} JSON object + */ + PointData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PointData + * @function getTypeUrl + * @memberof google.monitoring.v3.TimeSeriesData.PointData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PointData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TimeSeriesData.PointData"; + }; + + return PointData; + })(); + + return TimeSeriesData; + })(); + + v3.LabelValue = (function() { + + /** + * Properties of a LabelValue. + * @memberof google.monitoring.v3 + * @interface ILabelValue + * @property {boolean|null} [boolValue] LabelValue boolValue + * @property {number|Long|null} [int64Value] LabelValue int64Value + * @property {string|null} [stringValue] LabelValue stringValue + */ + + /** + * Constructs a new LabelValue. + * @memberof google.monitoring.v3 + * @classdesc Represents a LabelValue. + * @implements ILabelValue + * @constructor + * @param {google.monitoring.v3.ILabelValue=} [properties] Properties to set + */ + function LabelValue(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]]; + } + + /** + * LabelValue boolValue. + * @member {boolean|null|undefined} boolValue + * @memberof google.monitoring.v3.LabelValue + * @instance + */ + LabelValue.prototype.boolValue = null; + + /** + * LabelValue int64Value. + * @member {number|Long|null|undefined} int64Value + * @memberof google.monitoring.v3.LabelValue + * @instance + */ + LabelValue.prototype.int64Value = null; + + /** + * LabelValue stringValue. + * @member {string|null|undefined} stringValue + * @memberof google.monitoring.v3.LabelValue + * @instance + */ + LabelValue.prototype.stringValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * LabelValue value. + * @member {"boolValue"|"int64Value"|"stringValue"|undefined} value + * @memberof google.monitoring.v3.LabelValue + * @instance + */ + Object.defineProperty(LabelValue.prototype, "value", { + get: $util.oneOfGetter($oneOfFields = ["boolValue", "int64Value", "stringValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new LabelValue instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {google.monitoring.v3.ILabelValue=} [properties] Properties to set + * @returns {google.monitoring.v3.LabelValue} LabelValue instance + */ + LabelValue.create = function create(properties) { + return new LabelValue(properties); + }; + + /** + * Encodes the specified LabelValue message. Does not implicitly {@link google.monitoring.v3.LabelValue.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {google.monitoring.v3.ILabelValue} message LabelValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.boolValue); + if (message.int64Value != null && Object.hasOwnProperty.call(message, "int64Value")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.int64Value); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.stringValue); + return writer; + }; + + /** + * Encodes the specified LabelValue message, length delimited. Does not implicitly {@link google.monitoring.v3.LabelValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {google.monitoring.v3.ILabelValue} message LabelValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LabelValue message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.LabelValue} LabelValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelValue.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.LabelValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.boolValue = reader.bool(); + break; + } + case 2: { + message.int64Value = reader.int64(); + break; + } + case 3: { + message.stringValue = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LabelValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.LabelValue} LabelValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LabelValue message. + * @function verify + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LabelValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + properties.value = 1; + if (typeof message.boolValue !== "boolean") + return "boolValue: boolean expected"; + } + if (message.int64Value != null && message.hasOwnProperty("int64Value")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + if (!$util.isInteger(message.int64Value) && !(message.int64Value && $util.isInteger(message.int64Value.low) && $util.isInteger(message.int64Value.high))) + return "int64Value: integer|Long expected"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + if (properties.value === 1) + return "value: multiple values"; + properties.value = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + return null; + }; + + /** + * Creates a LabelValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.LabelValue} LabelValue + */ + LabelValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.LabelValue) + return object; + var message = new $root.google.monitoring.v3.LabelValue(); + if (object.boolValue != null) + message.boolValue = Boolean(object.boolValue); + if (object.int64Value != null) + if ($util.Long) + (message.int64Value = $util.Long.fromValue(object.int64Value)).unsigned = false; + else if (typeof object.int64Value === "string") + message.int64Value = parseInt(object.int64Value, 10); + else if (typeof object.int64Value === "number") + message.int64Value = object.int64Value; + else if (typeof object.int64Value === "object") + message.int64Value = new $util.LongBits(object.int64Value.low >>> 0, object.int64Value.high >>> 0).toNumber(); + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + return message; + }; + + /** + * Creates a plain object from a LabelValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {google.monitoring.v3.LabelValue} message LabelValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LabelValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + object.boolValue = message.boolValue; + if (options.oneofs) + object.value = "boolValue"; + } + if (message.int64Value != null && message.hasOwnProperty("int64Value")) { + if (typeof message.int64Value === "number") + object.int64Value = options.longs === String ? String(message.int64Value) : message.int64Value; + else + object.int64Value = options.longs === String ? $util.Long.prototype.toString.call(message.int64Value) : options.longs === Number ? new $util.LongBits(message.int64Value.low >>> 0, message.int64Value.high >>> 0).toNumber() : message.int64Value; + if (options.oneofs) + object.value = "int64Value"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.value = "stringValue"; + } + return object; + }; + + /** + * Converts this LabelValue to JSON. + * @function toJSON + * @memberof google.monitoring.v3.LabelValue + * @instance + * @returns {Object.} JSON object + */ + LabelValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LabelValue + * @function getTypeUrl + * @memberof google.monitoring.v3.LabelValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LabelValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.LabelValue"; + }; + + return LabelValue; + })(); + + v3.QueryError = (function() { + + /** + * Properties of a QueryError. + * @memberof google.monitoring.v3 + * @interface IQueryError + * @property {google.monitoring.v3.ITextLocator|null} [locator] QueryError locator + * @property {string|null} [message] QueryError message + */ + + /** + * Constructs a new QueryError. + * @memberof google.monitoring.v3 + * @classdesc Represents a QueryError. + * @implements IQueryError + * @constructor + * @param {google.monitoring.v3.IQueryError=} [properties] Properties to set + */ + function QueryError(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]]; + } + + /** + * QueryError locator. + * @member {google.monitoring.v3.ITextLocator|null|undefined} locator + * @memberof google.monitoring.v3.QueryError + * @instance + */ + QueryError.prototype.locator = null; + + /** + * QueryError message. + * @member {string} message + * @memberof google.monitoring.v3.QueryError + * @instance + */ + QueryError.prototype.message = ""; + + /** + * Creates a new QueryError instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.QueryError + * @static + * @param {google.monitoring.v3.IQueryError=} [properties] Properties to set + * @returns {google.monitoring.v3.QueryError} QueryError instance + */ + QueryError.create = function create(properties) { + return new QueryError(properties); + }; + + /** + * Encodes the specified QueryError message. Does not implicitly {@link google.monitoring.v3.QueryError.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.QueryError + * @static + * @param {google.monitoring.v3.IQueryError} message QueryError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locator != null && Object.hasOwnProperty.call(message, "locator")) + $root.google.monitoring.v3.TextLocator.encode(message.locator, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + return writer; + }; + + /** + * Encodes the specified QueryError message, length delimited. Does not implicitly {@link google.monitoring.v3.QueryError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.QueryError + * @static + * @param {google.monitoring.v3.IQueryError} message QueryError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryError message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.QueryError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.QueryError} QueryError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryError.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.QueryError(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.locator = $root.google.monitoring.v3.TextLocator.decode(reader, reader.uint32()); + break; + } + case 2: { + message.message = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.QueryError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.QueryError} QueryError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryError message. + * @function verify + * @memberof google.monitoring.v3.QueryError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locator != null && message.hasOwnProperty("locator")) { + var error = $root.google.monitoring.v3.TextLocator.verify(message.locator); + if (error) + return "locator." + error; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a QueryError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.QueryError + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.QueryError} QueryError + */ + QueryError.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.QueryError) + return object; + var message = new $root.google.monitoring.v3.QueryError(); + if (object.locator != null) { + if (typeof object.locator !== "object") + throw TypeError(".google.monitoring.v3.QueryError.locator: object expected"); + message.locator = $root.google.monitoring.v3.TextLocator.fromObject(object.locator); + } + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a QueryError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.QueryError + * @static + * @param {google.monitoring.v3.QueryError} message QueryError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.locator = null; + object.message = ""; + } + if (message.locator != null && message.hasOwnProperty("locator")) + object.locator = $root.google.monitoring.v3.TextLocator.toObject(message.locator, options); + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this QueryError to JSON. + * @function toJSON + * @memberof google.monitoring.v3.QueryError + * @instance + * @returns {Object.} JSON object + */ + QueryError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryError + * @function getTypeUrl + * @memberof google.monitoring.v3.QueryError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.QueryError"; + }; + + return QueryError; + })(); + + v3.TextLocator = (function() { + + /** + * Properties of a TextLocator. + * @memberof google.monitoring.v3 + * @interface ITextLocator + * @property {string|null} [source] TextLocator source + * @property {google.monitoring.v3.TextLocator.IPosition|null} [startPosition] TextLocator startPosition + * @property {google.monitoring.v3.TextLocator.IPosition|null} [endPosition] TextLocator endPosition + * @property {google.monitoring.v3.ITextLocator|null} [nestedLocator] TextLocator nestedLocator + * @property {string|null} [nestingReason] TextLocator nestingReason + */ + + /** + * Constructs a new TextLocator. + * @memberof google.monitoring.v3 + * @classdesc Represents a TextLocator. + * @implements ITextLocator + * @constructor + * @param {google.monitoring.v3.ITextLocator=} [properties] Properties to set + */ + function TextLocator(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]]; + } + + /** + * TextLocator source. + * @member {string} source + * @memberof google.monitoring.v3.TextLocator + * @instance + */ + TextLocator.prototype.source = ""; + + /** + * TextLocator startPosition. + * @member {google.monitoring.v3.TextLocator.IPosition|null|undefined} startPosition + * @memberof google.monitoring.v3.TextLocator + * @instance + */ + TextLocator.prototype.startPosition = null; + + /** + * TextLocator endPosition. + * @member {google.monitoring.v3.TextLocator.IPosition|null|undefined} endPosition + * @memberof google.monitoring.v3.TextLocator + * @instance + */ + TextLocator.prototype.endPosition = null; + + /** + * TextLocator nestedLocator. + * @member {google.monitoring.v3.ITextLocator|null|undefined} nestedLocator + * @memberof google.monitoring.v3.TextLocator + * @instance + */ + TextLocator.prototype.nestedLocator = null; + + /** + * TextLocator nestingReason. + * @member {string} nestingReason + * @memberof google.monitoring.v3.TextLocator + * @instance + */ + TextLocator.prototype.nestingReason = ""; + + /** + * Creates a new TextLocator instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {google.monitoring.v3.ITextLocator=} [properties] Properties to set + * @returns {google.monitoring.v3.TextLocator} TextLocator instance + */ + TextLocator.create = function create(properties) { + return new TextLocator(properties); + }; + + /** + * Encodes the specified TextLocator message. Does not implicitly {@link google.monitoring.v3.TextLocator.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {google.monitoring.v3.ITextLocator} message TextLocator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextLocator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.source); + if (message.startPosition != null && Object.hasOwnProperty.call(message, "startPosition")) + $root.google.monitoring.v3.TextLocator.Position.encode(message.startPosition, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endPosition != null && Object.hasOwnProperty.call(message, "endPosition")) + $root.google.monitoring.v3.TextLocator.Position.encode(message.endPosition, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.nestedLocator != null && Object.hasOwnProperty.call(message, "nestedLocator")) + $root.google.monitoring.v3.TextLocator.encode(message.nestedLocator, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.nestingReason != null && Object.hasOwnProperty.call(message, "nestingReason")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.nestingReason); + return writer; + }; + + /** + * Encodes the specified TextLocator message, length delimited. Does not implicitly {@link google.monitoring.v3.TextLocator.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {google.monitoring.v3.ITextLocator} message TextLocator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextLocator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextLocator message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TextLocator} TextLocator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextLocator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TextLocator(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.source = reader.string(); + break; + } + case 2: { + message.startPosition = $root.google.monitoring.v3.TextLocator.Position.decode(reader, reader.uint32()); + break; + } + case 3: { + message.endPosition = $root.google.monitoring.v3.TextLocator.Position.decode(reader, reader.uint32()); + break; + } + case 4: { + message.nestedLocator = $root.google.monitoring.v3.TextLocator.decode(reader, reader.uint32()); + break; + } + case 5: { + message.nestingReason = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextLocator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TextLocator} TextLocator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextLocator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextLocator message. + * @function verify + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextLocator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.startPosition != null && message.hasOwnProperty("startPosition")) { + var error = $root.google.monitoring.v3.TextLocator.Position.verify(message.startPosition); + if (error) + return "startPosition." + error; + } + if (message.endPosition != null && message.hasOwnProperty("endPosition")) { + var error = $root.google.monitoring.v3.TextLocator.Position.verify(message.endPosition); + if (error) + return "endPosition." + error; + } + if (message.nestedLocator != null && message.hasOwnProperty("nestedLocator")) { + var error = $root.google.monitoring.v3.TextLocator.verify(message.nestedLocator); + if (error) + return "nestedLocator." + error; + } + if (message.nestingReason != null && message.hasOwnProperty("nestingReason")) + if (!$util.isString(message.nestingReason)) + return "nestingReason: string expected"; + return null; + }; + + /** + * Creates a TextLocator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TextLocator} TextLocator + */ + TextLocator.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TextLocator) + return object; + var message = new $root.google.monitoring.v3.TextLocator(); + if (object.source != null) + message.source = String(object.source); + if (object.startPosition != null) { + if (typeof object.startPosition !== "object") + throw TypeError(".google.monitoring.v3.TextLocator.startPosition: object expected"); + message.startPosition = $root.google.monitoring.v3.TextLocator.Position.fromObject(object.startPosition); + } + if (object.endPosition != null) { + if (typeof object.endPosition !== "object") + throw TypeError(".google.monitoring.v3.TextLocator.endPosition: object expected"); + message.endPosition = $root.google.monitoring.v3.TextLocator.Position.fromObject(object.endPosition); + } + if (object.nestedLocator != null) { + if (typeof object.nestedLocator !== "object") + throw TypeError(".google.monitoring.v3.TextLocator.nestedLocator: object expected"); + message.nestedLocator = $root.google.monitoring.v3.TextLocator.fromObject(object.nestedLocator); + } + if (object.nestingReason != null) + message.nestingReason = String(object.nestingReason); + return message; + }; + + /** + * Creates a plain object from a TextLocator message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {google.monitoring.v3.TextLocator} message TextLocator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextLocator.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.source = ""; + object.startPosition = null; + object.endPosition = null; + object.nestedLocator = null; + object.nestingReason = ""; + } + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + if (message.startPosition != null && message.hasOwnProperty("startPosition")) + object.startPosition = $root.google.monitoring.v3.TextLocator.Position.toObject(message.startPosition, options); + if (message.endPosition != null && message.hasOwnProperty("endPosition")) + object.endPosition = $root.google.monitoring.v3.TextLocator.Position.toObject(message.endPosition, options); + if (message.nestedLocator != null && message.hasOwnProperty("nestedLocator")) + object.nestedLocator = $root.google.monitoring.v3.TextLocator.toObject(message.nestedLocator, options); + if (message.nestingReason != null && message.hasOwnProperty("nestingReason")) + object.nestingReason = message.nestingReason; + return object; + }; + + /** + * Converts this TextLocator to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TextLocator + * @instance + * @returns {Object.} JSON object + */ + TextLocator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TextLocator + * @function getTypeUrl + * @memberof google.monitoring.v3.TextLocator + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextLocator.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TextLocator"; + }; + + TextLocator.Position = (function() { + + /** + * Properties of a Position. + * @memberof google.monitoring.v3.TextLocator + * @interface IPosition + * @property {number|null} [line] Position line + * @property {number|null} [column] Position column + */ + + /** + * Constructs a new Position. + * @memberof google.monitoring.v3.TextLocator + * @classdesc Represents a Position. + * @implements IPosition + * @constructor + * @param {google.monitoring.v3.TextLocator.IPosition=} [properties] Properties to set + */ + function Position(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]]; + } + + /** + * Position line. + * @member {number} line + * @memberof google.monitoring.v3.TextLocator.Position + * @instance + */ + Position.prototype.line = 0; + + /** + * Position column. + * @member {number} column + * @memberof google.monitoring.v3.TextLocator.Position + * @instance + */ + Position.prototype.column = 0; + + /** + * Creates a new Position instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {google.monitoring.v3.TextLocator.IPosition=} [properties] Properties to set + * @returns {google.monitoring.v3.TextLocator.Position} Position instance + */ + Position.create = function create(properties) { + return new Position(properties); + }; + + /** + * Encodes the specified Position message. Does not implicitly {@link google.monitoring.v3.TextLocator.Position.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {google.monitoring.v3.TextLocator.IPosition} message Position message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Position.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.line != null && Object.hasOwnProperty.call(message, "line")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.line); + if (message.column != null && Object.hasOwnProperty.call(message, "column")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.column); + return writer; + }; + + /** + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.monitoring.v3.TextLocator.Position.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {google.monitoring.v3.TextLocator.IPosition} message Position message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Position.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Position message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TextLocator.Position} Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Position.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TextLocator.Position(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.line = reader.int32(); + break; + } + case 2: { + message.column = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Position message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TextLocator.Position} Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Position.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Position message. + * @function verify + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Position.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.line != null && message.hasOwnProperty("line")) + if (!$util.isInteger(message.line)) + return "line: integer expected"; + if (message.column != null && message.hasOwnProperty("column")) + if (!$util.isInteger(message.column)) + return "column: integer expected"; + return null; + }; + + /** + * Creates a Position message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TextLocator.Position} Position + */ + Position.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TextLocator.Position) + return object; + var message = new $root.google.monitoring.v3.TextLocator.Position(); + if (object.line != null) + message.line = object.line | 0; + if (object.column != null) + message.column = object.column | 0; + return message; + }; + + /** + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {google.monitoring.v3.TextLocator.Position} message Position + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Position.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.line = 0; + object.column = 0; + } + if (message.line != null && message.hasOwnProperty("line")) + object.line = message.line; + if (message.column != null && message.hasOwnProperty("column")) + object.column = message.column; + return object; + }; + + /** + * Converts this Position to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TextLocator.Position + * @instance + * @returns {Object.} JSON object + */ + Position.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Position + * @function getTypeUrl + * @memberof google.monitoring.v3.TextLocator.Position + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Position.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TextLocator.Position"; + }; + + return Position; + })(); + + return TextLocator; + })(); + + v3.MetricService = (function() { + + /** + * Constructs a new MetricService service. + * @memberof google.monitoring.v3 + * @classdesc Represents a MetricService + * @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 MetricService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (MetricService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = MetricService; + + /** + * Creates new MetricService service using the specified rpc implementation. + * @function create + * @memberof google.monitoring.v3.MetricService + * @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 {MetricService} RPC service. Useful where requests and/or responses are streamed. + */ + MetricService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|listMonitoredResourceDescriptors}. + * @memberof google.monitoring.v3.MetricService + * @typedef ListMonitoredResourceDescriptorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListMonitoredResourceDescriptorsResponse} [response] ListMonitoredResourceDescriptorsResponse + */ + + /** + * Calls ListMonitoredResourceDescriptors. + * @function listMonitoredResourceDescriptors + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsRequest} request ListMonitoredResourceDescriptorsRequest message or plain object + * @param {google.monitoring.v3.MetricService.ListMonitoredResourceDescriptorsCallback} callback Node-style callback called with the error, if any, and ListMonitoredResourceDescriptorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricService.prototype.listMonitoredResourceDescriptors = function listMonitoredResourceDescriptors(request, callback) { + return this.rpcCall(listMonitoredResourceDescriptors, $root.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest, $root.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse, request, callback); + }, "name", { value: "ListMonitoredResourceDescriptors" }); + + /** + * Calls ListMonitoredResourceDescriptors. + * @function listMonitoredResourceDescriptors + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsRequest} request ListMonitoredResourceDescriptorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|getMonitoredResourceDescriptor}. + * @memberof google.monitoring.v3.MetricService + * @typedef GetMonitoredResourceDescriptorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.MonitoredResourceDescriptor} [response] MonitoredResourceDescriptor + */ + + /** + * Calls GetMonitoredResourceDescriptor. + * @function getMonitoredResourceDescriptor + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IGetMonitoredResourceDescriptorRequest} request GetMonitoredResourceDescriptorRequest message or plain object + * @param {google.monitoring.v3.MetricService.GetMonitoredResourceDescriptorCallback} callback Node-style callback called with the error, if any, and MonitoredResourceDescriptor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricService.prototype.getMonitoredResourceDescriptor = function getMonitoredResourceDescriptor(request, callback) { + return this.rpcCall(getMonitoredResourceDescriptor, $root.google.monitoring.v3.GetMonitoredResourceDescriptorRequest, $root.google.api.MonitoredResourceDescriptor, request, callback); + }, "name", { value: "GetMonitoredResourceDescriptor" }); + + /** + * Calls GetMonitoredResourceDescriptor. + * @function getMonitoredResourceDescriptor + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IGetMonitoredResourceDescriptorRequest} request GetMonitoredResourceDescriptorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|listMetricDescriptors}. + * @memberof google.monitoring.v3.MetricService + * @typedef ListMetricDescriptorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListMetricDescriptorsResponse} [response] ListMetricDescriptorsResponse + */ + + /** + * Calls ListMetricDescriptors. + * @function listMetricDescriptors + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IListMetricDescriptorsRequest} request ListMetricDescriptorsRequest message or plain object + * @param {google.monitoring.v3.MetricService.ListMetricDescriptorsCallback} callback Node-style callback called with the error, if any, and ListMetricDescriptorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricService.prototype.listMetricDescriptors = function listMetricDescriptors(request, callback) { + return this.rpcCall(listMetricDescriptors, $root.google.monitoring.v3.ListMetricDescriptorsRequest, $root.google.monitoring.v3.ListMetricDescriptorsResponse, request, callback); + }, "name", { value: "ListMetricDescriptors" }); + + /** + * Calls ListMetricDescriptors. + * @function listMetricDescriptors + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IListMetricDescriptorsRequest} request ListMetricDescriptorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|getMetricDescriptor}. + * @memberof google.monitoring.v3.MetricService + * @typedef GetMetricDescriptorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.MetricDescriptor} [response] MetricDescriptor + */ + + /** + * Calls GetMetricDescriptor. + * @function getMetricDescriptor + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IGetMetricDescriptorRequest} request GetMetricDescriptorRequest message or plain object + * @param {google.monitoring.v3.MetricService.GetMetricDescriptorCallback} callback Node-style callback called with the error, if any, and MetricDescriptor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricService.prototype.getMetricDescriptor = function getMetricDescriptor(request, callback) { + return this.rpcCall(getMetricDescriptor, $root.google.monitoring.v3.GetMetricDescriptorRequest, $root.google.api.MetricDescriptor, request, callback); + }, "name", { value: "GetMetricDescriptor" }); + + /** + * Calls GetMetricDescriptor. + * @function getMetricDescriptor + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IGetMetricDescriptorRequest} request GetMetricDescriptorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|createMetricDescriptor}. + * @memberof google.monitoring.v3.MetricService + * @typedef CreateMetricDescriptorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.api.MetricDescriptor} [response] MetricDescriptor + */ + + /** + * Calls CreateMetricDescriptor. + * @function createMetricDescriptor + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.ICreateMetricDescriptorRequest} request CreateMetricDescriptorRequest message or plain object + * @param {google.monitoring.v3.MetricService.CreateMetricDescriptorCallback} callback Node-style callback called with the error, if any, and MetricDescriptor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricService.prototype.createMetricDescriptor = function createMetricDescriptor(request, callback) { + return this.rpcCall(createMetricDescriptor, $root.google.monitoring.v3.CreateMetricDescriptorRequest, $root.google.api.MetricDescriptor, request, callback); + }, "name", { value: "CreateMetricDescriptor" }); + + /** + * Calls CreateMetricDescriptor. + * @function createMetricDescriptor + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.ICreateMetricDescriptorRequest} request CreateMetricDescriptorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|deleteMetricDescriptor}. + * @memberof google.monitoring.v3.MetricService + * @typedef DeleteMetricDescriptorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteMetricDescriptor. + * @function deleteMetricDescriptor + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IDeleteMetricDescriptorRequest} request DeleteMetricDescriptorRequest message or plain object + * @param {google.monitoring.v3.MetricService.DeleteMetricDescriptorCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricService.prototype.deleteMetricDescriptor = function deleteMetricDescriptor(request, callback) { + return this.rpcCall(deleteMetricDescriptor, $root.google.monitoring.v3.DeleteMetricDescriptorRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteMetricDescriptor" }); + + /** + * Calls DeleteMetricDescriptor. + * @function deleteMetricDescriptor + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IDeleteMetricDescriptorRequest} request DeleteMetricDescriptorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|listTimeSeries}. + * @memberof google.monitoring.v3.MetricService + * @typedef ListTimeSeriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListTimeSeriesResponse} [response] ListTimeSeriesResponse + */ + + /** + * Calls ListTimeSeries. + * @function listTimeSeries + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IListTimeSeriesRequest} request ListTimeSeriesRequest message or plain object + * @param {google.monitoring.v3.MetricService.ListTimeSeriesCallback} callback Node-style callback called with the error, if any, and ListTimeSeriesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricService.prototype.listTimeSeries = function listTimeSeries(request, callback) { + return this.rpcCall(listTimeSeries, $root.google.monitoring.v3.ListTimeSeriesRequest, $root.google.monitoring.v3.ListTimeSeriesResponse, request, callback); + }, "name", { value: "ListTimeSeries" }); + + /** + * Calls ListTimeSeries. + * @function listTimeSeries + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.IListTimeSeriesRequest} request ListTimeSeriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.MetricService|createTimeSeries}. + * @memberof google.monitoring.v3.MetricService + * @typedef CreateTimeSeriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CreateTimeSeries. + * @function createTimeSeries + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.ICreateTimeSeriesRequest} request CreateTimeSeriesRequest message or plain object + * @param {google.monitoring.v3.MetricService.CreateTimeSeriesCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricService.prototype.createTimeSeries = function createTimeSeries(request, callback) { + return this.rpcCall(createTimeSeries, $root.google.monitoring.v3.CreateTimeSeriesRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CreateTimeSeries" }); + + /** + * Calls CreateTimeSeries. + * @function createTimeSeries + * @memberof google.monitoring.v3.MetricService + * @instance + * @param {google.monitoring.v3.ICreateTimeSeriesRequest} request CreateTimeSeriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return MetricService; + })(); + + v3.ListMonitoredResourceDescriptorsRequest = (function() { + + /** + * Properties of a ListMonitoredResourceDescriptorsRequest. + * @memberof google.monitoring.v3 + * @interface IListMonitoredResourceDescriptorsRequest + * @property {string|null} [name] ListMonitoredResourceDescriptorsRequest name + * @property {string|null} [filter] ListMonitoredResourceDescriptorsRequest filter + * @property {number|null} [pageSize] ListMonitoredResourceDescriptorsRequest pageSize + * @property {string|null} [pageToken] ListMonitoredResourceDescriptorsRequest pageToken + */ + + /** + * Constructs a new ListMonitoredResourceDescriptorsRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListMonitoredResourceDescriptorsRequest. + * @implements IListMonitoredResourceDescriptorsRequest + * @constructor + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsRequest=} [properties] Properties to set + */ + function ListMonitoredResourceDescriptorsRequest(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]]; + } + + /** + * ListMonitoredResourceDescriptorsRequest name. + * @member {string} name + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @instance + */ + ListMonitoredResourceDescriptorsRequest.prototype.name = ""; + + /** + * ListMonitoredResourceDescriptorsRequest filter. + * @member {string} filter + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @instance + */ + ListMonitoredResourceDescriptorsRequest.prototype.filter = ""; + + /** + * ListMonitoredResourceDescriptorsRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @instance + */ + ListMonitoredResourceDescriptorsRequest.prototype.pageSize = 0; + + /** + * ListMonitoredResourceDescriptorsRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @instance + */ + ListMonitoredResourceDescriptorsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListMonitoredResourceDescriptorsRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest instance + */ + ListMonitoredResourceDescriptorsRequest.create = function create(properties) { + return new ListMonitoredResourceDescriptorsRequest(properties); + }; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsRequest message. Does not implicitly {@link google.monitoring.v3.ListMonitoredResourceDescriptorsRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsRequest} message ListMonitoredResourceDescriptorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMonitoredResourceDescriptorsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListMonitoredResourceDescriptorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsRequest} message ListMonitoredResourceDescriptorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMonitoredResourceDescriptorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMonitoredResourceDescriptorsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMonitoredResourceDescriptorsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.name = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMonitoredResourceDescriptorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMonitoredResourceDescriptorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMonitoredResourceDescriptorsRequest message. + * @function verify + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMonitoredResourceDescriptorsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListMonitoredResourceDescriptorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest + */ + ListMonitoredResourceDescriptorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest) + return object; + var message = new $root.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListMonitoredResourceDescriptorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {google.monitoring.v3.ListMonitoredResourceDescriptorsRequest} message ListMonitoredResourceDescriptorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMonitoredResourceDescriptorsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListMonitoredResourceDescriptorsRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @instance + * @returns {Object.} JSON object + */ + ListMonitoredResourceDescriptorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMonitoredResourceDescriptorsRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMonitoredResourceDescriptorsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListMonitoredResourceDescriptorsRequest"; + }; + + return ListMonitoredResourceDescriptorsRequest; + })(); + + v3.ListMonitoredResourceDescriptorsResponse = (function() { + + /** + * Properties of a ListMonitoredResourceDescriptorsResponse. + * @memberof google.monitoring.v3 + * @interface IListMonitoredResourceDescriptorsResponse + * @property {Array.|null} [resourceDescriptors] ListMonitoredResourceDescriptorsResponse resourceDescriptors + * @property {string|null} [nextPageToken] ListMonitoredResourceDescriptorsResponse nextPageToken + */ + + /** + * Constructs a new ListMonitoredResourceDescriptorsResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListMonitoredResourceDescriptorsResponse. + * @implements IListMonitoredResourceDescriptorsResponse + * @constructor + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsResponse=} [properties] Properties to set + */ + function ListMonitoredResourceDescriptorsResponse(properties) { + this.resourceDescriptors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMonitoredResourceDescriptorsResponse resourceDescriptors. + * @member {Array.} resourceDescriptors + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @instance + */ + ListMonitoredResourceDescriptorsResponse.prototype.resourceDescriptors = $util.emptyArray; + + /** + * ListMonitoredResourceDescriptorsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @instance + */ + ListMonitoredResourceDescriptorsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListMonitoredResourceDescriptorsResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse instance + */ + ListMonitoredResourceDescriptorsResponse.create = function create(properties) { + return new ListMonitoredResourceDescriptorsResponse(properties); + }; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsResponse message. Does not implicitly {@link google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsResponse} message ListMonitoredResourceDescriptorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMonitoredResourceDescriptorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resourceDescriptors != null && message.resourceDescriptors.length) + for (var i = 0; i < message.resourceDescriptors.length; ++i) + $root.google.api.MonitoredResourceDescriptor.encode(message.resourceDescriptors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListMonitoredResourceDescriptorsResponse} message ListMonitoredResourceDescriptorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMonitoredResourceDescriptorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMonitoredResourceDescriptorsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMonitoredResourceDescriptorsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.resourceDescriptors && message.resourceDescriptors.length)) + message.resourceDescriptors = []; + message.resourceDescriptors.push($root.google.api.MonitoredResourceDescriptor.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMonitoredResourceDescriptorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMonitoredResourceDescriptorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMonitoredResourceDescriptorsResponse message. + * @function verify + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMonitoredResourceDescriptorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resourceDescriptors != null && message.hasOwnProperty("resourceDescriptors")) { + if (!Array.isArray(message.resourceDescriptors)) + return "resourceDescriptors: array expected"; + for (var i = 0; i < message.resourceDescriptors.length; ++i) { + var error = $root.google.api.MonitoredResourceDescriptor.verify(message.resourceDescriptors[i]); + if (error) + return "resourceDescriptors." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListMonitoredResourceDescriptorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse + */ + ListMonitoredResourceDescriptorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse) + return object; + var message = new $root.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse(); + if (object.resourceDescriptors) { + if (!Array.isArray(object.resourceDescriptors)) + throw TypeError(".google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.resourceDescriptors: array expected"); + message.resourceDescriptors = []; + for (var i = 0; i < object.resourceDescriptors.length; ++i) { + if (typeof object.resourceDescriptors[i] !== "object") + throw TypeError(".google.monitoring.v3.ListMonitoredResourceDescriptorsResponse.resourceDescriptors: object expected"); + message.resourceDescriptors[i] = $root.google.api.MonitoredResourceDescriptor.fromObject(object.resourceDescriptors[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListMonitoredResourceDescriptorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {google.monitoring.v3.ListMonitoredResourceDescriptorsResponse} message ListMonitoredResourceDescriptorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMonitoredResourceDescriptorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.resourceDescriptors = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.resourceDescriptors && message.resourceDescriptors.length) { + object.resourceDescriptors = []; + for (var j = 0; j < message.resourceDescriptors.length; ++j) + object.resourceDescriptors[j] = $root.google.api.MonitoredResourceDescriptor.toObject(message.resourceDescriptors[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListMonitoredResourceDescriptorsResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @instance + * @returns {Object.} JSON object + */ + ListMonitoredResourceDescriptorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMonitoredResourceDescriptorsResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListMonitoredResourceDescriptorsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMonitoredResourceDescriptorsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListMonitoredResourceDescriptorsResponse"; + }; + + return ListMonitoredResourceDescriptorsResponse; + })(); + + v3.GetMonitoredResourceDescriptorRequest = (function() { + + /** + * Properties of a GetMonitoredResourceDescriptorRequest. + * @memberof google.monitoring.v3 + * @interface IGetMonitoredResourceDescriptorRequest + * @property {string|null} [name] GetMonitoredResourceDescriptorRequest name + */ + + /** + * Constructs a new GetMonitoredResourceDescriptorRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetMonitoredResourceDescriptorRequest. + * @implements IGetMonitoredResourceDescriptorRequest + * @constructor + * @param {google.monitoring.v3.IGetMonitoredResourceDescriptorRequest=} [properties] Properties to set + */ + function GetMonitoredResourceDescriptorRequest(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]]; + } + + /** + * GetMonitoredResourceDescriptorRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @instance + */ + GetMonitoredResourceDescriptorRequest.prototype.name = ""; + + /** + * Creates a new GetMonitoredResourceDescriptorRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetMonitoredResourceDescriptorRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetMonitoredResourceDescriptorRequest} GetMonitoredResourceDescriptorRequest instance + */ + GetMonitoredResourceDescriptorRequest.create = function create(properties) { + return new GetMonitoredResourceDescriptorRequest(properties); + }; + + /** + * Encodes the specified GetMonitoredResourceDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.GetMonitoredResourceDescriptorRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetMonitoredResourceDescriptorRequest} message GetMonitoredResourceDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMonitoredResourceDescriptorRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetMonitoredResourceDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetMonitoredResourceDescriptorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetMonitoredResourceDescriptorRequest} message GetMonitoredResourceDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMonitoredResourceDescriptorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetMonitoredResourceDescriptorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetMonitoredResourceDescriptorRequest} GetMonitoredResourceDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMonitoredResourceDescriptorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetMonitoredResourceDescriptorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetMonitoredResourceDescriptorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetMonitoredResourceDescriptorRequest} GetMonitoredResourceDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMonitoredResourceDescriptorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetMonitoredResourceDescriptorRequest message. + * @function verify + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMonitoredResourceDescriptorRequest.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 GetMonitoredResourceDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetMonitoredResourceDescriptorRequest} GetMonitoredResourceDescriptorRequest + */ + GetMonitoredResourceDescriptorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetMonitoredResourceDescriptorRequest) + return object; + var message = new $root.google.monitoring.v3.GetMonitoredResourceDescriptorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetMonitoredResourceDescriptorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {google.monitoring.v3.GetMonitoredResourceDescriptorRequest} message GetMonitoredResourceDescriptorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMonitoredResourceDescriptorRequest.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 GetMonitoredResourceDescriptorRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @instance + * @returns {Object.} JSON object + */ + GetMonitoredResourceDescriptorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetMonitoredResourceDescriptorRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetMonitoredResourceDescriptorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetMonitoredResourceDescriptorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetMonitoredResourceDescriptorRequest"; + }; + + return GetMonitoredResourceDescriptorRequest; + })(); + + v3.ListMetricDescriptorsRequest = (function() { + + /** + * Properties of a ListMetricDescriptorsRequest. + * @memberof google.monitoring.v3 + * @interface IListMetricDescriptorsRequest + * @property {string|null} [name] ListMetricDescriptorsRequest name + * @property {string|null} [filter] ListMetricDescriptorsRequest filter + * @property {number|null} [pageSize] ListMetricDescriptorsRequest pageSize + * @property {string|null} [pageToken] ListMetricDescriptorsRequest pageToken + */ + + /** + * Constructs a new ListMetricDescriptorsRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListMetricDescriptorsRequest. + * @implements IListMetricDescriptorsRequest + * @constructor + * @param {google.monitoring.v3.IListMetricDescriptorsRequest=} [properties] Properties to set + */ + function ListMetricDescriptorsRequest(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]]; + } + + /** + * ListMetricDescriptorsRequest name. + * @member {string} name + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @instance + */ + ListMetricDescriptorsRequest.prototype.name = ""; + + /** + * ListMetricDescriptorsRequest filter. + * @member {string} filter + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @instance + */ + ListMetricDescriptorsRequest.prototype.filter = ""; + + /** + * ListMetricDescriptorsRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @instance + */ + ListMetricDescriptorsRequest.prototype.pageSize = 0; + + /** + * ListMetricDescriptorsRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @instance + */ + ListMetricDescriptorsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListMetricDescriptorsRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListMetricDescriptorsRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListMetricDescriptorsRequest} ListMetricDescriptorsRequest instance + */ + ListMetricDescriptorsRequest.create = function create(properties) { + return new ListMetricDescriptorsRequest(properties); + }; + + /** + * Encodes the specified ListMetricDescriptorsRequest message. Does not implicitly {@link google.monitoring.v3.ListMetricDescriptorsRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListMetricDescriptorsRequest} message ListMetricDescriptorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMetricDescriptorsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListMetricDescriptorsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListMetricDescriptorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListMetricDescriptorsRequest} message ListMetricDescriptorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMetricDescriptorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMetricDescriptorsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListMetricDescriptorsRequest} ListMetricDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMetricDescriptorsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListMetricDescriptorsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.name = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMetricDescriptorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListMetricDescriptorsRequest} ListMetricDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMetricDescriptorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMetricDescriptorsRequest message. + * @function verify + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMetricDescriptorsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListMetricDescriptorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListMetricDescriptorsRequest} ListMetricDescriptorsRequest + */ + ListMetricDescriptorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListMetricDescriptorsRequest) + return object; + var message = new $root.google.monitoring.v3.ListMetricDescriptorsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListMetricDescriptorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {google.monitoring.v3.ListMetricDescriptorsRequest} message ListMetricDescriptorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMetricDescriptorsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListMetricDescriptorsRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @instance + * @returns {Object.} JSON object + */ + ListMetricDescriptorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMetricDescriptorsRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListMetricDescriptorsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMetricDescriptorsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListMetricDescriptorsRequest"; + }; + + return ListMetricDescriptorsRequest; + })(); + + v3.ListMetricDescriptorsResponse = (function() { + + /** + * Properties of a ListMetricDescriptorsResponse. + * @memberof google.monitoring.v3 + * @interface IListMetricDescriptorsResponse + * @property {Array.|null} [metricDescriptors] ListMetricDescriptorsResponse metricDescriptors + * @property {string|null} [nextPageToken] ListMetricDescriptorsResponse nextPageToken + */ + + /** + * Constructs a new ListMetricDescriptorsResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListMetricDescriptorsResponse. + * @implements IListMetricDescriptorsResponse + * @constructor + * @param {google.monitoring.v3.IListMetricDescriptorsResponse=} [properties] Properties to set + */ + function ListMetricDescriptorsResponse(properties) { + this.metricDescriptors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMetricDescriptorsResponse metricDescriptors. + * @member {Array.} metricDescriptors + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @instance + */ + ListMetricDescriptorsResponse.prototype.metricDescriptors = $util.emptyArray; + + /** + * ListMetricDescriptorsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @instance + */ + ListMetricDescriptorsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListMetricDescriptorsResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListMetricDescriptorsResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListMetricDescriptorsResponse} ListMetricDescriptorsResponse instance + */ + ListMetricDescriptorsResponse.create = function create(properties) { + return new ListMetricDescriptorsResponse(properties); + }; + + /** + * Encodes the specified ListMetricDescriptorsResponse message. Does not implicitly {@link google.monitoring.v3.ListMetricDescriptorsResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListMetricDescriptorsResponse} message ListMetricDescriptorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMetricDescriptorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metricDescriptors != null && message.metricDescriptors.length) + for (var i = 0; i < message.metricDescriptors.length; ++i) + $root.google.api.MetricDescriptor.encode(message.metricDescriptors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListMetricDescriptorsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListMetricDescriptorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListMetricDescriptorsResponse} message ListMetricDescriptorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMetricDescriptorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMetricDescriptorsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListMetricDescriptorsResponse} ListMetricDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMetricDescriptorsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListMetricDescriptorsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.metricDescriptors && message.metricDescriptors.length)) + message.metricDescriptors = []; + message.metricDescriptors.push($root.google.api.MetricDescriptor.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMetricDescriptorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListMetricDescriptorsResponse} ListMetricDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMetricDescriptorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMetricDescriptorsResponse message. + * @function verify + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMetricDescriptorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metricDescriptors != null && message.hasOwnProperty("metricDescriptors")) { + if (!Array.isArray(message.metricDescriptors)) + return "metricDescriptors: array expected"; + for (var i = 0; i < message.metricDescriptors.length; ++i) { + var error = $root.google.api.MetricDescriptor.verify(message.metricDescriptors[i]); + if (error) + return "metricDescriptors." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListMetricDescriptorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListMetricDescriptorsResponse} ListMetricDescriptorsResponse + */ + ListMetricDescriptorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListMetricDescriptorsResponse) + return object; + var message = new $root.google.monitoring.v3.ListMetricDescriptorsResponse(); + if (object.metricDescriptors) { + if (!Array.isArray(object.metricDescriptors)) + throw TypeError(".google.monitoring.v3.ListMetricDescriptorsResponse.metricDescriptors: array expected"); + message.metricDescriptors = []; + for (var i = 0; i < object.metricDescriptors.length; ++i) { + if (typeof object.metricDescriptors[i] !== "object") + throw TypeError(".google.monitoring.v3.ListMetricDescriptorsResponse.metricDescriptors: object expected"); + message.metricDescriptors[i] = $root.google.api.MetricDescriptor.fromObject(object.metricDescriptors[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListMetricDescriptorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {google.monitoring.v3.ListMetricDescriptorsResponse} message ListMetricDescriptorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMetricDescriptorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.metricDescriptors = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.metricDescriptors && message.metricDescriptors.length) { + object.metricDescriptors = []; + for (var j = 0; j < message.metricDescriptors.length; ++j) + object.metricDescriptors[j] = $root.google.api.MetricDescriptor.toObject(message.metricDescriptors[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListMetricDescriptorsResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @instance + * @returns {Object.} JSON object + */ + ListMetricDescriptorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMetricDescriptorsResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListMetricDescriptorsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMetricDescriptorsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListMetricDescriptorsResponse"; + }; + + return ListMetricDescriptorsResponse; + })(); + + v3.GetMetricDescriptorRequest = (function() { + + /** + * Properties of a GetMetricDescriptorRequest. + * @memberof google.monitoring.v3 + * @interface IGetMetricDescriptorRequest + * @property {string|null} [name] GetMetricDescriptorRequest name + */ + + /** + * Constructs a new GetMetricDescriptorRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetMetricDescriptorRequest. + * @implements IGetMetricDescriptorRequest + * @constructor + * @param {google.monitoring.v3.IGetMetricDescriptorRequest=} [properties] Properties to set + */ + function GetMetricDescriptorRequest(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]]; + } + + /** + * GetMetricDescriptorRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @instance + */ + GetMetricDescriptorRequest.prototype.name = ""; + + /** + * Creates a new GetMetricDescriptorRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetMetricDescriptorRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetMetricDescriptorRequest} GetMetricDescriptorRequest instance + */ + GetMetricDescriptorRequest.create = function create(properties) { + return new GetMetricDescriptorRequest(properties); + }; + + /** + * Encodes the specified GetMetricDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.GetMetricDescriptorRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetMetricDescriptorRequest} message GetMetricDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMetricDescriptorRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetMetricDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetMetricDescriptorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetMetricDescriptorRequest} message GetMetricDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMetricDescriptorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetMetricDescriptorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetMetricDescriptorRequest} GetMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMetricDescriptorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetMetricDescriptorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetMetricDescriptorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetMetricDescriptorRequest} GetMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMetricDescriptorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetMetricDescriptorRequest message. + * @function verify + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMetricDescriptorRequest.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 GetMetricDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetMetricDescriptorRequest} GetMetricDescriptorRequest + */ + GetMetricDescriptorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetMetricDescriptorRequest) + return object; + var message = new $root.google.monitoring.v3.GetMetricDescriptorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetMetricDescriptorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.GetMetricDescriptorRequest} message GetMetricDescriptorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMetricDescriptorRequest.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 GetMetricDescriptorRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @instance + * @returns {Object.} JSON object + */ + GetMetricDescriptorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetMetricDescriptorRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetMetricDescriptorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetMetricDescriptorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetMetricDescriptorRequest"; + }; + + return GetMetricDescriptorRequest; + })(); + + v3.CreateMetricDescriptorRequest = (function() { + + /** + * Properties of a CreateMetricDescriptorRequest. + * @memberof google.monitoring.v3 + * @interface ICreateMetricDescriptorRequest + * @property {string|null} [name] CreateMetricDescriptorRequest name + * @property {google.api.IMetricDescriptor|null} [metricDescriptor] CreateMetricDescriptorRequest metricDescriptor + */ + + /** + * Constructs a new CreateMetricDescriptorRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateMetricDescriptorRequest. + * @implements ICreateMetricDescriptorRequest + * @constructor + * @param {google.monitoring.v3.ICreateMetricDescriptorRequest=} [properties] Properties to set + */ + function CreateMetricDescriptorRequest(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]]; + } + + /** + * CreateMetricDescriptorRequest name. + * @member {string} name + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @instance + */ + CreateMetricDescriptorRequest.prototype.name = ""; + + /** + * CreateMetricDescriptorRequest metricDescriptor. + * @member {google.api.IMetricDescriptor|null|undefined} metricDescriptor + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @instance + */ + CreateMetricDescriptorRequest.prototype.metricDescriptor = null; + + /** + * Creates a new CreateMetricDescriptorRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.ICreateMetricDescriptorRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateMetricDescriptorRequest} CreateMetricDescriptorRequest instance + */ + CreateMetricDescriptorRequest.create = function create(properties) { + return new CreateMetricDescriptorRequest(properties); + }; + + /** + * Encodes the specified CreateMetricDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.CreateMetricDescriptorRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.ICreateMetricDescriptorRequest} message CreateMetricDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateMetricDescriptorRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metricDescriptor != null && Object.hasOwnProperty.call(message, "metricDescriptor")) + $root.google.api.MetricDescriptor.encode(message.metricDescriptor, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified CreateMetricDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateMetricDescriptorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.ICreateMetricDescriptorRequest} message CreateMetricDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateMetricDescriptorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateMetricDescriptorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateMetricDescriptorRequest} CreateMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateMetricDescriptorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateMetricDescriptorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + case 2: { + message.metricDescriptor = $root.google.api.MetricDescriptor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateMetricDescriptorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateMetricDescriptorRequest} CreateMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateMetricDescriptorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateMetricDescriptorRequest message. + * @function verify + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateMetricDescriptorRequest.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.metricDescriptor != null && message.hasOwnProperty("metricDescriptor")) { + var error = $root.google.api.MetricDescriptor.verify(message.metricDescriptor); + if (error) + return "metricDescriptor." + error; + } + return null; + }; + + /** + * Creates a CreateMetricDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateMetricDescriptorRequest} CreateMetricDescriptorRequest + */ + CreateMetricDescriptorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateMetricDescriptorRequest) + return object; + var message = new $root.google.monitoring.v3.CreateMetricDescriptorRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.metricDescriptor != null) { + if (typeof object.metricDescriptor !== "object") + throw TypeError(".google.monitoring.v3.CreateMetricDescriptorRequest.metricDescriptor: object expected"); + message.metricDescriptor = $root.google.api.MetricDescriptor.fromObject(object.metricDescriptor); + } + return message; + }; + + /** + * Creates a plain object from a CreateMetricDescriptorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.CreateMetricDescriptorRequest} message CreateMetricDescriptorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateMetricDescriptorRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.metricDescriptor = null; + object.name = ""; + } + if (message.metricDescriptor != null && message.hasOwnProperty("metricDescriptor")) + object.metricDescriptor = $root.google.api.MetricDescriptor.toObject(message.metricDescriptor, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CreateMetricDescriptorRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @instance + * @returns {Object.} JSON object + */ + CreateMetricDescriptorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateMetricDescriptorRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateMetricDescriptorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateMetricDescriptorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateMetricDescriptorRequest"; + }; + + return CreateMetricDescriptorRequest; + })(); + + v3.DeleteMetricDescriptorRequest = (function() { + + /** + * Properties of a DeleteMetricDescriptorRequest. + * @memberof google.monitoring.v3 + * @interface IDeleteMetricDescriptorRequest + * @property {string|null} [name] DeleteMetricDescriptorRequest name + */ + + /** + * Constructs a new DeleteMetricDescriptorRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a DeleteMetricDescriptorRequest. + * @implements IDeleteMetricDescriptorRequest + * @constructor + * @param {google.monitoring.v3.IDeleteMetricDescriptorRequest=} [properties] Properties to set + */ + function DeleteMetricDescriptorRequest(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]]; + } + + /** + * DeleteMetricDescriptorRequest name. + * @member {string} name + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @instance + */ + DeleteMetricDescriptorRequest.prototype.name = ""; + + /** + * Creates a new DeleteMetricDescriptorRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.IDeleteMetricDescriptorRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.DeleteMetricDescriptorRequest} DeleteMetricDescriptorRequest instance + */ + DeleteMetricDescriptorRequest.create = function create(properties) { + return new DeleteMetricDescriptorRequest(properties); + }; + + /** + * Encodes the specified DeleteMetricDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.DeleteMetricDescriptorRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.IDeleteMetricDescriptorRequest} message DeleteMetricDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteMetricDescriptorRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteMetricDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteMetricDescriptorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.IDeleteMetricDescriptorRequest} message DeleteMetricDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteMetricDescriptorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteMetricDescriptorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DeleteMetricDescriptorRequest} DeleteMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteMetricDescriptorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteMetricDescriptorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteMetricDescriptorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DeleteMetricDescriptorRequest} DeleteMetricDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteMetricDescriptorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteMetricDescriptorRequest message. + * @function verify + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteMetricDescriptorRequest.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 DeleteMetricDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DeleteMetricDescriptorRequest} DeleteMetricDescriptorRequest + */ + DeleteMetricDescriptorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DeleteMetricDescriptorRequest) + return object; + var message = new $root.google.monitoring.v3.DeleteMetricDescriptorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteMetricDescriptorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {google.monitoring.v3.DeleteMetricDescriptorRequest} message DeleteMetricDescriptorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteMetricDescriptorRequest.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 DeleteMetricDescriptorRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteMetricDescriptorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteMetricDescriptorRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.DeleteMetricDescriptorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteMetricDescriptorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DeleteMetricDescriptorRequest"; + }; + + return DeleteMetricDescriptorRequest; + })(); + + v3.ListTimeSeriesRequest = (function() { + + /** + * Properties of a ListTimeSeriesRequest. + * @memberof google.monitoring.v3 + * @interface IListTimeSeriesRequest + * @property {string|null} [name] ListTimeSeriesRequest name + * @property {string|null} [filter] ListTimeSeriesRequest filter + * @property {google.monitoring.v3.ITimeInterval|null} [interval] ListTimeSeriesRequest interval + * @property {google.monitoring.v3.IAggregation|null} [aggregation] ListTimeSeriesRequest aggregation + * @property {google.monitoring.v3.IAggregation|null} [secondaryAggregation] ListTimeSeriesRequest secondaryAggregation + * @property {string|null} [orderBy] ListTimeSeriesRequest orderBy + * @property {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView|null} [view] ListTimeSeriesRequest view + * @property {number|null} [pageSize] ListTimeSeriesRequest pageSize + * @property {string|null} [pageToken] ListTimeSeriesRequest pageToken + */ + + /** + * Constructs a new ListTimeSeriesRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListTimeSeriesRequest. + * @implements IListTimeSeriesRequest + * @constructor + * @param {google.monitoring.v3.IListTimeSeriesRequest=} [properties] Properties to set + */ + function ListTimeSeriesRequest(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]]; + } + + /** + * ListTimeSeriesRequest name. + * @member {string} name + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.name = ""; + + /** + * ListTimeSeriesRequest filter. + * @member {string} filter + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.filter = ""; + + /** + * ListTimeSeriesRequest interval. + * @member {google.monitoring.v3.ITimeInterval|null|undefined} interval + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.interval = null; + + /** + * ListTimeSeriesRequest aggregation. + * @member {google.monitoring.v3.IAggregation|null|undefined} aggregation + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.aggregation = null; + + /** + * ListTimeSeriesRequest secondaryAggregation. + * @member {google.monitoring.v3.IAggregation|null|undefined} secondaryAggregation + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.secondaryAggregation = null; + + /** + * ListTimeSeriesRequest orderBy. + * @member {string} orderBy + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.orderBy = ""; + + /** + * ListTimeSeriesRequest view. + * @member {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} view + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.view = 0; + + /** + * ListTimeSeriesRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.pageSize = 0; + + /** + * ListTimeSeriesRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + */ + ListTimeSeriesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListTimeSeriesRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {google.monitoring.v3.IListTimeSeriesRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListTimeSeriesRequest} ListTimeSeriesRequest instance + */ + ListTimeSeriesRequest.create = function create(properties) { + return new ListTimeSeriesRequest(properties); + }; + + /** + * Encodes the specified ListTimeSeriesRequest message. Does not implicitly {@link google.monitoring.v3.ListTimeSeriesRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {google.monitoring.v3.IListTimeSeriesRequest} message ListTimeSeriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTimeSeriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.interval != null && Object.hasOwnProperty.call(message, "interval")) + $root.google.monitoring.v3.TimeInterval.encode(message.interval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.aggregation != null && Object.hasOwnProperty.call(message, "aggregation")) + $root.google.monitoring.v3.Aggregation.encode(message.aggregation, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.orderBy); + if (message.view != null && Object.hasOwnProperty.call(message, "view")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.view); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.name); + if (message.secondaryAggregation != null && Object.hasOwnProperty.call(message, "secondaryAggregation")) + $root.google.monitoring.v3.Aggregation.encode(message.secondaryAggregation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListTimeSeriesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListTimeSeriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {google.monitoring.v3.IListTimeSeriesRequest} message ListTimeSeriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTimeSeriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTimeSeriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListTimeSeriesRequest} ListTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTimeSeriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListTimeSeriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 10: { + message.name = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 4: { + message.interval = $root.google.monitoring.v3.TimeInterval.decode(reader, reader.uint32()); + break; + } + case 5: { + message.aggregation = $root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32()); + break; + } + case 11: { + message.secondaryAggregation = $root.google.monitoring.v3.Aggregation.decode(reader, reader.uint32()); + break; + } + case 6: { + message.orderBy = reader.string(); + break; + } + case 7: { + message.view = reader.int32(); + break; + } + case 8: { + message.pageSize = reader.int32(); + break; + } + case 9: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTimeSeriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListTimeSeriesRequest} ListTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTimeSeriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTimeSeriesRequest message. + * @function verify + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTimeSeriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.interval != null && message.hasOwnProperty("interval")) { + var error = $root.google.monitoring.v3.TimeInterval.verify(message.interval); + if (error) + return "interval." + error; + } + if (message.aggregation != null && message.hasOwnProperty("aggregation")) { + var error = $root.google.monitoring.v3.Aggregation.verify(message.aggregation); + if (error) + return "aggregation." + error; + } + if (message.secondaryAggregation != null && message.hasOwnProperty("secondaryAggregation")) { + var error = $root.google.monitoring.v3.Aggregation.verify(message.secondaryAggregation); + if (error) + return "secondaryAggregation." + error; + } + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.view != null && message.hasOwnProperty("view")) + switch (message.view) { + default: + return "view: enum value expected"; + case 0: + case 1: + break; + } + 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 ListTimeSeriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListTimeSeriesRequest} ListTimeSeriesRequest + */ + ListTimeSeriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListTimeSeriesRequest) + return object; + var message = new $root.google.monitoring.v3.ListTimeSeriesRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.interval != null) { + if (typeof object.interval !== "object") + throw TypeError(".google.monitoring.v3.ListTimeSeriesRequest.interval: object expected"); + message.interval = $root.google.monitoring.v3.TimeInterval.fromObject(object.interval); + } + if (object.aggregation != null) { + if (typeof object.aggregation !== "object") + throw TypeError(".google.monitoring.v3.ListTimeSeriesRequest.aggregation: object expected"); + message.aggregation = $root.google.monitoring.v3.Aggregation.fromObject(object.aggregation); + } + if (object.secondaryAggregation != null) { + if (typeof object.secondaryAggregation !== "object") + throw TypeError(".google.monitoring.v3.ListTimeSeriesRequest.secondaryAggregation: object expected"); + message.secondaryAggregation = $root.google.monitoring.v3.Aggregation.fromObject(object.secondaryAggregation); + } + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + switch (object.view) { + default: + if (typeof object.view === "number") { + message.view = object.view; + break; + } + break; + case "FULL": + case 0: + message.view = 0; + break; + case "HEADERS": + case 1: + message.view = 1; + break; + } + 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 ListTimeSeriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {google.monitoring.v3.ListTimeSeriesRequest} message ListTimeSeriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTimeSeriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.interval = null; + object.aggregation = null; + object.orderBy = ""; + object.view = options.enums === String ? "FULL" : 0; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + object.secondaryAggregation = null; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.interval != null && message.hasOwnProperty("interval")) + object.interval = $root.google.monitoring.v3.TimeInterval.toObject(message.interval, options); + if (message.aggregation != null && message.hasOwnProperty("aggregation")) + object.aggregation = $root.google.monitoring.v3.Aggregation.toObject(message.aggregation, options); + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.view != null && message.hasOwnProperty("view")) + object.view = options.enums === String ? $root.google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView[message.view] === undefined ? message.view : $root.google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView[message.view] : message.view; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.secondaryAggregation != null && message.hasOwnProperty("secondaryAggregation")) + object.secondaryAggregation = $root.google.monitoring.v3.Aggregation.toObject(message.secondaryAggregation, options); + return object; + }; + + /** + * Converts this ListTimeSeriesRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @instance + * @returns {Object.} JSON object + */ + ListTimeSeriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListTimeSeriesRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListTimeSeriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListTimeSeriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListTimeSeriesRequest"; + }; + + /** + * TimeSeriesView enum. + * @name google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView + * @enum {number} + * @property {number} FULL=0 FULL value + * @property {number} HEADERS=1 HEADERS value + */ + ListTimeSeriesRequest.TimeSeriesView = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FULL"] = 0; + values[valuesById[1] = "HEADERS"] = 1; + return values; + })(); + + return ListTimeSeriesRequest; + })(); + + v3.ListTimeSeriesResponse = (function() { + + /** + * Properties of a ListTimeSeriesResponse. + * @memberof google.monitoring.v3 + * @interface IListTimeSeriesResponse + * @property {Array.|null} [timeSeries] ListTimeSeriesResponse timeSeries + * @property {string|null} [nextPageToken] ListTimeSeriesResponse nextPageToken + * @property {Array.|null} [executionErrors] ListTimeSeriesResponse executionErrors + * @property {string|null} [unit] ListTimeSeriesResponse unit + */ + + /** + * Constructs a new ListTimeSeriesResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListTimeSeriesResponse. + * @implements IListTimeSeriesResponse + * @constructor + * @param {google.monitoring.v3.IListTimeSeriesResponse=} [properties] Properties to set + */ + function ListTimeSeriesResponse(properties) { + this.timeSeries = []; + this.executionErrors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListTimeSeriesResponse timeSeries. + * @member {Array.} timeSeries + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @instance + */ + ListTimeSeriesResponse.prototype.timeSeries = $util.emptyArray; + + /** + * ListTimeSeriesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @instance + */ + ListTimeSeriesResponse.prototype.nextPageToken = ""; + + /** + * ListTimeSeriesResponse executionErrors. + * @member {Array.} executionErrors + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @instance + */ + ListTimeSeriesResponse.prototype.executionErrors = $util.emptyArray; + + /** + * ListTimeSeriesResponse unit. + * @member {string} unit + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @instance + */ + ListTimeSeriesResponse.prototype.unit = ""; + + /** + * Creates a new ListTimeSeriesResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {google.monitoring.v3.IListTimeSeriesResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListTimeSeriesResponse} ListTimeSeriesResponse instance + */ + ListTimeSeriesResponse.create = function create(properties) { + return new ListTimeSeriesResponse(properties); + }; + + /** + * Encodes the specified ListTimeSeriesResponse message. Does not implicitly {@link google.monitoring.v3.ListTimeSeriesResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {google.monitoring.v3.IListTimeSeriesResponse} message ListTimeSeriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTimeSeriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timeSeries != null && message.timeSeries.length) + for (var i = 0; i < message.timeSeries.length; ++i) + $root.google.monitoring.v3.TimeSeries.encode(message.timeSeries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.executionErrors != null && message.executionErrors.length) + for (var i = 0; i < message.executionErrors.length; ++i) + $root.google.rpc.Status.encode(message.executionErrors[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.unit); + return writer; + }; + + /** + * Encodes the specified ListTimeSeriesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListTimeSeriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {google.monitoring.v3.IListTimeSeriesResponse} message ListTimeSeriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListTimeSeriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListTimeSeriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListTimeSeriesResponse} ListTimeSeriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTimeSeriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListTimeSeriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.timeSeries && message.timeSeries.length)) + message.timeSeries = []; + message.timeSeries.push($root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.executionErrors && message.executionErrors.length)) + message.executionErrors = []; + message.executionErrors.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 5: { + message.unit = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListTimeSeriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListTimeSeriesResponse} ListTimeSeriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListTimeSeriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListTimeSeriesResponse message. + * @function verify + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListTimeSeriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timeSeries != null && message.hasOwnProperty("timeSeries")) { + if (!Array.isArray(message.timeSeries)) + return "timeSeries: array expected"; + for (var i = 0; i < message.timeSeries.length; ++i) { + var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries[i]); + if (error) + return "timeSeries." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.executionErrors != null && message.hasOwnProperty("executionErrors")) { + if (!Array.isArray(message.executionErrors)) + return "executionErrors: array expected"; + for (var i = 0; i < message.executionErrors.length; ++i) { + var error = $root.google.rpc.Status.verify(message.executionErrors[i]); + if (error) + return "executionErrors." + error; + } + } + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + return null; + }; + + /** + * Creates a ListTimeSeriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListTimeSeriesResponse} ListTimeSeriesResponse + */ + ListTimeSeriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListTimeSeriesResponse) + return object; + var message = new $root.google.monitoring.v3.ListTimeSeriesResponse(); + if (object.timeSeries) { + if (!Array.isArray(object.timeSeries)) + throw TypeError(".google.monitoring.v3.ListTimeSeriesResponse.timeSeries: array expected"); + message.timeSeries = []; + for (var i = 0; i < object.timeSeries.length; ++i) { + if (typeof object.timeSeries[i] !== "object") + throw TypeError(".google.monitoring.v3.ListTimeSeriesResponse.timeSeries: object expected"); + message.timeSeries[i] = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.executionErrors) { + if (!Array.isArray(object.executionErrors)) + throw TypeError(".google.monitoring.v3.ListTimeSeriesResponse.executionErrors: array expected"); + message.executionErrors = []; + for (var i = 0; i < object.executionErrors.length; ++i) { + if (typeof object.executionErrors[i] !== "object") + throw TypeError(".google.monitoring.v3.ListTimeSeriesResponse.executionErrors: object expected"); + message.executionErrors[i] = $root.google.rpc.Status.fromObject(object.executionErrors[i]); + } + } + if (object.unit != null) + message.unit = String(object.unit); + return message; + }; + + /** + * Creates a plain object from a ListTimeSeriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {google.monitoring.v3.ListTimeSeriesResponse} message ListTimeSeriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListTimeSeriesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.timeSeries = []; + object.executionErrors = []; + } + if (options.defaults) { + object.nextPageToken = ""; + object.unit = ""; + } + if (message.timeSeries && message.timeSeries.length) { + object.timeSeries = []; + for (var j = 0; j < message.timeSeries.length; ++j) + object.timeSeries[j] = $root.google.monitoring.v3.TimeSeries.toObject(message.timeSeries[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.executionErrors && message.executionErrors.length) { + object.executionErrors = []; + for (var j = 0; j < message.executionErrors.length; ++j) + object.executionErrors[j] = $root.google.rpc.Status.toObject(message.executionErrors[j], options); + } + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + return object; + }; + + /** + * Converts this ListTimeSeriesResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @instance + * @returns {Object.} JSON object + */ + ListTimeSeriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListTimeSeriesResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListTimeSeriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListTimeSeriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListTimeSeriesResponse"; + }; + + return ListTimeSeriesResponse; + })(); + + v3.CreateTimeSeriesRequest = (function() { + + /** + * Properties of a CreateTimeSeriesRequest. + * @memberof google.monitoring.v3 + * @interface ICreateTimeSeriesRequest + * @property {string|null} [name] CreateTimeSeriesRequest name + * @property {Array.|null} [timeSeries] CreateTimeSeriesRequest timeSeries + */ + + /** + * Constructs a new CreateTimeSeriesRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateTimeSeriesRequest. + * @implements ICreateTimeSeriesRequest + * @constructor + * @param {google.monitoring.v3.ICreateTimeSeriesRequest=} [properties] Properties to set + */ + function CreateTimeSeriesRequest(properties) { + this.timeSeries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateTimeSeriesRequest name. + * @member {string} name + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @instance + */ + CreateTimeSeriesRequest.prototype.name = ""; + + /** + * CreateTimeSeriesRequest timeSeries. + * @member {Array.} timeSeries + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @instance + */ + CreateTimeSeriesRequest.prototype.timeSeries = $util.emptyArray; + + /** + * Creates a new CreateTimeSeriesRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateTimeSeriesRequest} CreateTimeSeriesRequest instance + */ + CreateTimeSeriesRequest.create = function create(properties) { + return new CreateTimeSeriesRequest(properties); + }; + + /** + * Encodes the specified CreateTimeSeriesRequest message. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesRequest} message CreateTimeSeriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTimeSeriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timeSeries != null && message.timeSeries.length) + for (var i = 0; i < message.timeSeries.length; ++i) + $root.google.monitoring.v3.TimeSeries.encode(message.timeSeries[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified CreateTimeSeriesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesRequest} message CreateTimeSeriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTimeSeriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateTimeSeriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateTimeSeriesRequest} CreateTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTimeSeriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateTimeSeriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.timeSeries && message.timeSeries.length)) + message.timeSeries = []; + message.timeSeries.push($root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateTimeSeriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateTimeSeriesRequest} CreateTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTimeSeriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateTimeSeriesRequest message. + * @function verify + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateTimeSeriesRequest.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.timeSeries != null && message.hasOwnProperty("timeSeries")) { + if (!Array.isArray(message.timeSeries)) + return "timeSeries: array expected"; + for (var i = 0; i < message.timeSeries.length; ++i) { + var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries[i]); + if (error) + return "timeSeries." + error; + } + } + return null; + }; + + /** + * Creates a CreateTimeSeriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateTimeSeriesRequest} CreateTimeSeriesRequest + */ + CreateTimeSeriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateTimeSeriesRequest) + return object; + var message = new $root.google.monitoring.v3.CreateTimeSeriesRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.timeSeries) { + if (!Array.isArray(object.timeSeries)) + throw TypeError(".google.monitoring.v3.CreateTimeSeriesRequest.timeSeries: array expected"); + message.timeSeries = []; + for (var i = 0; i < object.timeSeries.length; ++i) { + if (typeof object.timeSeries[i] !== "object") + throw TypeError(".google.monitoring.v3.CreateTimeSeriesRequest.timeSeries: object expected"); + message.timeSeries[i] = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CreateTimeSeriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {google.monitoring.v3.CreateTimeSeriesRequest} message CreateTimeSeriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateTimeSeriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.timeSeries = []; + if (options.defaults) + object.name = ""; + if (message.timeSeries && message.timeSeries.length) { + object.timeSeries = []; + for (var j = 0; j < message.timeSeries.length; ++j) + object.timeSeries[j] = $root.google.monitoring.v3.TimeSeries.toObject(message.timeSeries[j], options); + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CreateTimeSeriesRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @instance + * @returns {Object.} JSON object + */ + CreateTimeSeriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateTimeSeriesRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateTimeSeriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateTimeSeriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateTimeSeriesRequest"; + }; + + return CreateTimeSeriesRequest; + })(); + + v3.CreateTimeSeriesError = (function() { + + /** + * Properties of a CreateTimeSeriesError. + * @memberof google.monitoring.v3 + * @interface ICreateTimeSeriesError + * @property {google.monitoring.v3.ITimeSeries|null} [timeSeries] CreateTimeSeriesError timeSeries + * @property {google.rpc.IStatus|null} [status] CreateTimeSeriesError status + */ + + /** + * Constructs a new CreateTimeSeriesError. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateTimeSeriesError. + * @implements ICreateTimeSeriesError + * @constructor + * @param {google.monitoring.v3.ICreateTimeSeriesError=} [properties] Properties to set + */ + function CreateTimeSeriesError(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]]; + } + + /** + * CreateTimeSeriesError timeSeries. + * @member {google.monitoring.v3.ITimeSeries|null|undefined} timeSeries + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @instance + */ + CreateTimeSeriesError.prototype.timeSeries = null; + + /** + * CreateTimeSeriesError status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @instance + */ + CreateTimeSeriesError.prototype.status = null; + + /** + * Creates a new CreateTimeSeriesError instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesError=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateTimeSeriesError} CreateTimeSeriesError instance + */ + CreateTimeSeriesError.create = function create(properties) { + return new CreateTimeSeriesError(properties); + }; + + /** + * Encodes the specified CreateTimeSeriesError message. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesError.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesError} message CreateTimeSeriesError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTimeSeriesError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timeSeries != null && Object.hasOwnProperty.call(message, "timeSeries")) + $root.google.monitoring.v3.TimeSeries.encode(message.timeSeries, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateTimeSeriesError message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesError} message CreateTimeSeriesError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTimeSeriesError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateTimeSeriesError message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateTimeSeriesError} CreateTimeSeriesError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTimeSeriesError.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateTimeSeriesError(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.timeSeries = $root.google.monitoring.v3.TimeSeries.decode(reader, reader.uint32()); + break; + } + case 2: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateTimeSeriesError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateTimeSeriesError} CreateTimeSeriesError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTimeSeriesError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateTimeSeriesError message. + * @function verify + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateTimeSeriesError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timeSeries != null && message.hasOwnProperty("timeSeries")) { + var error = $root.google.monitoring.v3.TimeSeries.verify(message.timeSeries); + if (error) + return "timeSeries." + error; + } + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + return null; + }; + + /** + * Creates a CreateTimeSeriesError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateTimeSeriesError} CreateTimeSeriesError + */ + CreateTimeSeriesError.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateTimeSeriesError) + return object; + var message = new $root.google.monitoring.v3.CreateTimeSeriesError(); + if (object.timeSeries != null) { + if (typeof object.timeSeries !== "object") + throw TypeError(".google.monitoring.v3.CreateTimeSeriesError.timeSeries: object expected"); + message.timeSeries = $root.google.monitoring.v3.TimeSeries.fromObject(object.timeSeries); + } + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.monitoring.v3.CreateTimeSeriesError.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + return message; + }; + + /** + * Creates a plain object from a CreateTimeSeriesError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {google.monitoring.v3.CreateTimeSeriesError} message CreateTimeSeriesError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateTimeSeriesError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.timeSeries = null; + object.status = null; + } + if (message.timeSeries != null && message.hasOwnProperty("timeSeries")) + object.timeSeries = $root.google.monitoring.v3.TimeSeries.toObject(message.timeSeries, options); + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + return object; + }; + + /** + * Converts this CreateTimeSeriesError to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @instance + * @returns {Object.} JSON object + */ + CreateTimeSeriesError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateTimeSeriesError + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateTimeSeriesError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateTimeSeriesError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateTimeSeriesError"; + }; + + return CreateTimeSeriesError; + })(); + + v3.CreateTimeSeriesSummary = (function() { + + /** + * Properties of a CreateTimeSeriesSummary. + * @memberof google.monitoring.v3 + * @interface ICreateTimeSeriesSummary + * @property {number|null} [totalPointCount] CreateTimeSeriesSummary totalPointCount + * @property {number|null} [successPointCount] CreateTimeSeriesSummary successPointCount + * @property {Array.|null} [errors] CreateTimeSeriesSummary errors + */ + + /** + * Constructs a new CreateTimeSeriesSummary. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateTimeSeriesSummary. + * @implements ICreateTimeSeriesSummary + * @constructor + * @param {google.monitoring.v3.ICreateTimeSeriesSummary=} [properties] Properties to set + */ + function CreateTimeSeriesSummary(properties) { + this.errors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateTimeSeriesSummary totalPointCount. + * @member {number} totalPointCount + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @instance + */ + CreateTimeSeriesSummary.prototype.totalPointCount = 0; + + /** + * CreateTimeSeriesSummary successPointCount. + * @member {number} successPointCount + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @instance + */ + CreateTimeSeriesSummary.prototype.successPointCount = 0; + + /** + * CreateTimeSeriesSummary errors. + * @member {Array.} errors + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @instance + */ + CreateTimeSeriesSummary.prototype.errors = $util.emptyArray; + + /** + * Creates a new CreateTimeSeriesSummary instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesSummary=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateTimeSeriesSummary} CreateTimeSeriesSummary instance + */ + CreateTimeSeriesSummary.create = function create(properties) { + return new CreateTimeSeriesSummary(properties); + }; + + /** + * Encodes the specified CreateTimeSeriesSummary message. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesSummary.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesSummary} message CreateTimeSeriesSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTimeSeriesSummary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.totalPointCount != null && Object.hasOwnProperty.call(message, "totalPointCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.totalPointCount); + if (message.successPointCount != null && Object.hasOwnProperty.call(message, "successPointCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.successPointCount); + if (message.errors != null && message.errors.length) + for (var i = 0; i < message.errors.length; ++i) + $root.google.monitoring.v3.CreateTimeSeriesSummary.Error.encode(message.errors[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateTimeSeriesSummary message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {google.monitoring.v3.ICreateTimeSeriesSummary} message CreateTimeSeriesSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateTimeSeriesSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateTimeSeriesSummary message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateTimeSeriesSummary} CreateTimeSeriesSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTimeSeriesSummary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateTimeSeriesSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.totalPointCount = reader.int32(); + break; + } + case 2: { + message.successPointCount = reader.int32(); + break; + } + case 3: { + if (!(message.errors && message.errors.length)) + message.errors = []; + message.errors.push($root.google.monitoring.v3.CreateTimeSeriesSummary.Error.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateTimeSeriesSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateTimeSeriesSummary} CreateTimeSeriesSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateTimeSeriesSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateTimeSeriesSummary message. + * @function verify + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateTimeSeriesSummary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.totalPointCount != null && message.hasOwnProperty("totalPointCount")) + if (!$util.isInteger(message.totalPointCount)) + return "totalPointCount: integer expected"; + if (message.successPointCount != null && message.hasOwnProperty("successPointCount")) + if (!$util.isInteger(message.successPointCount)) + return "successPointCount: integer expected"; + if (message.errors != null && message.hasOwnProperty("errors")) { + if (!Array.isArray(message.errors)) + return "errors: array expected"; + for (var i = 0; i < message.errors.length; ++i) { + var error = $root.google.monitoring.v3.CreateTimeSeriesSummary.Error.verify(message.errors[i]); + if (error) + return "errors." + error; + } + } + return null; + }; + + /** + * Creates a CreateTimeSeriesSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateTimeSeriesSummary} CreateTimeSeriesSummary + */ + CreateTimeSeriesSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateTimeSeriesSummary) + return object; + var message = new $root.google.monitoring.v3.CreateTimeSeriesSummary(); + if (object.totalPointCount != null) + message.totalPointCount = object.totalPointCount | 0; + if (object.successPointCount != null) + message.successPointCount = object.successPointCount | 0; + if (object.errors) { + if (!Array.isArray(object.errors)) + throw TypeError(".google.monitoring.v3.CreateTimeSeriesSummary.errors: array expected"); + message.errors = []; + for (var i = 0; i < object.errors.length; ++i) { + if (typeof object.errors[i] !== "object") + throw TypeError(".google.monitoring.v3.CreateTimeSeriesSummary.errors: object expected"); + message.errors[i] = $root.google.monitoring.v3.CreateTimeSeriesSummary.Error.fromObject(object.errors[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CreateTimeSeriesSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {google.monitoring.v3.CreateTimeSeriesSummary} message CreateTimeSeriesSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateTimeSeriesSummary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errors = []; + if (options.defaults) { + object.totalPointCount = 0; + object.successPointCount = 0; + } + if (message.totalPointCount != null && message.hasOwnProperty("totalPointCount")) + object.totalPointCount = message.totalPointCount; + if (message.successPointCount != null && message.hasOwnProperty("successPointCount")) + object.successPointCount = message.successPointCount; + if (message.errors && message.errors.length) { + object.errors = []; + for (var j = 0; j < message.errors.length; ++j) + object.errors[j] = $root.google.monitoring.v3.CreateTimeSeriesSummary.Error.toObject(message.errors[j], options); + } + return object; + }; + + /** + * Converts this CreateTimeSeriesSummary to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @instance + * @returns {Object.} JSON object + */ + CreateTimeSeriesSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateTimeSeriesSummary + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateTimeSeriesSummary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateTimeSeriesSummary"; + }; + + CreateTimeSeriesSummary.Error = (function() { + + /** + * Properties of an Error. + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @interface IError + * @property {google.rpc.IStatus|null} [status] Error status + * @property {number|null} [pointCount] Error pointCount + */ + + /** + * Constructs a new Error. + * @memberof google.monitoring.v3.CreateTimeSeriesSummary + * @classdesc Represents an Error. + * @implements IError + * @constructor + * @param {google.monitoring.v3.CreateTimeSeriesSummary.IError=} [properties] Properties to set + */ + function Error(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]]; + } + + /** + * Error status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @instance + */ + Error.prototype.status = null; + + /** + * Error pointCount. + * @member {number} pointCount + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @instance + */ + Error.prototype.pointCount = 0; + + /** + * Creates a new Error instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {google.monitoring.v3.CreateTimeSeriesSummary.IError=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateTimeSeriesSummary.Error} Error instance + */ + Error.create = function create(properties) { + return new Error(properties); + }; + + /** + * Encodes the specified Error message. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesSummary.Error.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {google.monitoring.v3.CreateTimeSeriesSummary.IError} message Error message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Error.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pointCount != null && Object.hasOwnProperty.call(message, "pointCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pointCount); + return writer; + }; + + /** + * Encodes the specified Error message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateTimeSeriesSummary.Error.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {google.monitoring.v3.CreateTimeSeriesSummary.IError} message Error message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Error.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Error message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateTimeSeriesSummary.Error} Error + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Error.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateTimeSeriesSummary.Error(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 2: { + message.pointCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Error message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateTimeSeriesSummary.Error} Error + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Error.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Error message. + * @function verify + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Error.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + if (message.pointCount != null && message.hasOwnProperty("pointCount")) + if (!$util.isInteger(message.pointCount)) + return "pointCount: integer expected"; + return null; + }; + + /** + * Creates an Error message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateTimeSeriesSummary.Error} Error + */ + Error.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateTimeSeriesSummary.Error) + return object; + var message = new $root.google.monitoring.v3.CreateTimeSeriesSummary.Error(); + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.monitoring.v3.CreateTimeSeriesSummary.Error.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + if (object.pointCount != null) + message.pointCount = object.pointCount | 0; + return message; + }; + + /** + * Creates a plain object from an Error message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {google.monitoring.v3.CreateTimeSeriesSummary.Error} message Error + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Error.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.status = null; + object.pointCount = 0; + } + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + if (message.pointCount != null && message.hasOwnProperty("pointCount")) + object.pointCount = message.pointCount; + return object; + }; + + /** + * Converts this Error to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @instance + * @returns {Object.} JSON object + */ + Error.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Error + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateTimeSeriesSummary.Error + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Error.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateTimeSeriesSummary.Error"; + }; + + return Error; + })(); + + return CreateTimeSeriesSummary; + })(); + + v3.QueryTimeSeriesRequest = (function() { + + /** + * Properties of a QueryTimeSeriesRequest. + * @memberof google.monitoring.v3 + * @interface IQueryTimeSeriesRequest + * @property {string|null} [name] QueryTimeSeriesRequest name + * @property {string|null} [query] QueryTimeSeriesRequest query + * @property {number|null} [pageSize] QueryTimeSeriesRequest pageSize + * @property {string|null} [pageToken] QueryTimeSeriesRequest pageToken + */ + + /** + * Constructs a new QueryTimeSeriesRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a QueryTimeSeriesRequest. + * @implements IQueryTimeSeriesRequest + * @constructor + * @param {google.monitoring.v3.IQueryTimeSeriesRequest=} [properties] Properties to set + */ + function QueryTimeSeriesRequest(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]]; + } + + /** + * QueryTimeSeriesRequest name. + * @member {string} name + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @instance + */ + QueryTimeSeriesRequest.prototype.name = ""; + + /** + * QueryTimeSeriesRequest query. + * @member {string} query + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @instance + */ + QueryTimeSeriesRequest.prototype.query = ""; + + /** + * QueryTimeSeriesRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @instance + */ + QueryTimeSeriesRequest.prototype.pageSize = 0; + + /** + * QueryTimeSeriesRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @instance + */ + QueryTimeSeriesRequest.prototype.pageToken = ""; + + /** + * Creates a new QueryTimeSeriesRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {google.monitoring.v3.IQueryTimeSeriesRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.QueryTimeSeriesRequest} QueryTimeSeriesRequest instance + */ + QueryTimeSeriesRequest.create = function create(properties) { + return new QueryTimeSeriesRequest(properties); + }; + + /** + * Encodes the specified QueryTimeSeriesRequest message. Does not implicitly {@link google.monitoring.v3.QueryTimeSeriesRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {google.monitoring.v3.IQueryTimeSeriesRequest} message QueryTimeSeriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTimeSeriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.query != null && Object.hasOwnProperty.call(message, "query")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.query); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified QueryTimeSeriesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.QueryTimeSeriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {google.monitoring.v3.IQueryTimeSeriesRequest} message QueryTimeSeriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTimeSeriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTimeSeriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.QueryTimeSeriesRequest} QueryTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTimeSeriesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.QueryTimeSeriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 7: { + message.query = reader.string(); + break; + } + case 9: { + message.pageSize = reader.int32(); + break; + } + case 10: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTimeSeriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.QueryTimeSeriesRequest} QueryTimeSeriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTimeSeriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTimeSeriesRequest message. + * @function verify + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTimeSeriesRequest.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.query != null && message.hasOwnProperty("query")) + if (!$util.isString(message.query)) + return "query: 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 QueryTimeSeriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.QueryTimeSeriesRequest} QueryTimeSeriesRequest + */ + QueryTimeSeriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.QueryTimeSeriesRequest) + return object; + var message = new $root.google.monitoring.v3.QueryTimeSeriesRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.query != null) + message.query = String(object.query); + 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 QueryTimeSeriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {google.monitoring.v3.QueryTimeSeriesRequest} message QueryTimeSeriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTimeSeriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.query = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.query != null && message.hasOwnProperty("query")) + object.query = message.query; + 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 QueryTimeSeriesRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @instance + * @returns {Object.} JSON object + */ + QueryTimeSeriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryTimeSeriesRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.QueryTimeSeriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryTimeSeriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.QueryTimeSeriesRequest"; + }; + + return QueryTimeSeriesRequest; + })(); + + v3.QueryTimeSeriesResponse = (function() { + + /** + * Properties of a QueryTimeSeriesResponse. + * @memberof google.monitoring.v3 + * @interface IQueryTimeSeriesResponse + * @property {google.monitoring.v3.ITimeSeriesDescriptor|null} [timeSeriesDescriptor] QueryTimeSeriesResponse timeSeriesDescriptor + * @property {Array.|null} [timeSeriesData] QueryTimeSeriesResponse timeSeriesData + * @property {string|null} [nextPageToken] QueryTimeSeriesResponse nextPageToken + * @property {Array.|null} [partialErrors] QueryTimeSeriesResponse partialErrors + */ + + /** + * Constructs a new QueryTimeSeriesResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a QueryTimeSeriesResponse. + * @implements IQueryTimeSeriesResponse + * @constructor + * @param {google.monitoring.v3.IQueryTimeSeriesResponse=} [properties] Properties to set + */ + function QueryTimeSeriesResponse(properties) { + this.timeSeriesData = []; + this.partialErrors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryTimeSeriesResponse timeSeriesDescriptor. + * @member {google.monitoring.v3.ITimeSeriesDescriptor|null|undefined} timeSeriesDescriptor + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @instance + */ + QueryTimeSeriesResponse.prototype.timeSeriesDescriptor = null; + + /** + * QueryTimeSeriesResponse timeSeriesData. + * @member {Array.} timeSeriesData + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @instance + */ + QueryTimeSeriesResponse.prototype.timeSeriesData = $util.emptyArray; + + /** + * QueryTimeSeriesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @instance + */ + QueryTimeSeriesResponse.prototype.nextPageToken = ""; + + /** + * QueryTimeSeriesResponse partialErrors. + * @member {Array.} partialErrors + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @instance + */ + QueryTimeSeriesResponse.prototype.partialErrors = $util.emptyArray; + + /** + * Creates a new QueryTimeSeriesResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {google.monitoring.v3.IQueryTimeSeriesResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.QueryTimeSeriesResponse} QueryTimeSeriesResponse instance + */ + QueryTimeSeriesResponse.create = function create(properties) { + return new QueryTimeSeriesResponse(properties); + }; + + /** + * Encodes the specified QueryTimeSeriesResponse message. Does not implicitly {@link google.monitoring.v3.QueryTimeSeriesResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {google.monitoring.v3.IQueryTimeSeriesResponse} message QueryTimeSeriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTimeSeriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timeSeriesDescriptor != null && Object.hasOwnProperty.call(message, "timeSeriesDescriptor")) + $root.google.monitoring.v3.TimeSeriesDescriptor.encode(message.timeSeriesDescriptor, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.timeSeriesData != null && message.timeSeriesData.length) + for (var i = 0; i < message.timeSeriesData.length; ++i) + $root.google.monitoring.v3.TimeSeriesData.encode(message.timeSeriesData[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.nextPageToken); + if (message.partialErrors != null && message.partialErrors.length) + for (var i = 0; i < message.partialErrors.length; ++i) + $root.google.rpc.Status.encode(message.partialErrors[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryTimeSeriesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.QueryTimeSeriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {google.monitoring.v3.IQueryTimeSeriesResponse} message QueryTimeSeriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryTimeSeriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryTimeSeriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.QueryTimeSeriesResponse} QueryTimeSeriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTimeSeriesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.QueryTimeSeriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 8: { + message.timeSeriesDescriptor = $root.google.monitoring.v3.TimeSeriesDescriptor.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.timeSeriesData && message.timeSeriesData.length)) + message.timeSeriesData = []; + message.timeSeriesData.push($root.google.monitoring.v3.TimeSeriesData.decode(reader, reader.uint32())); + break; + } + case 10: { + message.nextPageToken = reader.string(); + break; + } + case 11: { + if (!(message.partialErrors && message.partialErrors.length)) + message.partialErrors = []; + message.partialErrors.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryTimeSeriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.QueryTimeSeriesResponse} QueryTimeSeriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryTimeSeriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryTimeSeriesResponse message. + * @function verify + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryTimeSeriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timeSeriesDescriptor != null && message.hasOwnProperty("timeSeriesDescriptor")) { + var error = $root.google.monitoring.v3.TimeSeriesDescriptor.verify(message.timeSeriesDescriptor); + if (error) + return "timeSeriesDescriptor." + error; + } + if (message.timeSeriesData != null && message.hasOwnProperty("timeSeriesData")) { + if (!Array.isArray(message.timeSeriesData)) + return "timeSeriesData: array expected"; + for (var i = 0; i < message.timeSeriesData.length; ++i) { + var error = $root.google.monitoring.v3.TimeSeriesData.verify(message.timeSeriesData[i]); + if (error) + return "timeSeriesData." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.partialErrors != null && message.hasOwnProperty("partialErrors")) { + if (!Array.isArray(message.partialErrors)) + return "partialErrors: array expected"; + for (var i = 0; i < message.partialErrors.length; ++i) { + var error = $root.google.rpc.Status.verify(message.partialErrors[i]); + if (error) + return "partialErrors." + error; + } + } + return null; + }; + + /** + * Creates a QueryTimeSeriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.QueryTimeSeriesResponse} QueryTimeSeriesResponse + */ + QueryTimeSeriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.QueryTimeSeriesResponse) + return object; + var message = new $root.google.monitoring.v3.QueryTimeSeriesResponse(); + if (object.timeSeriesDescriptor != null) { + if (typeof object.timeSeriesDescriptor !== "object") + throw TypeError(".google.monitoring.v3.QueryTimeSeriesResponse.timeSeriesDescriptor: object expected"); + message.timeSeriesDescriptor = $root.google.monitoring.v3.TimeSeriesDescriptor.fromObject(object.timeSeriesDescriptor); + } + if (object.timeSeriesData) { + if (!Array.isArray(object.timeSeriesData)) + throw TypeError(".google.monitoring.v3.QueryTimeSeriesResponse.timeSeriesData: array expected"); + message.timeSeriesData = []; + for (var i = 0; i < object.timeSeriesData.length; ++i) { + if (typeof object.timeSeriesData[i] !== "object") + throw TypeError(".google.monitoring.v3.QueryTimeSeriesResponse.timeSeriesData: object expected"); + message.timeSeriesData[i] = $root.google.monitoring.v3.TimeSeriesData.fromObject(object.timeSeriesData[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.partialErrors) { + if (!Array.isArray(object.partialErrors)) + throw TypeError(".google.monitoring.v3.QueryTimeSeriesResponse.partialErrors: array expected"); + message.partialErrors = []; + for (var i = 0; i < object.partialErrors.length; ++i) { + if (typeof object.partialErrors[i] !== "object") + throw TypeError(".google.monitoring.v3.QueryTimeSeriesResponse.partialErrors: object expected"); + message.partialErrors[i] = $root.google.rpc.Status.fromObject(object.partialErrors[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a QueryTimeSeriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {google.monitoring.v3.QueryTimeSeriesResponse} message QueryTimeSeriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryTimeSeriesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.timeSeriesData = []; + object.partialErrors = []; + } + if (options.defaults) { + object.timeSeriesDescriptor = null; + object.nextPageToken = ""; + } + if (message.timeSeriesDescriptor != null && message.hasOwnProperty("timeSeriesDescriptor")) + object.timeSeriesDescriptor = $root.google.monitoring.v3.TimeSeriesDescriptor.toObject(message.timeSeriesDescriptor, options); + if (message.timeSeriesData && message.timeSeriesData.length) { + object.timeSeriesData = []; + for (var j = 0; j < message.timeSeriesData.length; ++j) + object.timeSeriesData[j] = $root.google.monitoring.v3.TimeSeriesData.toObject(message.timeSeriesData[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.partialErrors && message.partialErrors.length) { + object.partialErrors = []; + for (var j = 0; j < message.partialErrors.length; ++j) + object.partialErrors[j] = $root.google.rpc.Status.toObject(message.partialErrors[j], options); + } + return object; + }; + + /** + * Converts this QueryTimeSeriesResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @instance + * @returns {Object.} JSON object + */ + QueryTimeSeriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryTimeSeriesResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.QueryTimeSeriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryTimeSeriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.QueryTimeSeriesResponse"; + }; + + return QueryTimeSeriesResponse; + })(); + + v3.QueryErrorList = (function() { + + /** + * Properties of a QueryErrorList. + * @memberof google.monitoring.v3 + * @interface IQueryErrorList + * @property {Array.|null} [errors] QueryErrorList errors + * @property {string|null} [errorSummary] QueryErrorList errorSummary + */ + + /** + * Constructs a new QueryErrorList. + * @memberof google.monitoring.v3 + * @classdesc Represents a QueryErrorList. + * @implements IQueryErrorList + * @constructor + * @param {google.monitoring.v3.IQueryErrorList=} [properties] Properties to set + */ + function QueryErrorList(properties) { + this.errors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryErrorList errors. + * @member {Array.} errors + * @memberof google.monitoring.v3.QueryErrorList + * @instance + */ + QueryErrorList.prototype.errors = $util.emptyArray; + + /** + * QueryErrorList errorSummary. + * @member {string} errorSummary + * @memberof google.monitoring.v3.QueryErrorList + * @instance + */ + QueryErrorList.prototype.errorSummary = ""; + + /** + * Creates a new QueryErrorList instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {google.monitoring.v3.IQueryErrorList=} [properties] Properties to set + * @returns {google.monitoring.v3.QueryErrorList} QueryErrorList instance + */ + QueryErrorList.create = function create(properties) { + return new QueryErrorList(properties); + }; + + /** + * Encodes the specified QueryErrorList message. Does not implicitly {@link google.monitoring.v3.QueryErrorList.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {google.monitoring.v3.IQueryErrorList} message QueryErrorList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryErrorList.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.errors != null && message.errors.length) + for (var i = 0; i < message.errors.length; ++i) + $root.google.monitoring.v3.QueryError.encode(message.errors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.errorSummary != null && Object.hasOwnProperty.call(message, "errorSummary")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.errorSummary); + return writer; + }; + + /** + * Encodes the specified QueryErrorList message, length delimited. Does not implicitly {@link google.monitoring.v3.QueryErrorList.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {google.monitoring.v3.IQueryErrorList} message QueryErrorList message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryErrorList.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryErrorList message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.QueryErrorList} QueryErrorList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryErrorList.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.QueryErrorList(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.errors && message.errors.length)) + message.errors = []; + message.errors.push($root.google.monitoring.v3.QueryError.decode(reader, reader.uint32())); + break; + } + case 2: { + message.errorSummary = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryErrorList message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.QueryErrorList} QueryErrorList + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryErrorList.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryErrorList message. + * @function verify + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryErrorList.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.errors != null && message.hasOwnProperty("errors")) { + if (!Array.isArray(message.errors)) + return "errors: array expected"; + for (var i = 0; i < message.errors.length; ++i) { + var error = $root.google.monitoring.v3.QueryError.verify(message.errors[i]); + if (error) + return "errors." + error; + } + } + if (message.errorSummary != null && message.hasOwnProperty("errorSummary")) + if (!$util.isString(message.errorSummary)) + return "errorSummary: string expected"; + return null; + }; + + /** + * Creates a QueryErrorList message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.QueryErrorList} QueryErrorList + */ + QueryErrorList.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.QueryErrorList) + return object; + var message = new $root.google.monitoring.v3.QueryErrorList(); + if (object.errors) { + if (!Array.isArray(object.errors)) + throw TypeError(".google.monitoring.v3.QueryErrorList.errors: array expected"); + message.errors = []; + for (var i = 0; i < object.errors.length; ++i) { + if (typeof object.errors[i] !== "object") + throw TypeError(".google.monitoring.v3.QueryErrorList.errors: object expected"); + message.errors[i] = $root.google.monitoring.v3.QueryError.fromObject(object.errors[i]); + } + } + if (object.errorSummary != null) + message.errorSummary = String(object.errorSummary); + return message; + }; + + /** + * Creates a plain object from a QueryErrorList message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {google.monitoring.v3.QueryErrorList} message QueryErrorList + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryErrorList.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errors = []; + if (options.defaults) + object.errorSummary = ""; + if (message.errors && message.errors.length) { + object.errors = []; + for (var j = 0; j < message.errors.length; ++j) + object.errors[j] = $root.google.monitoring.v3.QueryError.toObject(message.errors[j], options); + } + if (message.errorSummary != null && message.hasOwnProperty("errorSummary")) + object.errorSummary = message.errorSummary; + return object; + }; + + /** + * Converts this QueryErrorList to JSON. + * @function toJSON + * @memberof google.monitoring.v3.QueryErrorList + * @instance + * @returns {Object.} JSON object + */ + QueryErrorList.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryErrorList + * @function getTypeUrl + * @memberof google.monitoring.v3.QueryErrorList + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryErrorList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.QueryErrorList"; + }; + + return QueryErrorList; + })(); + + v3.NotificationChannelDescriptor = (function() { + + /** + * Properties of a NotificationChannelDescriptor. + * @memberof google.monitoring.v3 + * @interface INotificationChannelDescriptor + * @property {string|null} [name] NotificationChannelDescriptor name + * @property {string|null} [type] NotificationChannelDescriptor type + * @property {string|null} [displayName] NotificationChannelDescriptor displayName + * @property {string|null} [description] NotificationChannelDescriptor description + * @property {Array.|null} [labels] NotificationChannelDescriptor labels + * @property {Array.|null} [supportedTiers] NotificationChannelDescriptor supportedTiers + * @property {google.api.LaunchStage|null} [launchStage] NotificationChannelDescriptor launchStage + */ + + /** + * Constructs a new NotificationChannelDescriptor. + * @memberof google.monitoring.v3 + * @classdesc Represents a NotificationChannelDescriptor. + * @implements INotificationChannelDescriptor + * @constructor + * @param {google.monitoring.v3.INotificationChannelDescriptor=} [properties] Properties to set + */ + function NotificationChannelDescriptor(properties) { + this.labels = []; + this.supportedTiers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NotificationChannelDescriptor name. + * @member {string} name + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @instance + */ + NotificationChannelDescriptor.prototype.name = ""; + + /** + * NotificationChannelDescriptor type. + * @member {string} type + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @instance + */ + NotificationChannelDescriptor.prototype.type = ""; + + /** + * NotificationChannelDescriptor displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @instance + */ + NotificationChannelDescriptor.prototype.displayName = ""; + + /** + * NotificationChannelDescriptor description. + * @member {string} description + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @instance + */ + NotificationChannelDescriptor.prototype.description = ""; + + /** + * NotificationChannelDescriptor labels. + * @member {Array.} labels + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @instance + */ + NotificationChannelDescriptor.prototype.labels = $util.emptyArray; + + /** + * NotificationChannelDescriptor supportedTiers. + * @member {Array.} supportedTiers + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @instance + */ + NotificationChannelDescriptor.prototype.supportedTiers = $util.emptyArray; + + /** + * NotificationChannelDescriptor launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @instance + */ + NotificationChannelDescriptor.prototype.launchStage = 0; + + /** + * Creates a new NotificationChannelDescriptor instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {google.monitoring.v3.INotificationChannelDescriptor=} [properties] Properties to set + * @returns {google.monitoring.v3.NotificationChannelDescriptor} NotificationChannelDescriptor instance + */ + NotificationChannelDescriptor.create = function create(properties) { + return new NotificationChannelDescriptor(properties); + }; + + /** + * Encodes the specified NotificationChannelDescriptor message. Does not implicitly {@link google.monitoring.v3.NotificationChannelDescriptor.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {google.monitoring.v3.INotificationChannelDescriptor} message NotificationChannelDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationChannelDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.labels != null && message.labels.length) + for (var i = 0; i < message.labels.length; ++i) + $root.google.api.LabelDescriptor.encode(message.labels[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.supportedTiers != null && message.supportedTiers.length) { + writer.uint32(/* id 5, wireType 2 =*/42).fork(); + for (var i = 0; i < message.supportedTiers.length; ++i) + writer.int32(message.supportedTiers[i]); + writer.ldelim(); + } + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.name); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.launchStage); + return writer; + }; + + /** + * Encodes the specified NotificationChannelDescriptor message, length delimited. Does not implicitly {@link google.monitoring.v3.NotificationChannelDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {google.monitoring.v3.INotificationChannelDescriptor} message NotificationChannelDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationChannelDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NotificationChannelDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.NotificationChannelDescriptor} NotificationChannelDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationChannelDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.NotificationChannelDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: { + message.name = reader.string(); + break; + } + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + if (!(message.labels && message.labels.length)) + message.labels = []; + message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.supportedTiers && message.supportedTiers.length)) + message.supportedTiers = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.supportedTiers.push(reader.int32()); + } else + message.supportedTiers.push(reader.int32()); + break; + } + case 7: { + message.launchStage = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NotificationChannelDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.NotificationChannelDescriptor} NotificationChannelDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationChannelDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NotificationChannelDescriptor message. + * @function verify + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NotificationChannelDescriptor.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.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) { + var error = $root.google.api.LabelDescriptor.verify(message.labels[i]); + if (error) + return "labels." + error; + } + } + if (message.supportedTiers != null && message.hasOwnProperty("supportedTiers")) { + if (!Array.isArray(message.supportedTiers)) + return "supportedTiers: array expected"; + for (var i = 0; i < message.supportedTiers.length; ++i) + switch (message.supportedTiers[i]) { + default: + return "supportedTiers: enum value[] expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a NotificationChannelDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.NotificationChannelDescriptor} NotificationChannelDescriptor + */ + NotificationChannelDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.NotificationChannelDescriptor) + return object; + var message = new $root.google.monitoring.v3.NotificationChannelDescriptor(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.monitoring.v3.NotificationChannelDescriptor.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) { + if (typeof object.labels[i] !== "object") + throw TypeError(".google.monitoring.v3.NotificationChannelDescriptor.labels: object expected"); + message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i]); + } + } + if (object.supportedTiers) { + if (!Array.isArray(object.supportedTiers)) + throw TypeError(".google.monitoring.v3.NotificationChannelDescriptor.supportedTiers: array expected"); + message.supportedTiers = []; + for (var i = 0; i < object.supportedTiers.length; ++i) + switch (object.supportedTiers[i]) { + default: + if (typeof object.supportedTiers[i] === "number") { + message.supportedTiers[i] = object.supportedTiers[i]; + break; + } + case "SERVICE_TIER_UNSPECIFIED": + case 0: + message.supportedTiers[i] = 0; + break; + case "SERVICE_TIER_BASIC": + case 1: + message.supportedTiers[i] = 1; + break; + case "SERVICE_TIER_PREMIUM": + case 2: + message.supportedTiers[i] = 2; + break; + } + } + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from a NotificationChannelDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {google.monitoring.v3.NotificationChannelDescriptor} message NotificationChannelDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NotificationChannelDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.labels = []; + object.supportedTiers = []; + } + if (options.defaults) { + object.type = ""; + object.displayName = ""; + object.description = ""; + object.name = ""; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = $root.google.api.LabelDescriptor.toObject(message.labels[j], options); + } + if (message.supportedTiers && message.supportedTiers.length) { + object.supportedTiers = []; + for (var j = 0; j < message.supportedTiers.length; ++j) + object.supportedTiers[j] = options.enums === String ? $root.google.monitoring.v3.ServiceTier[message.supportedTiers[j]] === undefined ? message.supportedTiers[j] : $root.google.monitoring.v3.ServiceTier[message.supportedTiers[j]] : message.supportedTiers[j]; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + return object; + }; + + /** + * Converts this NotificationChannelDescriptor to JSON. + * @function toJSON + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @instance + * @returns {Object.} JSON object + */ + NotificationChannelDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NotificationChannelDescriptor + * @function getTypeUrl + * @memberof google.monitoring.v3.NotificationChannelDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NotificationChannelDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.NotificationChannelDescriptor"; + }; + + return NotificationChannelDescriptor; + })(); + + v3.NotificationChannel = (function() { + + /** + * Properties of a NotificationChannel. + * @memberof google.monitoring.v3 + * @interface INotificationChannel + * @property {string|null} [type] NotificationChannel type + * @property {string|null} [name] NotificationChannel name + * @property {string|null} [displayName] NotificationChannel displayName + * @property {string|null} [description] NotificationChannel description + * @property {Object.|null} [labels] NotificationChannel labels + * @property {Object.|null} [userLabels] NotificationChannel userLabels + * @property {google.monitoring.v3.NotificationChannel.VerificationStatus|null} [verificationStatus] NotificationChannel verificationStatus + * @property {google.protobuf.IBoolValue|null} [enabled] NotificationChannel enabled + * @property {google.monitoring.v3.IMutationRecord|null} [creationRecord] NotificationChannel creationRecord + * @property {Array.|null} [mutationRecords] NotificationChannel mutationRecords + */ + + /** + * Constructs a new NotificationChannel. + * @memberof google.monitoring.v3 + * @classdesc Represents a NotificationChannel. + * @implements INotificationChannel + * @constructor + * @param {google.monitoring.v3.INotificationChannel=} [properties] Properties to set + */ + function NotificationChannel(properties) { + this.labels = {}; + this.userLabels = {}; + this.mutationRecords = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NotificationChannel type. + * @member {string} type + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.type = ""; + + /** + * NotificationChannel name. + * @member {string} name + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.name = ""; + + /** + * NotificationChannel displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.displayName = ""; + + /** + * NotificationChannel description. + * @member {string} description + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.description = ""; + + /** + * NotificationChannel labels. + * @member {Object.} labels + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.labels = $util.emptyObject; + + /** + * NotificationChannel userLabels. + * @member {Object.} userLabels + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.userLabels = $util.emptyObject; + + /** + * NotificationChannel verificationStatus. + * @member {google.monitoring.v3.NotificationChannel.VerificationStatus} verificationStatus + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.verificationStatus = 0; + + /** + * NotificationChannel enabled. + * @member {google.protobuf.IBoolValue|null|undefined} enabled + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.enabled = null; + + /** + * NotificationChannel creationRecord. + * @member {google.monitoring.v3.IMutationRecord|null|undefined} creationRecord + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.creationRecord = null; + + /** + * NotificationChannel mutationRecords. + * @member {Array.} mutationRecords + * @memberof google.monitoring.v3.NotificationChannel + * @instance + */ + NotificationChannel.prototype.mutationRecords = $util.emptyArray; + + /** + * Creates a new NotificationChannel instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {google.monitoring.v3.INotificationChannel=} [properties] Properties to set + * @returns {google.monitoring.v3.NotificationChannel} NotificationChannel instance + */ + NotificationChannel.create = function create(properties) { + return new NotificationChannel(properties); + }; + + /** + * Encodes the specified NotificationChannel message. Does not implicitly {@link google.monitoring.v3.NotificationChannel.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {google.monitoring.v3.INotificationChannel} message NotificationChannel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationChannel.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.description); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.name); + if (message.userLabels != null && Object.hasOwnProperty.call(message, "userLabels")) + for (var keys = Object.keys(message.userLabels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userLabels[keys[i]]).ldelim(); + if (message.verificationStatus != null && Object.hasOwnProperty.call(message, "verificationStatus")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.verificationStatus); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + $root.google.protobuf.BoolValue.encode(message.enabled, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.creationRecord != null && Object.hasOwnProperty.call(message, "creationRecord")) + $root.google.monitoring.v3.MutationRecord.encode(message.creationRecord, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.mutationRecords != null && message.mutationRecords.length) + for (var i = 0; i < message.mutationRecords.length; ++i) + $root.google.monitoring.v3.MutationRecord.encode(message.mutationRecords[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NotificationChannel message, length delimited. Does not implicitly {@link google.monitoring.v3.NotificationChannel.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {google.monitoring.v3.INotificationChannel} message NotificationChannel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationChannel.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NotificationChannel message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.NotificationChannel} NotificationChannel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationChannel.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.NotificationChannel(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 6: { + message.name = reader.string(); + break; + } + case 3: { + message.displayName = reader.string(); + break; + } + case 4: { + message.description = reader.string(); + break; + } + case 5: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 8: { + if (message.userLabels === $util.emptyObject) + message.userLabels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.userLabels[key] = value; + break; + } + case 9: { + message.verificationStatus = reader.int32(); + break; + } + case 11: { + message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 12: { + message.creationRecord = $root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32()); + break; + } + case 13: { + if (!(message.mutationRecords && message.mutationRecords.length)) + message.mutationRecords = []; + message.mutationRecords.push($root.google.monitoring.v3.MutationRecord.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NotificationChannel message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.NotificationChannel} NotificationChannel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationChannel.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NotificationChannel message. + * @function verify + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NotificationChannel.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.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.userLabels != null && message.hasOwnProperty("userLabels")) { + if (!$util.isObject(message.userLabels)) + return "userLabels: object expected"; + var key = Object.keys(message.userLabels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.userLabels[key[i]])) + return "userLabels: string{k:string} expected"; + } + if (message.verificationStatus != null && message.hasOwnProperty("verificationStatus")) + switch (message.verificationStatus) { + default: + return "verificationStatus: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.enabled); + if (error) + return "enabled." + error; + } + if (message.creationRecord != null && message.hasOwnProperty("creationRecord")) { + var error = $root.google.monitoring.v3.MutationRecord.verify(message.creationRecord); + if (error) + return "creationRecord." + error; + } + if (message.mutationRecords != null && message.hasOwnProperty("mutationRecords")) { + if (!Array.isArray(message.mutationRecords)) + return "mutationRecords: array expected"; + for (var i = 0; i < message.mutationRecords.length; ++i) { + var error = $root.google.monitoring.v3.MutationRecord.verify(message.mutationRecords[i]); + if (error) + return "mutationRecords." + error; + } + } + return null; + }; + + /** + * Creates a NotificationChannel message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.NotificationChannel} NotificationChannel + */ + NotificationChannel.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.NotificationChannel) + return object; + var message = new $root.google.monitoring.v3.NotificationChannel(); + if (object.type != null) + message.type = String(object.type); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.monitoring.v3.NotificationChannel.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.userLabels) { + if (typeof object.userLabels !== "object") + throw TypeError(".google.monitoring.v3.NotificationChannel.userLabels: object expected"); + message.userLabels = {}; + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } + switch (object.verificationStatus) { + default: + if (typeof object.verificationStatus === "number") { + message.verificationStatus = object.verificationStatus; + break; + } + break; + case "VERIFICATION_STATUS_UNSPECIFIED": + case 0: + message.verificationStatus = 0; + break; + case "UNVERIFIED": + case 1: + message.verificationStatus = 1; + break; + case "VERIFIED": + case 2: + message.verificationStatus = 2; + break; + } + if (object.enabled != null) { + if (typeof object.enabled !== "object") + throw TypeError(".google.monitoring.v3.NotificationChannel.enabled: object expected"); + message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled); + } + if (object.creationRecord != null) { + if (typeof object.creationRecord !== "object") + throw TypeError(".google.monitoring.v3.NotificationChannel.creationRecord: object expected"); + message.creationRecord = $root.google.monitoring.v3.MutationRecord.fromObject(object.creationRecord); + } + if (object.mutationRecords) { + if (!Array.isArray(object.mutationRecords)) + throw TypeError(".google.monitoring.v3.NotificationChannel.mutationRecords: array expected"); + message.mutationRecords = []; + for (var i = 0; i < object.mutationRecords.length; ++i) { + if (typeof object.mutationRecords[i] !== "object") + throw TypeError(".google.monitoring.v3.NotificationChannel.mutationRecords: object expected"); + message.mutationRecords[i] = $root.google.monitoring.v3.MutationRecord.fromObject(object.mutationRecords[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a NotificationChannel message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {google.monitoring.v3.NotificationChannel} message NotificationChannel + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NotificationChannel.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.mutationRecords = []; + if (options.objects || options.defaults) { + object.labels = {}; + object.userLabels = {}; + } + if (options.defaults) { + object.type = ""; + object.displayName = ""; + object.description = ""; + object.name = ""; + object.verificationStatus = options.enums === String ? "VERIFICATION_STATUS_UNSPECIFIED" : 0; + object.enabled = null; + object.creationRecord = null; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { + object.userLabels = {}; + for (var j = 0; j < keys2.length; ++j) + object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } + if (message.verificationStatus != null && message.hasOwnProperty("verificationStatus")) + object.verificationStatus = options.enums === String ? $root.google.monitoring.v3.NotificationChannel.VerificationStatus[message.verificationStatus] === undefined ? message.verificationStatus : $root.google.monitoring.v3.NotificationChannel.VerificationStatus[message.verificationStatus] : message.verificationStatus; + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = $root.google.protobuf.BoolValue.toObject(message.enabled, options); + if (message.creationRecord != null && message.hasOwnProperty("creationRecord")) + object.creationRecord = $root.google.monitoring.v3.MutationRecord.toObject(message.creationRecord, options); + if (message.mutationRecords && message.mutationRecords.length) { + object.mutationRecords = []; + for (var j = 0; j < message.mutationRecords.length; ++j) + object.mutationRecords[j] = $root.google.monitoring.v3.MutationRecord.toObject(message.mutationRecords[j], options); + } + return object; + }; + + /** + * Converts this NotificationChannel to JSON. + * @function toJSON + * @memberof google.monitoring.v3.NotificationChannel + * @instance + * @returns {Object.} JSON object + */ + NotificationChannel.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NotificationChannel + * @function getTypeUrl + * @memberof google.monitoring.v3.NotificationChannel + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NotificationChannel.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.NotificationChannel"; + }; + + /** + * VerificationStatus enum. + * @name google.monitoring.v3.NotificationChannel.VerificationStatus + * @enum {number} + * @property {number} VERIFICATION_STATUS_UNSPECIFIED=0 VERIFICATION_STATUS_UNSPECIFIED value + * @property {number} UNVERIFIED=1 UNVERIFIED value + * @property {number} VERIFIED=2 VERIFIED value + */ + NotificationChannel.VerificationStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VERIFICATION_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "UNVERIFIED"] = 1; + values[valuesById[2] = "VERIFIED"] = 2; + return values; + })(); + + return NotificationChannel; + })(); + + v3.NotificationChannelService = (function() { + + /** + * Constructs a new NotificationChannelService service. + * @memberof google.monitoring.v3 + * @classdesc Represents a NotificationChannelService + * @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 NotificationChannelService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (NotificationChannelService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = NotificationChannelService; + + /** + * Creates new NotificationChannelService service using the specified rpc implementation. + * @function create + * @memberof google.monitoring.v3.NotificationChannelService + * @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 {NotificationChannelService} RPC service. Useful where requests and/or responses are streamed. + */ + NotificationChannelService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|listNotificationChannelDescriptors}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef ListNotificationChannelDescriptorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListNotificationChannelDescriptorsResponse} [response] ListNotificationChannelDescriptorsResponse + */ + + /** + * Calls ListNotificationChannelDescriptors. + * @function listNotificationChannelDescriptors + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsRequest} request ListNotificationChannelDescriptorsRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.ListNotificationChannelDescriptorsCallback} callback Node-style callback called with the error, if any, and ListNotificationChannelDescriptorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.listNotificationChannelDescriptors = function listNotificationChannelDescriptors(request, callback) { + return this.rpcCall(listNotificationChannelDescriptors, $root.google.monitoring.v3.ListNotificationChannelDescriptorsRequest, $root.google.monitoring.v3.ListNotificationChannelDescriptorsResponse, request, callback); + }, "name", { value: "ListNotificationChannelDescriptors" }); + + /** + * Calls ListNotificationChannelDescriptors. + * @function listNotificationChannelDescriptors + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsRequest} request ListNotificationChannelDescriptorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|getNotificationChannelDescriptor}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef GetNotificationChannelDescriptorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.NotificationChannelDescriptor} [response] NotificationChannelDescriptor + */ + + /** + * Calls GetNotificationChannelDescriptor. + * @function getNotificationChannelDescriptor + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IGetNotificationChannelDescriptorRequest} request GetNotificationChannelDescriptorRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptorCallback} callback Node-style callback called with the error, if any, and NotificationChannelDescriptor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.getNotificationChannelDescriptor = function getNotificationChannelDescriptor(request, callback) { + return this.rpcCall(getNotificationChannelDescriptor, $root.google.monitoring.v3.GetNotificationChannelDescriptorRequest, $root.google.monitoring.v3.NotificationChannelDescriptor, request, callback); + }, "name", { value: "GetNotificationChannelDescriptor" }); + + /** + * Calls GetNotificationChannelDescriptor. + * @function getNotificationChannelDescriptor + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IGetNotificationChannelDescriptorRequest} request GetNotificationChannelDescriptorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|listNotificationChannels}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef ListNotificationChannelsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListNotificationChannelsResponse} [response] ListNotificationChannelsResponse + */ + + /** + * Calls ListNotificationChannels. + * @function listNotificationChannels + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IListNotificationChannelsRequest} request ListNotificationChannelsRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.ListNotificationChannelsCallback} callback Node-style callback called with the error, if any, and ListNotificationChannelsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.listNotificationChannels = function listNotificationChannels(request, callback) { + return this.rpcCall(listNotificationChannels, $root.google.monitoring.v3.ListNotificationChannelsRequest, $root.google.monitoring.v3.ListNotificationChannelsResponse, request, callback); + }, "name", { value: "ListNotificationChannels" }); + + /** + * Calls ListNotificationChannels. + * @function listNotificationChannels + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IListNotificationChannelsRequest} request ListNotificationChannelsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|getNotificationChannel}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef GetNotificationChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.NotificationChannel} [response] NotificationChannel + */ + + /** + * Calls GetNotificationChannel. + * @function getNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IGetNotificationChannelRequest} request GetNotificationChannelRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.GetNotificationChannelCallback} callback Node-style callback called with the error, if any, and NotificationChannel + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.getNotificationChannel = function getNotificationChannel(request, callback) { + return this.rpcCall(getNotificationChannel, $root.google.monitoring.v3.GetNotificationChannelRequest, $root.google.monitoring.v3.NotificationChannel, request, callback); + }, "name", { value: "GetNotificationChannel" }); + + /** + * Calls GetNotificationChannel. + * @function getNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IGetNotificationChannelRequest} request GetNotificationChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|createNotificationChannel}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef CreateNotificationChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.NotificationChannel} [response] NotificationChannel + */ + + /** + * Calls CreateNotificationChannel. + * @function createNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.ICreateNotificationChannelRequest} request CreateNotificationChannelRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.CreateNotificationChannelCallback} callback Node-style callback called with the error, if any, and NotificationChannel + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.createNotificationChannel = function createNotificationChannel(request, callback) { + return this.rpcCall(createNotificationChannel, $root.google.monitoring.v3.CreateNotificationChannelRequest, $root.google.monitoring.v3.NotificationChannel, request, callback); + }, "name", { value: "CreateNotificationChannel" }); + + /** + * Calls CreateNotificationChannel. + * @function createNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.ICreateNotificationChannelRequest} request CreateNotificationChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|updateNotificationChannel}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef UpdateNotificationChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.NotificationChannel} [response] NotificationChannel + */ + + /** + * Calls UpdateNotificationChannel. + * @function updateNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IUpdateNotificationChannelRequest} request UpdateNotificationChannelRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.UpdateNotificationChannelCallback} callback Node-style callback called with the error, if any, and NotificationChannel + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.updateNotificationChannel = function updateNotificationChannel(request, callback) { + return this.rpcCall(updateNotificationChannel, $root.google.monitoring.v3.UpdateNotificationChannelRequest, $root.google.monitoring.v3.NotificationChannel, request, callback); + }, "name", { value: "UpdateNotificationChannel" }); + + /** + * Calls UpdateNotificationChannel. + * @function updateNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IUpdateNotificationChannelRequest} request UpdateNotificationChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|deleteNotificationChannel}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef DeleteNotificationChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteNotificationChannel. + * @function deleteNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IDeleteNotificationChannelRequest} request DeleteNotificationChannelRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.DeleteNotificationChannelCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.deleteNotificationChannel = function deleteNotificationChannel(request, callback) { + return this.rpcCall(deleteNotificationChannel, $root.google.monitoring.v3.DeleteNotificationChannelRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteNotificationChannel" }); + + /** + * Calls DeleteNotificationChannel. + * @function deleteNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IDeleteNotificationChannelRequest} request DeleteNotificationChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|sendNotificationChannelVerificationCode}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef SendNotificationChannelVerificationCodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls SendNotificationChannelVerificationCode. + * @function sendNotificationChannelVerificationCode + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest} request SendNotificationChannelVerificationCodeRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.SendNotificationChannelVerificationCodeCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.sendNotificationChannelVerificationCode = function sendNotificationChannelVerificationCode(request, callback) { + return this.rpcCall(sendNotificationChannelVerificationCode, $root.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "SendNotificationChannelVerificationCode" }); + + /** + * Calls SendNotificationChannelVerificationCode. + * @function sendNotificationChannelVerificationCode + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest} request SendNotificationChannelVerificationCodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|getNotificationChannelVerificationCode}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef GetNotificationChannelVerificationCodeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.GetNotificationChannelVerificationCodeResponse} [response] GetNotificationChannelVerificationCodeResponse + */ + + /** + * Calls GetNotificationChannelVerificationCode. + * @function getNotificationChannelVerificationCode + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest} request GetNotificationChannelVerificationCodeRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.GetNotificationChannelVerificationCodeCallback} callback Node-style callback called with the error, if any, and GetNotificationChannelVerificationCodeResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.getNotificationChannelVerificationCode = function getNotificationChannelVerificationCode(request, callback) { + return this.rpcCall(getNotificationChannelVerificationCode, $root.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest, $root.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse, request, callback); + }, "name", { value: "GetNotificationChannelVerificationCode" }); + + /** + * Calls GetNotificationChannelVerificationCode. + * @function getNotificationChannelVerificationCode + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest} request GetNotificationChannelVerificationCodeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.NotificationChannelService|verifyNotificationChannel}. + * @memberof google.monitoring.v3.NotificationChannelService + * @typedef VerifyNotificationChannelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.NotificationChannel} [response] NotificationChannel + */ + + /** + * Calls VerifyNotificationChannel. + * @function verifyNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IVerifyNotificationChannelRequest} request VerifyNotificationChannelRequest message or plain object + * @param {google.monitoring.v3.NotificationChannelService.VerifyNotificationChannelCallback} callback Node-style callback called with the error, if any, and NotificationChannel + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(NotificationChannelService.prototype.verifyNotificationChannel = function verifyNotificationChannel(request, callback) { + return this.rpcCall(verifyNotificationChannel, $root.google.monitoring.v3.VerifyNotificationChannelRequest, $root.google.monitoring.v3.NotificationChannel, request, callback); + }, "name", { value: "VerifyNotificationChannel" }); + + /** + * Calls VerifyNotificationChannel. + * @function verifyNotificationChannel + * @memberof google.monitoring.v3.NotificationChannelService + * @instance + * @param {google.monitoring.v3.IVerifyNotificationChannelRequest} request VerifyNotificationChannelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return NotificationChannelService; + })(); + + v3.ListNotificationChannelDescriptorsRequest = (function() { + + /** + * Properties of a ListNotificationChannelDescriptorsRequest. + * @memberof google.monitoring.v3 + * @interface IListNotificationChannelDescriptorsRequest + * @property {string|null} [name] ListNotificationChannelDescriptorsRequest name + * @property {number|null} [pageSize] ListNotificationChannelDescriptorsRequest pageSize + * @property {string|null} [pageToken] ListNotificationChannelDescriptorsRequest pageToken + */ + + /** + * Constructs a new ListNotificationChannelDescriptorsRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListNotificationChannelDescriptorsRequest. + * @implements IListNotificationChannelDescriptorsRequest + * @constructor + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsRequest=} [properties] Properties to set + */ + function ListNotificationChannelDescriptorsRequest(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]]; + } + + /** + * ListNotificationChannelDescriptorsRequest name. + * @member {string} name + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @instance + */ + ListNotificationChannelDescriptorsRequest.prototype.name = ""; + + /** + * ListNotificationChannelDescriptorsRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @instance + */ + ListNotificationChannelDescriptorsRequest.prototype.pageSize = 0; + + /** + * ListNotificationChannelDescriptorsRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @instance + */ + ListNotificationChannelDescriptorsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListNotificationChannelDescriptorsRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsRequest} ListNotificationChannelDescriptorsRequest instance + */ + ListNotificationChannelDescriptorsRequest.create = function create(properties) { + return new ListNotificationChannelDescriptorsRequest(properties); + }; + + /** + * Encodes the specified ListNotificationChannelDescriptorsRequest message. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelDescriptorsRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsRequest} message ListNotificationChannelDescriptorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNotificationChannelDescriptorsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListNotificationChannelDescriptorsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelDescriptorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsRequest} message ListNotificationChannelDescriptorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNotificationChannelDescriptorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListNotificationChannelDescriptorsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsRequest} ListNotificationChannelDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNotificationChannelDescriptorsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + 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 ListNotificationChannelDescriptorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsRequest} ListNotificationChannelDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNotificationChannelDescriptorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListNotificationChannelDescriptorsRequest message. + * @function verify + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListNotificationChannelDescriptorsRequest.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 ListNotificationChannelDescriptorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsRequest} ListNotificationChannelDescriptorsRequest + */ + ListNotificationChannelDescriptorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListNotificationChannelDescriptorsRequest) + return object; + var message = new $root.google.monitoring.v3.ListNotificationChannelDescriptorsRequest(); + 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 ListNotificationChannelDescriptorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {google.monitoring.v3.ListNotificationChannelDescriptorsRequest} message ListNotificationChannelDescriptorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListNotificationChannelDescriptorsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListNotificationChannelDescriptorsRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @instance + * @returns {Object.} JSON object + */ + ListNotificationChannelDescriptorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListNotificationChannelDescriptorsRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListNotificationChannelDescriptorsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListNotificationChannelDescriptorsRequest"; + }; + + return ListNotificationChannelDescriptorsRequest; + })(); + + v3.ListNotificationChannelDescriptorsResponse = (function() { + + /** + * Properties of a ListNotificationChannelDescriptorsResponse. + * @memberof google.monitoring.v3 + * @interface IListNotificationChannelDescriptorsResponse + * @property {Array.|null} [channelDescriptors] ListNotificationChannelDescriptorsResponse channelDescriptors + * @property {string|null} [nextPageToken] ListNotificationChannelDescriptorsResponse nextPageToken + */ + + /** + * Constructs a new ListNotificationChannelDescriptorsResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListNotificationChannelDescriptorsResponse. + * @implements IListNotificationChannelDescriptorsResponse + * @constructor + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsResponse=} [properties] Properties to set + */ + function ListNotificationChannelDescriptorsResponse(properties) { + this.channelDescriptors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListNotificationChannelDescriptorsResponse channelDescriptors. + * @member {Array.} channelDescriptors + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @instance + */ + ListNotificationChannelDescriptorsResponse.prototype.channelDescriptors = $util.emptyArray; + + /** + * ListNotificationChannelDescriptorsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @instance + */ + ListNotificationChannelDescriptorsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListNotificationChannelDescriptorsResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsResponse} ListNotificationChannelDescriptorsResponse instance + */ + ListNotificationChannelDescriptorsResponse.create = function create(properties) { + return new ListNotificationChannelDescriptorsResponse(properties); + }; + + /** + * Encodes the specified ListNotificationChannelDescriptorsResponse message. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelDescriptorsResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsResponse} message ListNotificationChannelDescriptorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNotificationChannelDescriptorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.channelDescriptors != null && message.channelDescriptors.length) + for (var i = 0; i < message.channelDescriptors.length; ++i) + $root.google.monitoring.v3.NotificationChannelDescriptor.encode(message.channelDescriptors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListNotificationChannelDescriptorsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelDescriptorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {google.monitoring.v3.IListNotificationChannelDescriptorsResponse} message ListNotificationChannelDescriptorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNotificationChannelDescriptorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListNotificationChannelDescriptorsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsResponse} ListNotificationChannelDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNotificationChannelDescriptorsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListNotificationChannelDescriptorsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.channelDescriptors && message.channelDescriptors.length)) + message.channelDescriptors = []; + message.channelDescriptors.push($root.google.monitoring.v3.NotificationChannelDescriptor.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListNotificationChannelDescriptorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsResponse} ListNotificationChannelDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNotificationChannelDescriptorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListNotificationChannelDescriptorsResponse message. + * @function verify + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListNotificationChannelDescriptorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.channelDescriptors != null && message.hasOwnProperty("channelDescriptors")) { + if (!Array.isArray(message.channelDescriptors)) + return "channelDescriptors: array expected"; + for (var i = 0; i < message.channelDescriptors.length; ++i) { + var error = $root.google.monitoring.v3.NotificationChannelDescriptor.verify(message.channelDescriptors[i]); + if (error) + return "channelDescriptors." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListNotificationChannelDescriptorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListNotificationChannelDescriptorsResponse} ListNotificationChannelDescriptorsResponse + */ + ListNotificationChannelDescriptorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListNotificationChannelDescriptorsResponse) + return object; + var message = new $root.google.monitoring.v3.ListNotificationChannelDescriptorsResponse(); + if (object.channelDescriptors) { + if (!Array.isArray(object.channelDescriptors)) + throw TypeError(".google.monitoring.v3.ListNotificationChannelDescriptorsResponse.channelDescriptors: array expected"); + message.channelDescriptors = []; + for (var i = 0; i < object.channelDescriptors.length; ++i) { + if (typeof object.channelDescriptors[i] !== "object") + throw TypeError(".google.monitoring.v3.ListNotificationChannelDescriptorsResponse.channelDescriptors: object expected"); + message.channelDescriptors[i] = $root.google.monitoring.v3.NotificationChannelDescriptor.fromObject(object.channelDescriptors[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListNotificationChannelDescriptorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {google.monitoring.v3.ListNotificationChannelDescriptorsResponse} message ListNotificationChannelDescriptorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListNotificationChannelDescriptorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.channelDescriptors = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.channelDescriptors && message.channelDescriptors.length) { + object.channelDescriptors = []; + for (var j = 0; j < message.channelDescriptors.length; ++j) + object.channelDescriptors[j] = $root.google.monitoring.v3.NotificationChannelDescriptor.toObject(message.channelDescriptors[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListNotificationChannelDescriptorsResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @instance + * @returns {Object.} JSON object + */ + ListNotificationChannelDescriptorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListNotificationChannelDescriptorsResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListNotificationChannelDescriptorsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListNotificationChannelDescriptorsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListNotificationChannelDescriptorsResponse"; + }; + + return ListNotificationChannelDescriptorsResponse; + })(); + + v3.GetNotificationChannelDescriptorRequest = (function() { + + /** + * Properties of a GetNotificationChannelDescriptorRequest. + * @memberof google.monitoring.v3 + * @interface IGetNotificationChannelDescriptorRequest + * @property {string|null} [name] GetNotificationChannelDescriptorRequest name + */ + + /** + * Constructs a new GetNotificationChannelDescriptorRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetNotificationChannelDescriptorRequest. + * @implements IGetNotificationChannelDescriptorRequest + * @constructor + * @param {google.monitoring.v3.IGetNotificationChannelDescriptorRequest=} [properties] Properties to set + */ + function GetNotificationChannelDescriptorRequest(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]]; + } + + /** + * GetNotificationChannelDescriptorRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @instance + */ + GetNotificationChannelDescriptorRequest.prototype.name = ""; + + /** + * Creates a new GetNotificationChannelDescriptorRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelDescriptorRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetNotificationChannelDescriptorRequest} GetNotificationChannelDescriptorRequest instance + */ + GetNotificationChannelDescriptorRequest.create = function create(properties) { + return new GetNotificationChannelDescriptorRequest(properties); + }; + + /** + * Encodes the specified GetNotificationChannelDescriptorRequest message. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelDescriptorRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelDescriptorRequest} message GetNotificationChannelDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNotificationChannelDescriptorRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetNotificationChannelDescriptorRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelDescriptorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelDescriptorRequest} message GetNotificationChannelDescriptorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNotificationChannelDescriptorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNotificationChannelDescriptorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetNotificationChannelDescriptorRequest} GetNotificationChannelDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNotificationChannelDescriptorRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetNotificationChannelDescriptorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetNotificationChannelDescriptorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetNotificationChannelDescriptorRequest} GetNotificationChannelDescriptorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNotificationChannelDescriptorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNotificationChannelDescriptorRequest message. + * @function verify + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNotificationChannelDescriptorRequest.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 GetNotificationChannelDescriptorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetNotificationChannelDescriptorRequest} GetNotificationChannelDescriptorRequest + */ + GetNotificationChannelDescriptorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetNotificationChannelDescriptorRequest) + return object; + var message = new $root.google.monitoring.v3.GetNotificationChannelDescriptorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetNotificationChannelDescriptorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {google.monitoring.v3.GetNotificationChannelDescriptorRequest} message GetNotificationChannelDescriptorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNotificationChannelDescriptorRequest.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 GetNotificationChannelDescriptorRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @instance + * @returns {Object.} JSON object + */ + GetNotificationChannelDescriptorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetNotificationChannelDescriptorRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetNotificationChannelDescriptorRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetNotificationChannelDescriptorRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetNotificationChannelDescriptorRequest"; + }; + + return GetNotificationChannelDescriptorRequest; + })(); + + v3.CreateNotificationChannelRequest = (function() { + + /** + * Properties of a CreateNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @interface ICreateNotificationChannelRequest + * @property {string|null} [name] CreateNotificationChannelRequest name + * @property {google.monitoring.v3.INotificationChannel|null} [notificationChannel] CreateNotificationChannelRequest notificationChannel + */ + + /** + * Constructs a new CreateNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateNotificationChannelRequest. + * @implements ICreateNotificationChannelRequest + * @constructor + * @param {google.monitoring.v3.ICreateNotificationChannelRequest=} [properties] Properties to set + */ + function CreateNotificationChannelRequest(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]]; + } + + /** + * CreateNotificationChannelRequest name. + * @member {string} name + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @instance + */ + CreateNotificationChannelRequest.prototype.name = ""; + + /** + * CreateNotificationChannelRequest notificationChannel. + * @member {google.monitoring.v3.INotificationChannel|null|undefined} notificationChannel + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @instance + */ + CreateNotificationChannelRequest.prototype.notificationChannel = null; + + /** + * Creates a new CreateNotificationChannelRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {google.monitoring.v3.ICreateNotificationChannelRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateNotificationChannelRequest} CreateNotificationChannelRequest instance + */ + CreateNotificationChannelRequest.create = function create(properties) { + return new CreateNotificationChannelRequest(properties); + }; + + /** + * Encodes the specified CreateNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.CreateNotificationChannelRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {google.monitoring.v3.ICreateNotificationChannelRequest} message CreateNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateNotificationChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.notificationChannel != null && Object.hasOwnProperty.call(message, "notificationChannel")) + $root.google.monitoring.v3.NotificationChannel.encode(message.notificationChannel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified CreateNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateNotificationChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {google.monitoring.v3.ICreateNotificationChannelRequest} message CreateNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateNotificationChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateNotificationChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateNotificationChannelRequest} CreateNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateNotificationChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateNotificationChannelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + case 2: { + message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateNotificationChannelRequest} CreateNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateNotificationChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateNotificationChannelRequest message. + * @function verify + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateNotificationChannelRequest.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.notificationChannel != null && message.hasOwnProperty("notificationChannel")) { + var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannel); + if (error) + return "notificationChannel." + error; + } + return null; + }; + + /** + * Creates a CreateNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateNotificationChannelRequest} CreateNotificationChannelRequest + */ + CreateNotificationChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateNotificationChannelRequest) + return object; + var message = new $root.google.monitoring.v3.CreateNotificationChannelRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.notificationChannel != null) { + if (typeof object.notificationChannel !== "object") + throw TypeError(".google.monitoring.v3.CreateNotificationChannelRequest.notificationChannel: object expected"); + message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannel); + } + return message; + }; + + /** + * Creates a plain object from a CreateNotificationChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {google.monitoring.v3.CreateNotificationChannelRequest} message CreateNotificationChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateNotificationChannelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.notificationChannel = null; + object.name = ""; + } + if (message.notificationChannel != null && message.hasOwnProperty("notificationChannel")) + object.notificationChannel = $root.google.monitoring.v3.NotificationChannel.toObject(message.notificationChannel, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CreateNotificationChannelRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @instance + * @returns {Object.} JSON object + */ + CreateNotificationChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateNotificationChannelRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateNotificationChannelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateNotificationChannelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateNotificationChannelRequest"; + }; + + return CreateNotificationChannelRequest; + })(); + + v3.ListNotificationChannelsRequest = (function() { + + /** + * Properties of a ListNotificationChannelsRequest. + * @memberof google.monitoring.v3 + * @interface IListNotificationChannelsRequest + * @property {string|null} [name] ListNotificationChannelsRequest name + * @property {string|null} [filter] ListNotificationChannelsRequest filter + * @property {string|null} [orderBy] ListNotificationChannelsRequest orderBy + * @property {number|null} [pageSize] ListNotificationChannelsRequest pageSize + * @property {string|null} [pageToken] ListNotificationChannelsRequest pageToken + */ + + /** + * Constructs a new ListNotificationChannelsRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListNotificationChannelsRequest. + * @implements IListNotificationChannelsRequest + * @constructor + * @param {google.monitoring.v3.IListNotificationChannelsRequest=} [properties] Properties to set + */ + function ListNotificationChannelsRequest(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]]; + } + + /** + * ListNotificationChannelsRequest name. + * @member {string} name + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @instance + */ + ListNotificationChannelsRequest.prototype.name = ""; + + /** + * ListNotificationChannelsRequest filter. + * @member {string} filter + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @instance + */ + ListNotificationChannelsRequest.prototype.filter = ""; + + /** + * ListNotificationChannelsRequest orderBy. + * @member {string} orderBy + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @instance + */ + ListNotificationChannelsRequest.prototype.orderBy = ""; + + /** + * ListNotificationChannelsRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @instance + */ + ListNotificationChannelsRequest.prototype.pageSize = 0; + + /** + * ListNotificationChannelsRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @instance + */ + ListNotificationChannelsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListNotificationChannelsRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {google.monitoring.v3.IListNotificationChannelsRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListNotificationChannelsRequest} ListNotificationChannelsRequest instance + */ + ListNotificationChannelsRequest.create = function create(properties) { + return new ListNotificationChannelsRequest(properties); + }; + + /** + * Encodes the specified ListNotificationChannelsRequest message. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelsRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {google.monitoring.v3.IListNotificationChannelsRequest} message ListNotificationChannelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNotificationChannelsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListNotificationChannelsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {google.monitoring.v3.IListNotificationChannelsRequest} message ListNotificationChannelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNotificationChannelsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListNotificationChannelsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListNotificationChannelsRequest} ListNotificationChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNotificationChannelsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListNotificationChannelsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.name = reader.string(); + break; + } + case 6: { + message.filter = reader.string(); + break; + } + case 7: { + message.orderBy = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListNotificationChannelsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListNotificationChannelsRequest} ListNotificationChannelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNotificationChannelsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListNotificationChannelsRequest message. + * @function verify + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListNotificationChannelsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: 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 ListNotificationChannelsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListNotificationChannelsRequest} ListNotificationChannelsRequest + */ + ListNotificationChannelsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListNotificationChannelsRequest) + return object; + var message = new $root.google.monitoring.v3.ListNotificationChannelsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + 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 ListNotificationChannelsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {google.monitoring.v3.ListNotificationChannelsRequest} message ListNotificationChannelsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListNotificationChannelsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListNotificationChannelsRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @instance + * @returns {Object.} JSON object + */ + ListNotificationChannelsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListNotificationChannelsRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListNotificationChannelsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListNotificationChannelsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListNotificationChannelsRequest"; + }; + + return ListNotificationChannelsRequest; + })(); + + v3.ListNotificationChannelsResponse = (function() { + + /** + * Properties of a ListNotificationChannelsResponse. + * @memberof google.monitoring.v3 + * @interface IListNotificationChannelsResponse + * @property {Array.|null} [notificationChannels] ListNotificationChannelsResponse notificationChannels + * @property {string|null} [nextPageToken] ListNotificationChannelsResponse nextPageToken + * @property {number|null} [totalSize] ListNotificationChannelsResponse totalSize + */ + + /** + * Constructs a new ListNotificationChannelsResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListNotificationChannelsResponse. + * @implements IListNotificationChannelsResponse + * @constructor + * @param {google.monitoring.v3.IListNotificationChannelsResponse=} [properties] Properties to set + */ + function ListNotificationChannelsResponse(properties) { + this.notificationChannels = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListNotificationChannelsResponse notificationChannels. + * @member {Array.} notificationChannels + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @instance + */ + ListNotificationChannelsResponse.prototype.notificationChannels = $util.emptyArray; + + /** + * ListNotificationChannelsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @instance + */ + ListNotificationChannelsResponse.prototype.nextPageToken = ""; + + /** + * ListNotificationChannelsResponse totalSize. + * @member {number} totalSize + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @instance + */ + ListNotificationChannelsResponse.prototype.totalSize = 0; + + /** + * Creates a new ListNotificationChannelsResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {google.monitoring.v3.IListNotificationChannelsResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListNotificationChannelsResponse} ListNotificationChannelsResponse instance + */ + ListNotificationChannelsResponse.create = function create(properties) { + return new ListNotificationChannelsResponse(properties); + }; + + /** + * Encodes the specified ListNotificationChannelsResponse message. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelsResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {google.monitoring.v3.IListNotificationChannelsResponse} message ListNotificationChannelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNotificationChannelsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.notificationChannels != null && message.notificationChannels.length) + for (var i = 0; i < message.notificationChannels.length; ++i) + $root.google.monitoring.v3.NotificationChannel.encode(message.notificationChannels[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.totalSize); + return writer; + }; + + /** + * Encodes the specified ListNotificationChannelsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListNotificationChannelsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {google.monitoring.v3.IListNotificationChannelsResponse} message ListNotificationChannelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListNotificationChannelsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListNotificationChannelsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListNotificationChannelsResponse} ListNotificationChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNotificationChannelsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListNotificationChannelsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (!(message.notificationChannels && message.notificationChannels.length)) + message.notificationChannels = []; + message.notificationChannels.push($root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 4: { + message.totalSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListNotificationChannelsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListNotificationChannelsResponse} ListNotificationChannelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListNotificationChannelsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListNotificationChannelsResponse message. + * @function verify + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListNotificationChannelsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.notificationChannels != null && message.hasOwnProperty("notificationChannels")) { + if (!Array.isArray(message.notificationChannels)) + return "notificationChannels: array expected"; + for (var i = 0; i < message.notificationChannels.length; ++i) { + var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannels[i]); + if (error) + return "notificationChannels." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + return null; + }; + + /** + * Creates a ListNotificationChannelsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListNotificationChannelsResponse} ListNotificationChannelsResponse + */ + ListNotificationChannelsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListNotificationChannelsResponse) + return object; + var message = new $root.google.monitoring.v3.ListNotificationChannelsResponse(); + if (object.notificationChannels) { + if (!Array.isArray(object.notificationChannels)) + throw TypeError(".google.monitoring.v3.ListNotificationChannelsResponse.notificationChannels: array expected"); + message.notificationChannels = []; + for (var i = 0; i < object.notificationChannels.length; ++i) { + if (typeof object.notificationChannels[i] !== "object") + throw TypeError(".google.monitoring.v3.ListNotificationChannelsResponse.notificationChannels: object expected"); + message.notificationChannels[i] = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannels[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListNotificationChannelsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {google.monitoring.v3.ListNotificationChannelsResponse} message ListNotificationChannelsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListNotificationChannelsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.notificationChannels = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.notificationChannels && message.notificationChannels.length) { + object.notificationChannels = []; + for (var j = 0; j < message.notificationChannels.length; ++j) + object.notificationChannels[j] = $root.google.monitoring.v3.NotificationChannel.toObject(message.notificationChannels[j], options); + } + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + return object; + }; + + /** + * Converts this ListNotificationChannelsResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @instance + * @returns {Object.} JSON object + */ + ListNotificationChannelsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListNotificationChannelsResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListNotificationChannelsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListNotificationChannelsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListNotificationChannelsResponse"; + }; + + return ListNotificationChannelsResponse; + })(); + + v3.GetNotificationChannelRequest = (function() { + + /** + * Properties of a GetNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @interface IGetNotificationChannelRequest + * @property {string|null} [name] GetNotificationChannelRequest name + */ + + /** + * Constructs a new GetNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetNotificationChannelRequest. + * @implements IGetNotificationChannelRequest + * @constructor + * @param {google.monitoring.v3.IGetNotificationChannelRequest=} [properties] Properties to set + */ + function GetNotificationChannelRequest(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]]; + } + + /** + * GetNotificationChannelRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @instance + */ + GetNotificationChannelRequest.prototype.name = ""; + + /** + * Creates a new GetNotificationChannelRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetNotificationChannelRequest} GetNotificationChannelRequest instance + */ + GetNotificationChannelRequest.create = function create(properties) { + return new GetNotificationChannelRequest(properties); + }; + + /** + * Encodes the specified GetNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelRequest} message GetNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNotificationChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelRequest} message GetNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNotificationChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNotificationChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetNotificationChannelRequest} GetNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNotificationChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetNotificationChannelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetNotificationChannelRequest} GetNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNotificationChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNotificationChannelRequest message. + * @function verify + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNotificationChannelRequest.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 GetNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetNotificationChannelRequest} GetNotificationChannelRequest + */ + GetNotificationChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetNotificationChannelRequest) + return object; + var message = new $root.google.monitoring.v3.GetNotificationChannelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetNotificationChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {google.monitoring.v3.GetNotificationChannelRequest} message GetNotificationChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNotificationChannelRequest.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 GetNotificationChannelRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @instance + * @returns {Object.} JSON object + */ + GetNotificationChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetNotificationChannelRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetNotificationChannelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetNotificationChannelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetNotificationChannelRequest"; + }; + + return GetNotificationChannelRequest; + })(); + + v3.UpdateNotificationChannelRequest = (function() { + + /** + * Properties of an UpdateNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @interface IUpdateNotificationChannelRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateNotificationChannelRequest updateMask + * @property {google.monitoring.v3.INotificationChannel|null} [notificationChannel] UpdateNotificationChannelRequest notificationChannel + */ + + /** + * Constructs a new UpdateNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents an UpdateNotificationChannelRequest. + * @implements IUpdateNotificationChannelRequest + * @constructor + * @param {google.monitoring.v3.IUpdateNotificationChannelRequest=} [properties] Properties to set + */ + function UpdateNotificationChannelRequest(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]]; + } + + /** + * UpdateNotificationChannelRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @instance + */ + UpdateNotificationChannelRequest.prototype.updateMask = null; + + /** + * UpdateNotificationChannelRequest notificationChannel. + * @member {google.monitoring.v3.INotificationChannel|null|undefined} notificationChannel + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @instance + */ + UpdateNotificationChannelRequest.prototype.notificationChannel = null; + + /** + * Creates a new UpdateNotificationChannelRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IUpdateNotificationChannelRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.UpdateNotificationChannelRequest} UpdateNotificationChannelRequest instance + */ + UpdateNotificationChannelRequest.create = function create(properties) { + return new UpdateNotificationChannelRequest(properties); + }; + + /** + * Encodes the specified UpdateNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.UpdateNotificationChannelRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IUpdateNotificationChannelRequest} message UpdateNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateNotificationChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.notificationChannel != null && Object.hasOwnProperty.call(message, "notificationChannel")) + $root.google.monitoring.v3.NotificationChannel.encode(message.notificationChannel, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateNotificationChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IUpdateNotificationChannelRequest} message UpdateNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateNotificationChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateNotificationChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UpdateNotificationChannelRequest} UpdateNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateNotificationChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateNotificationChannelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UpdateNotificationChannelRequest} UpdateNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateNotificationChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateNotificationChannelRequest message. + * @function verify + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateNotificationChannelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.notificationChannel != null && message.hasOwnProperty("notificationChannel")) { + var error = $root.google.monitoring.v3.NotificationChannel.verify(message.notificationChannel); + if (error) + return "notificationChannel." + error; + } + return null; + }; + + /** + * Creates an UpdateNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UpdateNotificationChannelRequest} UpdateNotificationChannelRequest + */ + UpdateNotificationChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UpdateNotificationChannelRequest) + return object; + var message = new $root.google.monitoring.v3.UpdateNotificationChannelRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.monitoring.v3.UpdateNotificationChannelRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.notificationChannel != null) { + if (typeof object.notificationChannel !== "object") + throw TypeError(".google.monitoring.v3.UpdateNotificationChannelRequest.notificationChannel: object expected"); + message.notificationChannel = $root.google.monitoring.v3.NotificationChannel.fromObject(object.notificationChannel); + } + return message; + }; + + /** + * Creates a plain object from an UpdateNotificationChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {google.monitoring.v3.UpdateNotificationChannelRequest} message UpdateNotificationChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateNotificationChannelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.updateMask = null; + object.notificationChannel = null; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.notificationChannel != null && message.hasOwnProperty("notificationChannel")) + object.notificationChannel = $root.google.monitoring.v3.NotificationChannel.toObject(message.notificationChannel, options); + return object; + }; + + /** + * Converts this UpdateNotificationChannelRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateNotificationChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateNotificationChannelRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.UpdateNotificationChannelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateNotificationChannelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UpdateNotificationChannelRequest"; + }; + + return UpdateNotificationChannelRequest; + })(); + + v3.DeleteNotificationChannelRequest = (function() { + + /** + * Properties of a DeleteNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @interface IDeleteNotificationChannelRequest + * @property {string|null} [name] DeleteNotificationChannelRequest name + * @property {boolean|null} [force] DeleteNotificationChannelRequest force + */ + + /** + * Constructs a new DeleteNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a DeleteNotificationChannelRequest. + * @implements IDeleteNotificationChannelRequest + * @constructor + * @param {google.monitoring.v3.IDeleteNotificationChannelRequest=} [properties] Properties to set + */ + function DeleteNotificationChannelRequest(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]]; + } + + /** + * DeleteNotificationChannelRequest name. + * @member {string} name + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @instance + */ + DeleteNotificationChannelRequest.prototype.name = ""; + + /** + * DeleteNotificationChannelRequest force. + * @member {boolean} force + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @instance + */ + DeleteNotificationChannelRequest.prototype.force = false; + + /** + * Creates a new DeleteNotificationChannelRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IDeleteNotificationChannelRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.DeleteNotificationChannelRequest} DeleteNotificationChannelRequest instance + */ + DeleteNotificationChannelRequest.create = function create(properties) { + return new DeleteNotificationChannelRequest(properties); + }; + + /** + * Encodes the specified DeleteNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.DeleteNotificationChannelRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IDeleteNotificationChannelRequest} message DeleteNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteNotificationChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeleteNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteNotificationChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IDeleteNotificationChannelRequest} message DeleteNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteNotificationChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteNotificationChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DeleteNotificationChannelRequest} DeleteNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteNotificationChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteNotificationChannelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.name = reader.string(); + break; + } + case 5: { + message.force = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DeleteNotificationChannelRequest} DeleteNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteNotificationChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteNotificationChannelRequest message. + * @function verify + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteNotificationChannelRequest.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.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeleteNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DeleteNotificationChannelRequest} DeleteNotificationChannelRequest + */ + DeleteNotificationChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DeleteNotificationChannelRequest) + return object; + var message = new $root.google.monitoring.v3.DeleteNotificationChannelRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeleteNotificationChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {google.monitoring.v3.DeleteNotificationChannelRequest} message DeleteNotificationChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteNotificationChannelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeleteNotificationChannelRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteNotificationChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteNotificationChannelRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.DeleteNotificationChannelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteNotificationChannelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DeleteNotificationChannelRequest"; + }; + + return DeleteNotificationChannelRequest; + })(); + + v3.SendNotificationChannelVerificationCodeRequest = (function() { + + /** + * Properties of a SendNotificationChannelVerificationCodeRequest. + * @memberof google.monitoring.v3 + * @interface ISendNotificationChannelVerificationCodeRequest + * @property {string|null} [name] SendNotificationChannelVerificationCodeRequest name + */ + + /** + * Constructs a new SendNotificationChannelVerificationCodeRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a SendNotificationChannelVerificationCodeRequest. + * @implements ISendNotificationChannelVerificationCodeRequest + * @constructor + * @param {google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest=} [properties] Properties to set + */ + function SendNotificationChannelVerificationCodeRequest(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]]; + } + + /** + * SendNotificationChannelVerificationCodeRequest name. + * @member {string} name + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @instance + */ + SendNotificationChannelVerificationCodeRequest.prototype.name = ""; + + /** + * Creates a new SendNotificationChannelVerificationCodeRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.SendNotificationChannelVerificationCodeRequest} SendNotificationChannelVerificationCodeRequest instance + */ + SendNotificationChannelVerificationCodeRequest.create = function create(properties) { + return new SendNotificationChannelVerificationCodeRequest(properties); + }; + + /** + * Encodes the specified SendNotificationChannelVerificationCodeRequest message. Does not implicitly {@link google.monitoring.v3.SendNotificationChannelVerificationCodeRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest} message SendNotificationChannelVerificationCodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SendNotificationChannelVerificationCodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified SendNotificationChannelVerificationCodeRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.SendNotificationChannelVerificationCodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest} message SendNotificationChannelVerificationCodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SendNotificationChannelVerificationCodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SendNotificationChannelVerificationCodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.SendNotificationChannelVerificationCodeRequest} SendNotificationChannelVerificationCodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SendNotificationChannelVerificationCodeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest(); + 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 SendNotificationChannelVerificationCodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.SendNotificationChannelVerificationCodeRequest} SendNotificationChannelVerificationCodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SendNotificationChannelVerificationCodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SendNotificationChannelVerificationCodeRequest message. + * @function verify + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SendNotificationChannelVerificationCodeRequest.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 SendNotificationChannelVerificationCodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.SendNotificationChannelVerificationCodeRequest} SendNotificationChannelVerificationCodeRequest + */ + SendNotificationChannelVerificationCodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest) + return object; + var message = new $root.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a SendNotificationChannelVerificationCodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {google.monitoring.v3.SendNotificationChannelVerificationCodeRequest} message SendNotificationChannelVerificationCodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SendNotificationChannelVerificationCodeRequest.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 SendNotificationChannelVerificationCodeRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @instance + * @returns {Object.} JSON object + */ + SendNotificationChannelVerificationCodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SendNotificationChannelVerificationCodeRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.SendNotificationChannelVerificationCodeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SendNotificationChannelVerificationCodeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.SendNotificationChannelVerificationCodeRequest"; + }; + + return SendNotificationChannelVerificationCodeRequest; + })(); + + v3.GetNotificationChannelVerificationCodeRequest = (function() { + + /** + * Properties of a GetNotificationChannelVerificationCodeRequest. + * @memberof google.monitoring.v3 + * @interface IGetNotificationChannelVerificationCodeRequest + * @property {string|null} [name] GetNotificationChannelVerificationCodeRequest name + * @property {google.protobuf.ITimestamp|null} [expireTime] GetNotificationChannelVerificationCodeRequest expireTime + */ + + /** + * Constructs a new GetNotificationChannelVerificationCodeRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetNotificationChannelVerificationCodeRequest. + * @implements IGetNotificationChannelVerificationCodeRequest + * @constructor + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest=} [properties] Properties to set + */ + function GetNotificationChannelVerificationCodeRequest(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]]; + } + + /** + * GetNotificationChannelVerificationCodeRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @instance + */ + GetNotificationChannelVerificationCodeRequest.prototype.name = ""; + + /** + * GetNotificationChannelVerificationCodeRequest expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @instance + */ + GetNotificationChannelVerificationCodeRequest.prototype.expireTime = null; + + /** + * Creates a new GetNotificationChannelVerificationCodeRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeRequest} GetNotificationChannelVerificationCodeRequest instance + */ + GetNotificationChannelVerificationCodeRequest.create = function create(properties) { + return new GetNotificationChannelVerificationCodeRequest(properties); + }; + + /** + * Encodes the specified GetNotificationChannelVerificationCodeRequest message. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelVerificationCodeRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest} message GetNotificationChannelVerificationCodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNotificationChannelVerificationCodeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetNotificationChannelVerificationCodeRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelVerificationCodeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest} message GetNotificationChannelVerificationCodeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNotificationChannelVerificationCodeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNotificationChannelVerificationCodeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeRequest} GetNotificationChannelVerificationCodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNotificationChannelVerificationCodeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetNotificationChannelVerificationCodeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeRequest} GetNotificationChannelVerificationCodeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNotificationChannelVerificationCodeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNotificationChannelVerificationCodeRequest message. + * @function verify + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNotificationChannelVerificationCodeRequest.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.expireTime != null && message.hasOwnProperty("expireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + return null; + }; + + /** + * Creates a GetNotificationChannelVerificationCodeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeRequest} GetNotificationChannelVerificationCodeRequest + */ + GetNotificationChannelVerificationCodeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest) + return object; + var message = new $root.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.monitoring.v3.GetNotificationChannelVerificationCodeRequest.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + return message; + }; + + /** + * Creates a plain object from a GetNotificationChannelVerificationCodeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {google.monitoring.v3.GetNotificationChannelVerificationCodeRequest} message GetNotificationChannelVerificationCodeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNotificationChannelVerificationCodeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.expireTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + return object; + }; + + /** + * Converts this GetNotificationChannelVerificationCodeRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @instance + * @returns {Object.} JSON object + */ + GetNotificationChannelVerificationCodeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetNotificationChannelVerificationCodeRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetNotificationChannelVerificationCodeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetNotificationChannelVerificationCodeRequest"; + }; + + return GetNotificationChannelVerificationCodeRequest; + })(); + + v3.GetNotificationChannelVerificationCodeResponse = (function() { + + /** + * Properties of a GetNotificationChannelVerificationCodeResponse. + * @memberof google.monitoring.v3 + * @interface IGetNotificationChannelVerificationCodeResponse + * @property {string|null} [code] GetNotificationChannelVerificationCodeResponse code + * @property {google.protobuf.ITimestamp|null} [expireTime] GetNotificationChannelVerificationCodeResponse expireTime + */ + + /** + * Constructs a new GetNotificationChannelVerificationCodeResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetNotificationChannelVerificationCodeResponse. + * @implements IGetNotificationChannelVerificationCodeResponse + * @constructor + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse=} [properties] Properties to set + */ + function GetNotificationChannelVerificationCodeResponse(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]]; + } + + /** + * GetNotificationChannelVerificationCodeResponse code. + * @member {string} code + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @instance + */ + GetNotificationChannelVerificationCodeResponse.prototype.code = ""; + + /** + * GetNotificationChannelVerificationCodeResponse expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @instance + */ + GetNotificationChannelVerificationCodeResponse.prototype.expireTime = null; + + /** + * Creates a new GetNotificationChannelVerificationCodeResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeResponse} GetNotificationChannelVerificationCodeResponse instance + */ + GetNotificationChannelVerificationCodeResponse.create = function create(properties) { + return new GetNotificationChannelVerificationCodeResponse(properties); + }; + + /** + * Encodes the specified GetNotificationChannelVerificationCodeResponse message. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelVerificationCodeResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse} message GetNotificationChannelVerificationCodeResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNotificationChannelVerificationCodeResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.code); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetNotificationChannelVerificationCodeResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.GetNotificationChannelVerificationCodeResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse} message GetNotificationChannelVerificationCodeResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetNotificationChannelVerificationCodeResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetNotificationChannelVerificationCodeResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeResponse} GetNotificationChannelVerificationCodeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNotificationChannelVerificationCodeResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.code = reader.string(); + break; + } + case 2: { + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetNotificationChannelVerificationCodeResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeResponse} GetNotificationChannelVerificationCodeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetNotificationChannelVerificationCodeResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetNotificationChannelVerificationCodeResponse message. + * @function verify + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetNotificationChannelVerificationCodeResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isString(message.code)) + return "code: string expected"; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + return null; + }; + + /** + * Creates a GetNotificationChannelVerificationCodeResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetNotificationChannelVerificationCodeResponse} GetNotificationChannelVerificationCodeResponse + */ + GetNotificationChannelVerificationCodeResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse) + return object; + var message = new $root.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse(); + if (object.code != null) + message.code = String(object.code); + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.monitoring.v3.GetNotificationChannelVerificationCodeResponse.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + return message; + }; + + /** + * Creates a plain object from a GetNotificationChannelVerificationCodeResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {google.monitoring.v3.GetNotificationChannelVerificationCodeResponse} message GetNotificationChannelVerificationCodeResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetNotificationChannelVerificationCodeResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.code = ""; + object.expireTime = null; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.expireTime != null && message.hasOwnProperty("expireTime")) + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + return object; + }; + + /** + * Converts this GetNotificationChannelVerificationCodeResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @instance + * @returns {Object.} JSON object + */ + GetNotificationChannelVerificationCodeResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetNotificationChannelVerificationCodeResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.GetNotificationChannelVerificationCodeResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetNotificationChannelVerificationCodeResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetNotificationChannelVerificationCodeResponse"; + }; + + return GetNotificationChannelVerificationCodeResponse; + })(); + + v3.VerifyNotificationChannelRequest = (function() { + + /** + * Properties of a VerifyNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @interface IVerifyNotificationChannelRequest + * @property {string|null} [name] VerifyNotificationChannelRequest name + * @property {string|null} [code] VerifyNotificationChannelRequest code + */ + + /** + * Constructs a new VerifyNotificationChannelRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a VerifyNotificationChannelRequest. + * @implements IVerifyNotificationChannelRequest + * @constructor + * @param {google.monitoring.v3.IVerifyNotificationChannelRequest=} [properties] Properties to set + */ + function VerifyNotificationChannelRequest(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]]; + } + + /** + * VerifyNotificationChannelRequest name. + * @member {string} name + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @instance + */ + VerifyNotificationChannelRequest.prototype.name = ""; + + /** + * VerifyNotificationChannelRequest code. + * @member {string} code + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @instance + */ + VerifyNotificationChannelRequest.prototype.code = ""; + + /** + * Creates a new VerifyNotificationChannelRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IVerifyNotificationChannelRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.VerifyNotificationChannelRequest} VerifyNotificationChannelRequest instance + */ + VerifyNotificationChannelRequest.create = function create(properties) { + return new VerifyNotificationChannelRequest(properties); + }; + + /** + * Encodes the specified VerifyNotificationChannelRequest message. Does not implicitly {@link google.monitoring.v3.VerifyNotificationChannelRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IVerifyNotificationChannelRequest} message VerifyNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VerifyNotificationChannelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.code); + return writer; + }; + + /** + * Encodes the specified VerifyNotificationChannelRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.VerifyNotificationChannelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {google.monitoring.v3.IVerifyNotificationChannelRequest} message VerifyNotificationChannelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VerifyNotificationChannelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VerifyNotificationChannelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.VerifyNotificationChannelRequest} VerifyNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VerifyNotificationChannelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.VerifyNotificationChannelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.code = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VerifyNotificationChannelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.VerifyNotificationChannelRequest} VerifyNotificationChannelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VerifyNotificationChannelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VerifyNotificationChannelRequest message. + * @function verify + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VerifyNotificationChannelRequest.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.code != null && message.hasOwnProperty("code")) + if (!$util.isString(message.code)) + return "code: string expected"; + return null; + }; + + /** + * Creates a VerifyNotificationChannelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.VerifyNotificationChannelRequest} VerifyNotificationChannelRequest + */ + VerifyNotificationChannelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.VerifyNotificationChannelRequest) + return object; + var message = new $root.google.monitoring.v3.VerifyNotificationChannelRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.code != null) + message.code = String(object.code); + return message; + }; + + /** + * Creates a plain object from a VerifyNotificationChannelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {google.monitoring.v3.VerifyNotificationChannelRequest} message VerifyNotificationChannelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VerifyNotificationChannelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.code = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + return object; + }; + + /** + * Converts this VerifyNotificationChannelRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @instance + * @returns {Object.} JSON object + */ + VerifyNotificationChannelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VerifyNotificationChannelRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.VerifyNotificationChannelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VerifyNotificationChannelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.VerifyNotificationChannelRequest"; + }; + + return VerifyNotificationChannelRequest; + })(); + + v3.QueryService = (function() { + + /** + * Constructs a new QueryService service. + * @memberof google.monitoring.v3 + * @classdesc Represents a QueryService + * @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 QueryService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (QueryService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = QueryService; + + /** + * Creates new QueryService service using the specified rpc implementation. + * @function create + * @memberof google.monitoring.v3.QueryService + * @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 {QueryService} RPC service. Useful where requests and/or responses are streamed. + */ + QueryService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.monitoring.v3.QueryService|queryTimeSeries}. + * @memberof google.monitoring.v3.QueryService + * @typedef QueryTimeSeriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.QueryTimeSeriesResponse} [response] QueryTimeSeriesResponse + */ + + /** + * Calls QueryTimeSeries. + * @function queryTimeSeries + * @memberof google.monitoring.v3.QueryService + * @instance + * @param {google.monitoring.v3.IQueryTimeSeriesRequest} request QueryTimeSeriesRequest message or plain object + * @param {google.monitoring.v3.QueryService.QueryTimeSeriesCallback} callback Node-style callback called with the error, if any, and QueryTimeSeriesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(QueryService.prototype.queryTimeSeries = function queryTimeSeries(request, callback) { + return this.rpcCall(queryTimeSeries, $root.google.monitoring.v3.QueryTimeSeriesRequest, $root.google.monitoring.v3.QueryTimeSeriesResponse, request, callback); + }, "name", { value: "QueryTimeSeries" }); + + /** + * Calls QueryTimeSeries. + * @function queryTimeSeries + * @memberof google.monitoring.v3.QueryService + * @instance + * @param {google.monitoring.v3.IQueryTimeSeriesRequest} request QueryTimeSeriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return QueryService; + })(); + + v3.Service = (function() { + + /** + * Properties of a Service. + * @memberof google.monitoring.v3 + * @interface IService + * @property {string|null} [name] Service name + * @property {string|null} [displayName] Service displayName + * @property {google.monitoring.v3.Service.ICustom|null} [custom] Service custom + * @property {google.monitoring.v3.Service.IAppEngine|null} [appEngine] Service appEngine + * @property {google.monitoring.v3.Service.ICloudEndpoints|null} [cloudEndpoints] Service cloudEndpoints + * @property {google.monitoring.v3.Service.IClusterIstio|null} [clusterIstio] Service clusterIstio + * @property {google.monitoring.v3.Service.IMeshIstio|null} [meshIstio] Service meshIstio + * @property {google.monitoring.v3.Service.IIstioCanonicalService|null} [istioCanonicalService] Service istioCanonicalService + * @property {google.monitoring.v3.Service.ITelemetry|null} [telemetry] Service telemetry + */ + + /** + * Constructs a new Service. + * @memberof google.monitoring.v3 + * @classdesc Represents a Service. + * @implements IService + * @constructor + * @param {google.monitoring.v3.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.monitoring.v3.Service + * @instance + */ + Service.prototype.name = ""; + + /** + * Service displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.Service + * @instance + */ + Service.prototype.displayName = ""; + + /** + * Service custom. + * @member {google.monitoring.v3.Service.ICustom|null|undefined} custom + * @memberof google.monitoring.v3.Service + * @instance + */ + Service.prototype.custom = null; + + /** + * Service appEngine. + * @member {google.monitoring.v3.Service.IAppEngine|null|undefined} appEngine + * @memberof google.monitoring.v3.Service + * @instance + */ + Service.prototype.appEngine = null; + + /** + * Service cloudEndpoints. + * @member {google.monitoring.v3.Service.ICloudEndpoints|null|undefined} cloudEndpoints + * @memberof google.monitoring.v3.Service + * @instance + */ + Service.prototype.cloudEndpoints = null; + + /** + * Service clusterIstio. + * @member {google.monitoring.v3.Service.IClusterIstio|null|undefined} clusterIstio + * @memberof google.monitoring.v3.Service + * @instance + */ + Service.prototype.clusterIstio = null; + + /** + * Service meshIstio. + * @member {google.monitoring.v3.Service.IMeshIstio|null|undefined} meshIstio + * @memberof google.monitoring.v3.Service + * @instance + */ + Service.prototype.meshIstio = null; + + /** + * Service istioCanonicalService. + * @member {google.monitoring.v3.Service.IIstioCanonicalService|null|undefined} istioCanonicalService + * @memberof google.monitoring.v3.Service + * @instance + */ + Service.prototype.istioCanonicalService = null; + + /** + * Service telemetry. + * @member {google.monitoring.v3.Service.ITelemetry|null|undefined} telemetry + * @memberof google.monitoring.v3.Service + * @instance + */ + Service.prototype.telemetry = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Service identifier. + * @member {"custom"|"appEngine"|"cloudEndpoints"|"clusterIstio"|"meshIstio"|"istioCanonicalService"|undefined} identifier + * @memberof google.monitoring.v3.Service + * @instance + */ + Object.defineProperty(Service.prototype, "identifier", { + get: $util.oneOfGetter($oneOfFields = ["custom", "appEngine", "cloudEndpoints", "clusterIstio", "meshIstio", "istioCanonicalService"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Service instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Service + * @static + * @param {google.monitoring.v3.IService=} [properties] Properties to set + * @returns {google.monitoring.v3.Service} Service instance + */ + Service.create = function create(properties) { + return new Service(properties); + }; + + /** + * Encodes the specified Service message. Does not implicitly {@link google.monitoring.v3.Service.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Service + * @static + * @param {google.monitoring.v3.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 && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.monitoring.v3.Service.Custom.encode(message.custom, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.appEngine != null && Object.hasOwnProperty.call(message, "appEngine")) + $root.google.monitoring.v3.Service.AppEngine.encode(message.appEngine, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.cloudEndpoints != null && Object.hasOwnProperty.call(message, "cloudEndpoints")) + $root.google.monitoring.v3.Service.CloudEndpoints.encode(message.cloudEndpoints, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.clusterIstio != null && Object.hasOwnProperty.call(message, "clusterIstio")) + $root.google.monitoring.v3.Service.ClusterIstio.encode(message.clusterIstio, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.meshIstio != null && Object.hasOwnProperty.call(message, "meshIstio")) + $root.google.monitoring.v3.Service.MeshIstio.encode(message.meshIstio, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.istioCanonicalService != null && Object.hasOwnProperty.call(message, "istioCanonicalService")) + $root.google.monitoring.v3.Service.IstioCanonicalService.encode(message.istioCanonicalService, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.telemetry != null && Object.hasOwnProperty.call(message, "telemetry")) + $root.google.monitoring.v3.Service.Telemetry.encode(message.telemetry, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Service message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Service + * @static + * @param {google.monitoring.v3.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.monitoring.v3.Service + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.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.monitoring.v3.Service(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 6: { + message.custom = $root.google.monitoring.v3.Service.Custom.decode(reader, reader.uint32()); + break; + } + case 7: { + message.appEngine = $root.google.monitoring.v3.Service.AppEngine.decode(reader, reader.uint32()); + break; + } + case 8: { + message.cloudEndpoints = $root.google.monitoring.v3.Service.CloudEndpoints.decode(reader, reader.uint32()); + break; + } + case 9: { + message.clusterIstio = $root.google.monitoring.v3.Service.ClusterIstio.decode(reader, reader.uint32()); + break; + } + case 10: { + message.meshIstio = $root.google.monitoring.v3.Service.MeshIstio.decode(reader, reader.uint32()); + break; + } + case 11: { + message.istioCanonicalService = $root.google.monitoring.v3.Service.IstioCanonicalService.decode(reader, reader.uint32()); + break; + } + case 13: { + message.telemetry = $root.google.monitoring.v3.Service.Telemetry.decode(reader, reader.uint32()); + 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.monitoring.v3.Service + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.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.monitoring.v3.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"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.custom != null && message.hasOwnProperty("custom")) { + properties.identifier = 1; + { + var error = $root.google.monitoring.v3.Service.Custom.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.appEngine != null && message.hasOwnProperty("appEngine")) { + if (properties.identifier === 1) + return "identifier: multiple values"; + properties.identifier = 1; + { + var error = $root.google.monitoring.v3.Service.AppEngine.verify(message.appEngine); + if (error) + return "appEngine." + error; + } + } + if (message.cloudEndpoints != null && message.hasOwnProperty("cloudEndpoints")) { + if (properties.identifier === 1) + return "identifier: multiple values"; + properties.identifier = 1; + { + var error = $root.google.monitoring.v3.Service.CloudEndpoints.verify(message.cloudEndpoints); + if (error) + return "cloudEndpoints." + error; + } + } + if (message.clusterIstio != null && message.hasOwnProperty("clusterIstio")) { + if (properties.identifier === 1) + return "identifier: multiple values"; + properties.identifier = 1; + { + var error = $root.google.monitoring.v3.Service.ClusterIstio.verify(message.clusterIstio); + if (error) + return "clusterIstio." + error; + } + } + if (message.meshIstio != null && message.hasOwnProperty("meshIstio")) { + if (properties.identifier === 1) + return "identifier: multiple values"; + properties.identifier = 1; + { + var error = $root.google.monitoring.v3.Service.MeshIstio.verify(message.meshIstio); + if (error) + return "meshIstio." + error; + } + } + if (message.istioCanonicalService != null && message.hasOwnProperty("istioCanonicalService")) { + if (properties.identifier === 1) + return "identifier: multiple values"; + properties.identifier = 1; + { + var error = $root.google.monitoring.v3.Service.IstioCanonicalService.verify(message.istioCanonicalService); + if (error) + return "istioCanonicalService." + error; + } + } + if (message.telemetry != null && message.hasOwnProperty("telemetry")) { + var error = $root.google.monitoring.v3.Service.Telemetry.verify(message.telemetry); + if (error) + return "telemetry." + error; + } + return null; + }; + + /** + * Creates a Service message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Service + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Service} Service + */ + Service.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Service) + return object; + var message = new $root.google.monitoring.v3.Service(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.monitoring.v3.Service.custom: object expected"); + message.custom = $root.google.monitoring.v3.Service.Custom.fromObject(object.custom); + } + if (object.appEngine != null) { + if (typeof object.appEngine !== "object") + throw TypeError(".google.monitoring.v3.Service.appEngine: object expected"); + message.appEngine = $root.google.monitoring.v3.Service.AppEngine.fromObject(object.appEngine); + } + if (object.cloudEndpoints != null) { + if (typeof object.cloudEndpoints !== "object") + throw TypeError(".google.monitoring.v3.Service.cloudEndpoints: object expected"); + message.cloudEndpoints = $root.google.monitoring.v3.Service.CloudEndpoints.fromObject(object.cloudEndpoints); + } + if (object.clusterIstio != null) { + if (typeof object.clusterIstio !== "object") + throw TypeError(".google.monitoring.v3.Service.clusterIstio: object expected"); + message.clusterIstio = $root.google.monitoring.v3.Service.ClusterIstio.fromObject(object.clusterIstio); + } + if (object.meshIstio != null) { + if (typeof object.meshIstio !== "object") + throw TypeError(".google.monitoring.v3.Service.meshIstio: object expected"); + message.meshIstio = $root.google.monitoring.v3.Service.MeshIstio.fromObject(object.meshIstio); + } + if (object.istioCanonicalService != null) { + if (typeof object.istioCanonicalService !== "object") + throw TypeError(".google.monitoring.v3.Service.istioCanonicalService: object expected"); + message.istioCanonicalService = $root.google.monitoring.v3.Service.IstioCanonicalService.fromObject(object.istioCanonicalService); + } + if (object.telemetry != null) { + if (typeof object.telemetry !== "object") + throw TypeError(".google.monitoring.v3.Service.telemetry: object expected"); + message.telemetry = $root.google.monitoring.v3.Service.Telemetry.fromObject(object.telemetry); + } + return message; + }; + + /** + * Creates a plain object from a Service message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Service + * @static + * @param {google.monitoring.v3.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.displayName = ""; + object.telemetry = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.monitoring.v3.Service.Custom.toObject(message.custom, options); + if (options.oneofs) + object.identifier = "custom"; + } + if (message.appEngine != null && message.hasOwnProperty("appEngine")) { + object.appEngine = $root.google.monitoring.v3.Service.AppEngine.toObject(message.appEngine, options); + if (options.oneofs) + object.identifier = "appEngine"; + } + if (message.cloudEndpoints != null && message.hasOwnProperty("cloudEndpoints")) { + object.cloudEndpoints = $root.google.monitoring.v3.Service.CloudEndpoints.toObject(message.cloudEndpoints, options); + if (options.oneofs) + object.identifier = "cloudEndpoints"; + } + if (message.clusterIstio != null && message.hasOwnProperty("clusterIstio")) { + object.clusterIstio = $root.google.monitoring.v3.Service.ClusterIstio.toObject(message.clusterIstio, options); + if (options.oneofs) + object.identifier = "clusterIstio"; + } + if (message.meshIstio != null && message.hasOwnProperty("meshIstio")) { + object.meshIstio = $root.google.monitoring.v3.Service.MeshIstio.toObject(message.meshIstio, options); + if (options.oneofs) + object.identifier = "meshIstio"; + } + if (message.istioCanonicalService != null && message.hasOwnProperty("istioCanonicalService")) { + object.istioCanonicalService = $root.google.monitoring.v3.Service.IstioCanonicalService.toObject(message.istioCanonicalService, options); + if (options.oneofs) + object.identifier = "istioCanonicalService"; + } + if (message.telemetry != null && message.hasOwnProperty("telemetry")) + object.telemetry = $root.google.monitoring.v3.Service.Telemetry.toObject(message.telemetry, options); + return object; + }; + + /** + * Converts this Service to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Service + * @instance + * @returns {Object.} JSON object + */ + Service.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Service + * @function getTypeUrl + * @memberof google.monitoring.v3.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.monitoring.v3.Service"; + }; + + Service.Custom = (function() { + + /** + * Properties of a Custom. + * @memberof google.monitoring.v3.Service + * @interface ICustom + */ + + /** + * Constructs a new Custom. + * @memberof google.monitoring.v3.Service + * @classdesc Represents a Custom. + * @implements ICustom + * @constructor + * @param {google.monitoring.v3.Service.ICustom=} [properties] Properties to set + */ + function Custom(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Custom instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {google.monitoring.v3.Service.ICustom=} [properties] Properties to set + * @returns {google.monitoring.v3.Service.Custom} Custom instance + */ + Custom.create = function create(properties) { + return new Custom(properties); + }; + + /** + * Encodes the specified Custom message. Does not implicitly {@link google.monitoring.v3.Service.Custom.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {google.monitoring.v3.Service.ICustom} message Custom message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Custom.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Custom message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.Custom.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {google.monitoring.v3.Service.ICustom} message Custom message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Custom.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Custom message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Service.Custom} Custom + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Custom.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.Custom(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Custom message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Service.Custom} Custom + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Custom.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Custom message. + * @function verify + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Custom.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a Custom message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Service.Custom} Custom + */ + Custom.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Service.Custom) + return object; + return new $root.google.monitoring.v3.Service.Custom(); + }; + + /** + * Creates a plain object from a Custom message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {google.monitoring.v3.Service.Custom} message Custom + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Custom.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Custom to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Service.Custom + * @instance + * @returns {Object.} JSON object + */ + Custom.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Custom + * @function getTypeUrl + * @memberof google.monitoring.v3.Service.Custom + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Custom.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Service.Custom"; + }; + + return Custom; + })(); + + Service.AppEngine = (function() { + + /** + * Properties of an AppEngine. + * @memberof google.monitoring.v3.Service + * @interface IAppEngine + * @property {string|null} [moduleId] AppEngine moduleId + */ + + /** + * Constructs a new AppEngine. + * @memberof google.monitoring.v3.Service + * @classdesc Represents an AppEngine. + * @implements IAppEngine + * @constructor + * @param {google.monitoring.v3.Service.IAppEngine=} [properties] Properties to set + */ + function AppEngine(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]]; + } + + /** + * AppEngine moduleId. + * @member {string} moduleId + * @memberof google.monitoring.v3.Service.AppEngine + * @instance + */ + AppEngine.prototype.moduleId = ""; + + /** + * Creates a new AppEngine instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {google.monitoring.v3.Service.IAppEngine=} [properties] Properties to set + * @returns {google.monitoring.v3.Service.AppEngine} AppEngine instance + */ + AppEngine.create = function create(properties) { + return new AppEngine(properties); + }; + + /** + * Encodes the specified AppEngine message. Does not implicitly {@link google.monitoring.v3.Service.AppEngine.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {google.monitoring.v3.Service.IAppEngine} message AppEngine message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppEngine.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.moduleId != null && Object.hasOwnProperty.call(message, "moduleId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.moduleId); + return writer; + }; + + /** + * Encodes the specified AppEngine message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.AppEngine.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {google.monitoring.v3.Service.IAppEngine} message AppEngine message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AppEngine.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AppEngine message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Service.AppEngine} AppEngine + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppEngine.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.AppEngine(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.moduleId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AppEngine message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Service.AppEngine} AppEngine + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AppEngine.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AppEngine message. + * @function verify + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AppEngine.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.moduleId != null && message.hasOwnProperty("moduleId")) + if (!$util.isString(message.moduleId)) + return "moduleId: string expected"; + return null; + }; + + /** + * Creates an AppEngine message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Service.AppEngine} AppEngine + */ + AppEngine.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Service.AppEngine) + return object; + var message = new $root.google.monitoring.v3.Service.AppEngine(); + if (object.moduleId != null) + message.moduleId = String(object.moduleId); + return message; + }; + + /** + * Creates a plain object from an AppEngine message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {google.monitoring.v3.Service.AppEngine} message AppEngine + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AppEngine.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.moduleId = ""; + if (message.moduleId != null && message.hasOwnProperty("moduleId")) + object.moduleId = message.moduleId; + return object; + }; + + /** + * Converts this AppEngine to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Service.AppEngine + * @instance + * @returns {Object.} JSON object + */ + AppEngine.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AppEngine + * @function getTypeUrl + * @memberof google.monitoring.v3.Service.AppEngine + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AppEngine.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Service.AppEngine"; + }; + + return AppEngine; + })(); + + Service.CloudEndpoints = (function() { + + /** + * Properties of a CloudEndpoints. + * @memberof google.monitoring.v3.Service + * @interface ICloudEndpoints + * @property {string|null} [service] CloudEndpoints service + */ + + /** + * Constructs a new CloudEndpoints. + * @memberof google.monitoring.v3.Service + * @classdesc Represents a CloudEndpoints. + * @implements ICloudEndpoints + * @constructor + * @param {google.monitoring.v3.Service.ICloudEndpoints=} [properties] Properties to set + */ + function CloudEndpoints(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]]; + } + + /** + * CloudEndpoints service. + * @member {string} service + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @instance + */ + CloudEndpoints.prototype.service = ""; + + /** + * Creates a new CloudEndpoints instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {google.monitoring.v3.Service.ICloudEndpoints=} [properties] Properties to set + * @returns {google.monitoring.v3.Service.CloudEndpoints} CloudEndpoints instance + */ + CloudEndpoints.create = function create(properties) { + return new CloudEndpoints(properties); + }; + + /** + * Encodes the specified CloudEndpoints message. Does not implicitly {@link google.monitoring.v3.Service.CloudEndpoints.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {google.monitoring.v3.Service.ICloudEndpoints} message CloudEndpoints message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudEndpoints.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.service); + return writer; + }; + + /** + * Encodes the specified CloudEndpoints message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.CloudEndpoints.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {google.monitoring.v3.Service.ICloudEndpoints} message CloudEndpoints message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloudEndpoints.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CloudEndpoints message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Service.CloudEndpoints} CloudEndpoints + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudEndpoints.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.CloudEndpoints(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.service = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CloudEndpoints message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Service.CloudEndpoints} CloudEndpoints + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloudEndpoints.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloudEndpoints message. + * @function verify + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloudEndpoints.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.service != null && message.hasOwnProperty("service")) + if (!$util.isString(message.service)) + return "service: string expected"; + return null; + }; + + /** + * Creates a CloudEndpoints message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Service.CloudEndpoints} CloudEndpoints + */ + CloudEndpoints.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Service.CloudEndpoints) + return object; + var message = new $root.google.monitoring.v3.Service.CloudEndpoints(); + if (object.service != null) + message.service = String(object.service); + return message; + }; + + /** + * Creates a plain object from a CloudEndpoints message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {google.monitoring.v3.Service.CloudEndpoints} message CloudEndpoints + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloudEndpoints.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.service = ""; + if (message.service != null && message.hasOwnProperty("service")) + object.service = message.service; + return object; + }; + + /** + * Converts this CloudEndpoints to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @instance + * @returns {Object.} JSON object + */ + CloudEndpoints.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloudEndpoints + * @function getTypeUrl + * @memberof google.monitoring.v3.Service.CloudEndpoints + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloudEndpoints.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Service.CloudEndpoints"; + }; + + return CloudEndpoints; + })(); + + Service.ClusterIstio = (function() { + + /** + * Properties of a ClusterIstio. + * @memberof google.monitoring.v3.Service + * @interface IClusterIstio + * @property {string|null} [location] ClusterIstio location + * @property {string|null} [clusterName] ClusterIstio clusterName + * @property {string|null} [serviceNamespace] ClusterIstio serviceNamespace + * @property {string|null} [serviceName] ClusterIstio serviceName + */ + + /** + * Constructs a new ClusterIstio. + * @memberof google.monitoring.v3.Service + * @classdesc Represents a ClusterIstio. + * @implements IClusterIstio + * @constructor + * @param {google.monitoring.v3.Service.IClusterIstio=} [properties] Properties to set + */ + function ClusterIstio(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]]; + } + + /** + * ClusterIstio location. + * @member {string} location + * @memberof google.monitoring.v3.Service.ClusterIstio + * @instance + */ + ClusterIstio.prototype.location = ""; + + /** + * ClusterIstio clusterName. + * @member {string} clusterName + * @memberof google.monitoring.v3.Service.ClusterIstio + * @instance + */ + ClusterIstio.prototype.clusterName = ""; + + /** + * ClusterIstio serviceNamespace. + * @member {string} serviceNamespace + * @memberof google.monitoring.v3.Service.ClusterIstio + * @instance + */ + ClusterIstio.prototype.serviceNamespace = ""; + + /** + * ClusterIstio serviceName. + * @member {string} serviceName + * @memberof google.monitoring.v3.Service.ClusterIstio + * @instance + */ + ClusterIstio.prototype.serviceName = ""; + + /** + * Creates a new ClusterIstio instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {google.monitoring.v3.Service.IClusterIstio=} [properties] Properties to set + * @returns {google.monitoring.v3.Service.ClusterIstio} ClusterIstio instance + */ + ClusterIstio.create = function create(properties) { + return new ClusterIstio(properties); + }; + + /** + * Encodes the specified ClusterIstio message. Does not implicitly {@link google.monitoring.v3.Service.ClusterIstio.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {google.monitoring.v3.Service.IClusterIstio} message ClusterIstio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClusterIstio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.location); + if (message.clusterName != null && Object.hasOwnProperty.call(message, "clusterName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.clusterName); + if (message.serviceNamespace != null && Object.hasOwnProperty.call(message, "serviceNamespace")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.serviceNamespace); + if (message.serviceName != null && Object.hasOwnProperty.call(message, "serviceName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.serviceName); + return writer; + }; + + /** + * Encodes the specified ClusterIstio message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.ClusterIstio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {google.monitoring.v3.Service.IClusterIstio} message ClusterIstio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClusterIstio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClusterIstio message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Service.ClusterIstio} ClusterIstio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClusterIstio.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.ClusterIstio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.location = reader.string(); + break; + } + case 2: { + message.clusterName = reader.string(); + break; + } + case 3: { + message.serviceNamespace = reader.string(); + break; + } + case 4: { + message.serviceName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClusterIstio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Service.ClusterIstio} ClusterIstio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClusterIstio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClusterIstio message. + * @function verify + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClusterIstio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.clusterName != null && message.hasOwnProperty("clusterName")) + if (!$util.isString(message.clusterName)) + return "clusterName: string expected"; + if (message.serviceNamespace != null && message.hasOwnProperty("serviceNamespace")) + if (!$util.isString(message.serviceNamespace)) + return "serviceNamespace: string expected"; + if (message.serviceName != null && message.hasOwnProperty("serviceName")) + if (!$util.isString(message.serviceName)) + return "serviceName: string expected"; + return null; + }; + + /** + * Creates a ClusterIstio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Service.ClusterIstio} ClusterIstio + */ + ClusterIstio.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Service.ClusterIstio) + return object; + var message = new $root.google.monitoring.v3.Service.ClusterIstio(); + if (object.location != null) + message.location = String(object.location); + if (object.clusterName != null) + message.clusterName = String(object.clusterName); + if (object.serviceNamespace != null) + message.serviceNamespace = String(object.serviceNamespace); + if (object.serviceName != null) + message.serviceName = String(object.serviceName); + return message; + }; + + /** + * Creates a plain object from a ClusterIstio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {google.monitoring.v3.Service.ClusterIstio} message ClusterIstio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClusterIstio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.location = ""; + object.clusterName = ""; + object.serviceNamespace = ""; + object.serviceName = ""; + } + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.clusterName != null && message.hasOwnProperty("clusterName")) + object.clusterName = message.clusterName; + if (message.serviceNamespace != null && message.hasOwnProperty("serviceNamespace")) + object.serviceNamespace = message.serviceNamespace; + if (message.serviceName != null && message.hasOwnProperty("serviceName")) + object.serviceName = message.serviceName; + return object; + }; + + /** + * Converts this ClusterIstio to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Service.ClusterIstio + * @instance + * @returns {Object.} JSON object + */ + ClusterIstio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClusterIstio + * @function getTypeUrl + * @memberof google.monitoring.v3.Service.ClusterIstio + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClusterIstio.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Service.ClusterIstio"; + }; + + return ClusterIstio; + })(); + + Service.MeshIstio = (function() { + + /** + * Properties of a MeshIstio. + * @memberof google.monitoring.v3.Service + * @interface IMeshIstio + * @property {string|null} [meshUid] MeshIstio meshUid + * @property {string|null} [serviceNamespace] MeshIstio serviceNamespace + * @property {string|null} [serviceName] MeshIstio serviceName + */ + + /** + * Constructs a new MeshIstio. + * @memberof google.monitoring.v3.Service + * @classdesc Represents a MeshIstio. + * @implements IMeshIstio + * @constructor + * @param {google.monitoring.v3.Service.IMeshIstio=} [properties] Properties to set + */ + function MeshIstio(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]]; + } + + /** + * MeshIstio meshUid. + * @member {string} meshUid + * @memberof google.monitoring.v3.Service.MeshIstio + * @instance + */ + MeshIstio.prototype.meshUid = ""; + + /** + * MeshIstio serviceNamespace. + * @member {string} serviceNamespace + * @memberof google.monitoring.v3.Service.MeshIstio + * @instance + */ + MeshIstio.prototype.serviceNamespace = ""; + + /** + * MeshIstio serviceName. + * @member {string} serviceName + * @memberof google.monitoring.v3.Service.MeshIstio + * @instance + */ + MeshIstio.prototype.serviceName = ""; + + /** + * Creates a new MeshIstio instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {google.monitoring.v3.Service.IMeshIstio=} [properties] Properties to set + * @returns {google.monitoring.v3.Service.MeshIstio} MeshIstio instance + */ + MeshIstio.create = function create(properties) { + return new MeshIstio(properties); + }; + + /** + * Encodes the specified MeshIstio message. Does not implicitly {@link google.monitoring.v3.Service.MeshIstio.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {google.monitoring.v3.Service.IMeshIstio} message MeshIstio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MeshIstio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.meshUid != null && Object.hasOwnProperty.call(message, "meshUid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.meshUid); + if (message.serviceNamespace != null && Object.hasOwnProperty.call(message, "serviceNamespace")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.serviceNamespace); + if (message.serviceName != null && Object.hasOwnProperty.call(message, "serviceName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.serviceName); + return writer; + }; + + /** + * Encodes the specified MeshIstio message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.MeshIstio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {google.monitoring.v3.Service.IMeshIstio} message MeshIstio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MeshIstio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MeshIstio message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Service.MeshIstio} MeshIstio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MeshIstio.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.MeshIstio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.meshUid = reader.string(); + break; + } + case 3: { + message.serviceNamespace = reader.string(); + break; + } + case 4: { + message.serviceName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MeshIstio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Service.MeshIstio} MeshIstio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MeshIstio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MeshIstio message. + * @function verify + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MeshIstio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.meshUid != null && message.hasOwnProperty("meshUid")) + if (!$util.isString(message.meshUid)) + return "meshUid: string expected"; + if (message.serviceNamespace != null && message.hasOwnProperty("serviceNamespace")) + if (!$util.isString(message.serviceNamespace)) + return "serviceNamespace: string expected"; + if (message.serviceName != null && message.hasOwnProperty("serviceName")) + if (!$util.isString(message.serviceName)) + return "serviceName: string expected"; + return null; + }; + + /** + * Creates a MeshIstio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Service.MeshIstio} MeshIstio + */ + MeshIstio.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Service.MeshIstio) + return object; + var message = new $root.google.monitoring.v3.Service.MeshIstio(); + if (object.meshUid != null) + message.meshUid = String(object.meshUid); + if (object.serviceNamespace != null) + message.serviceNamespace = String(object.serviceNamespace); + if (object.serviceName != null) + message.serviceName = String(object.serviceName); + return message; + }; + + /** + * Creates a plain object from a MeshIstio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {google.monitoring.v3.Service.MeshIstio} message MeshIstio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MeshIstio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.meshUid = ""; + object.serviceNamespace = ""; + object.serviceName = ""; + } + if (message.meshUid != null && message.hasOwnProperty("meshUid")) + object.meshUid = message.meshUid; + if (message.serviceNamespace != null && message.hasOwnProperty("serviceNamespace")) + object.serviceNamespace = message.serviceNamespace; + if (message.serviceName != null && message.hasOwnProperty("serviceName")) + object.serviceName = message.serviceName; + return object; + }; + + /** + * Converts this MeshIstio to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Service.MeshIstio + * @instance + * @returns {Object.} JSON object + */ + MeshIstio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MeshIstio + * @function getTypeUrl + * @memberof google.monitoring.v3.Service.MeshIstio + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MeshIstio.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Service.MeshIstio"; + }; + + return MeshIstio; + })(); + + Service.IstioCanonicalService = (function() { + + /** + * Properties of an IstioCanonicalService. + * @memberof google.monitoring.v3.Service + * @interface IIstioCanonicalService + * @property {string|null} [meshUid] IstioCanonicalService meshUid + * @property {string|null} [canonicalServiceNamespace] IstioCanonicalService canonicalServiceNamespace + * @property {string|null} [canonicalService] IstioCanonicalService canonicalService + */ + + /** + * Constructs a new IstioCanonicalService. + * @memberof google.monitoring.v3.Service + * @classdesc Represents an IstioCanonicalService. + * @implements IIstioCanonicalService + * @constructor + * @param {google.monitoring.v3.Service.IIstioCanonicalService=} [properties] Properties to set + */ + function IstioCanonicalService(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]]; + } + + /** + * IstioCanonicalService meshUid. + * @member {string} meshUid + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @instance + */ + IstioCanonicalService.prototype.meshUid = ""; + + /** + * IstioCanonicalService canonicalServiceNamespace. + * @member {string} canonicalServiceNamespace + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @instance + */ + IstioCanonicalService.prototype.canonicalServiceNamespace = ""; + + /** + * IstioCanonicalService canonicalService. + * @member {string} canonicalService + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @instance + */ + IstioCanonicalService.prototype.canonicalService = ""; + + /** + * Creates a new IstioCanonicalService instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {google.monitoring.v3.Service.IIstioCanonicalService=} [properties] Properties to set + * @returns {google.monitoring.v3.Service.IstioCanonicalService} IstioCanonicalService instance + */ + IstioCanonicalService.create = function create(properties) { + return new IstioCanonicalService(properties); + }; + + /** + * Encodes the specified IstioCanonicalService message. Does not implicitly {@link google.monitoring.v3.Service.IstioCanonicalService.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {google.monitoring.v3.Service.IIstioCanonicalService} message IstioCanonicalService message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IstioCanonicalService.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.meshUid != null && Object.hasOwnProperty.call(message, "meshUid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.meshUid); + if (message.canonicalServiceNamespace != null && Object.hasOwnProperty.call(message, "canonicalServiceNamespace")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.canonicalServiceNamespace); + if (message.canonicalService != null && Object.hasOwnProperty.call(message, "canonicalService")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.canonicalService); + return writer; + }; + + /** + * Encodes the specified IstioCanonicalService message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.IstioCanonicalService.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {google.monitoring.v3.Service.IIstioCanonicalService} message IstioCanonicalService message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IstioCanonicalService.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IstioCanonicalService message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Service.IstioCanonicalService} IstioCanonicalService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IstioCanonicalService.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.IstioCanonicalService(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.meshUid = reader.string(); + break; + } + case 3: { + message.canonicalServiceNamespace = reader.string(); + break; + } + case 4: { + message.canonicalService = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IstioCanonicalService message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Service.IstioCanonicalService} IstioCanonicalService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IstioCanonicalService.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IstioCanonicalService message. + * @function verify + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IstioCanonicalService.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.meshUid != null && message.hasOwnProperty("meshUid")) + if (!$util.isString(message.meshUid)) + return "meshUid: string expected"; + if (message.canonicalServiceNamespace != null && message.hasOwnProperty("canonicalServiceNamespace")) + if (!$util.isString(message.canonicalServiceNamespace)) + return "canonicalServiceNamespace: string expected"; + if (message.canonicalService != null && message.hasOwnProperty("canonicalService")) + if (!$util.isString(message.canonicalService)) + return "canonicalService: string expected"; + return null; + }; + + /** + * Creates an IstioCanonicalService message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Service.IstioCanonicalService} IstioCanonicalService + */ + IstioCanonicalService.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Service.IstioCanonicalService) + return object; + var message = new $root.google.monitoring.v3.Service.IstioCanonicalService(); + if (object.meshUid != null) + message.meshUid = String(object.meshUid); + if (object.canonicalServiceNamespace != null) + message.canonicalServiceNamespace = String(object.canonicalServiceNamespace); + if (object.canonicalService != null) + message.canonicalService = String(object.canonicalService); + return message; + }; + + /** + * Creates a plain object from an IstioCanonicalService message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {google.monitoring.v3.Service.IstioCanonicalService} message IstioCanonicalService + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IstioCanonicalService.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.meshUid = ""; + object.canonicalServiceNamespace = ""; + object.canonicalService = ""; + } + if (message.meshUid != null && message.hasOwnProperty("meshUid")) + object.meshUid = message.meshUid; + if (message.canonicalServiceNamespace != null && message.hasOwnProperty("canonicalServiceNamespace")) + object.canonicalServiceNamespace = message.canonicalServiceNamespace; + if (message.canonicalService != null && message.hasOwnProperty("canonicalService")) + object.canonicalService = message.canonicalService; + return object; + }; + + /** + * Converts this IstioCanonicalService to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @instance + * @returns {Object.} JSON object + */ + IstioCanonicalService.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IstioCanonicalService + * @function getTypeUrl + * @memberof google.monitoring.v3.Service.IstioCanonicalService + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IstioCanonicalService.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Service.IstioCanonicalService"; + }; + + return IstioCanonicalService; + })(); + + Service.Telemetry = (function() { + + /** + * Properties of a Telemetry. + * @memberof google.monitoring.v3.Service + * @interface ITelemetry + * @property {string|null} [resourceName] Telemetry resourceName + */ + + /** + * Constructs a new Telemetry. + * @memberof google.monitoring.v3.Service + * @classdesc Represents a Telemetry. + * @implements ITelemetry + * @constructor + * @param {google.monitoring.v3.Service.ITelemetry=} [properties] Properties to set + */ + function Telemetry(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]]; + } + + /** + * Telemetry resourceName. + * @member {string} resourceName + * @memberof google.monitoring.v3.Service.Telemetry + * @instance + */ + Telemetry.prototype.resourceName = ""; + + /** + * Creates a new Telemetry instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {google.monitoring.v3.Service.ITelemetry=} [properties] Properties to set + * @returns {google.monitoring.v3.Service.Telemetry} Telemetry instance + */ + Telemetry.create = function create(properties) { + return new Telemetry(properties); + }; + + /** + * Encodes the specified Telemetry message. Does not implicitly {@link google.monitoring.v3.Service.Telemetry.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {google.monitoring.v3.Service.ITelemetry} message Telemetry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Telemetry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resourceName != null && Object.hasOwnProperty.call(message, "resourceName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resourceName); + return writer; + }; + + /** + * Encodes the specified Telemetry message, length delimited. Does not implicitly {@link google.monitoring.v3.Service.Telemetry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {google.monitoring.v3.Service.ITelemetry} message Telemetry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Telemetry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Telemetry message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Service.Telemetry} Telemetry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Telemetry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Service.Telemetry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.resourceName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Telemetry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Service.Telemetry} Telemetry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Telemetry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Telemetry message. + * @function verify + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Telemetry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resourceName != null && message.hasOwnProperty("resourceName")) + if (!$util.isString(message.resourceName)) + return "resourceName: string expected"; + return null; + }; + + /** + * Creates a Telemetry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Service.Telemetry} Telemetry + */ + Telemetry.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Service.Telemetry) + return object; + var message = new $root.google.monitoring.v3.Service.Telemetry(); + if (object.resourceName != null) + message.resourceName = String(object.resourceName); + return message; + }; + + /** + * Creates a plain object from a Telemetry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {google.monitoring.v3.Service.Telemetry} message Telemetry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Telemetry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.resourceName = ""; + if (message.resourceName != null && message.hasOwnProperty("resourceName")) + object.resourceName = message.resourceName; + return object; + }; + + /** + * Converts this Telemetry to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Service.Telemetry + * @instance + * @returns {Object.} JSON object + */ + Telemetry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Telemetry + * @function getTypeUrl + * @memberof google.monitoring.v3.Service.Telemetry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Telemetry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Service.Telemetry"; + }; + + return Telemetry; + })(); + + return Service; + })(); + + v3.ServiceLevelObjective = (function() { + + /** + * Properties of a ServiceLevelObjective. + * @memberof google.monitoring.v3 + * @interface IServiceLevelObjective + * @property {string|null} [name] ServiceLevelObjective name + * @property {string|null} [displayName] ServiceLevelObjective displayName + * @property {google.monitoring.v3.IServiceLevelIndicator|null} [serviceLevelIndicator] ServiceLevelObjective serviceLevelIndicator + * @property {number|null} [goal] ServiceLevelObjective goal + * @property {google.protobuf.IDuration|null} [rollingPeriod] ServiceLevelObjective rollingPeriod + * @property {google.type.CalendarPeriod|null} [calendarPeriod] ServiceLevelObjective calendarPeriod + */ + + /** + * Constructs a new ServiceLevelObjective. + * @memberof google.monitoring.v3 + * @classdesc Represents a ServiceLevelObjective. + * @implements IServiceLevelObjective + * @constructor + * @param {google.monitoring.v3.IServiceLevelObjective=} [properties] Properties to set + */ + function ServiceLevelObjective(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]]; + } + + /** + * ServiceLevelObjective name. + * @member {string} name + * @memberof google.monitoring.v3.ServiceLevelObjective + * @instance + */ + ServiceLevelObjective.prototype.name = ""; + + /** + * ServiceLevelObjective displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.ServiceLevelObjective + * @instance + */ + ServiceLevelObjective.prototype.displayName = ""; + + /** + * ServiceLevelObjective serviceLevelIndicator. + * @member {google.monitoring.v3.IServiceLevelIndicator|null|undefined} serviceLevelIndicator + * @memberof google.monitoring.v3.ServiceLevelObjective + * @instance + */ + ServiceLevelObjective.prototype.serviceLevelIndicator = null; + + /** + * ServiceLevelObjective goal. + * @member {number} goal + * @memberof google.monitoring.v3.ServiceLevelObjective + * @instance + */ + ServiceLevelObjective.prototype.goal = 0; + + /** + * ServiceLevelObjective rollingPeriod. + * @member {google.protobuf.IDuration|null|undefined} rollingPeriod + * @memberof google.monitoring.v3.ServiceLevelObjective + * @instance + */ + ServiceLevelObjective.prototype.rollingPeriod = null; + + /** + * ServiceLevelObjective calendarPeriod. + * @member {google.type.CalendarPeriod|null|undefined} calendarPeriod + * @memberof google.monitoring.v3.ServiceLevelObjective + * @instance + */ + ServiceLevelObjective.prototype.calendarPeriod = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ServiceLevelObjective period. + * @member {"rollingPeriod"|"calendarPeriod"|undefined} period + * @memberof google.monitoring.v3.ServiceLevelObjective + * @instance + */ + Object.defineProperty(ServiceLevelObjective.prototype, "period", { + get: $util.oneOfGetter($oneOfFields = ["rollingPeriod", "calendarPeriod"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ServiceLevelObjective instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {google.monitoring.v3.IServiceLevelObjective=} [properties] Properties to set + * @returns {google.monitoring.v3.ServiceLevelObjective} ServiceLevelObjective instance + */ + ServiceLevelObjective.create = function create(properties) { + return new ServiceLevelObjective(properties); + }; + + /** + * Encodes the specified ServiceLevelObjective message. Does not implicitly {@link google.monitoring.v3.ServiceLevelObjective.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {google.monitoring.v3.IServiceLevelObjective} message ServiceLevelObjective message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceLevelObjective.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.serviceLevelIndicator != null && Object.hasOwnProperty.call(message, "serviceLevelIndicator")) + $root.google.monitoring.v3.ServiceLevelIndicator.encode(message.serviceLevelIndicator, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.goal != null && Object.hasOwnProperty.call(message, "goal")) + writer.uint32(/* id 4, wireType 1 =*/33).double(message.goal); + if (message.rollingPeriod != null && Object.hasOwnProperty.call(message, "rollingPeriod")) + $root.google.protobuf.Duration.encode(message.rollingPeriod, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.calendarPeriod != null && Object.hasOwnProperty.call(message, "calendarPeriod")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.calendarPeriod); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.displayName); + return writer; + }; + + /** + * Encodes the specified ServiceLevelObjective message, length delimited. Does not implicitly {@link google.monitoring.v3.ServiceLevelObjective.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {google.monitoring.v3.IServiceLevelObjective} message ServiceLevelObjective message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceLevelObjective.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceLevelObjective message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ServiceLevelObjective} ServiceLevelObjective + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceLevelObjective.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ServiceLevelObjective(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 11: { + message.displayName = reader.string(); + break; + } + case 3: { + message.serviceLevelIndicator = $root.google.monitoring.v3.ServiceLevelIndicator.decode(reader, reader.uint32()); + break; + } + case 4: { + message.goal = reader.double(); + break; + } + case 5: { + message.rollingPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 6: { + message.calendarPeriod = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceLevelObjective message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ServiceLevelObjective} ServiceLevelObjective + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceLevelObjective.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceLevelObjective message. + * @function verify + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceLevelObjective.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.serviceLevelIndicator != null && message.hasOwnProperty("serviceLevelIndicator")) { + var error = $root.google.monitoring.v3.ServiceLevelIndicator.verify(message.serviceLevelIndicator); + if (error) + return "serviceLevelIndicator." + error; + } + if (message.goal != null && message.hasOwnProperty("goal")) + if (typeof message.goal !== "number") + return "goal: number expected"; + if (message.rollingPeriod != null && message.hasOwnProperty("rollingPeriod")) { + properties.period = 1; + { + var error = $root.google.protobuf.Duration.verify(message.rollingPeriod); + if (error) + return "rollingPeriod." + error; + } + } + if (message.calendarPeriod != null && message.hasOwnProperty("calendarPeriod")) { + if (properties.period === 1) + return "period: multiple values"; + properties.period = 1; + switch (message.calendarPeriod) { + default: + return "calendarPeriod: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + } + return null; + }; + + /** + * Creates a ServiceLevelObjective message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ServiceLevelObjective} ServiceLevelObjective + */ + ServiceLevelObjective.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ServiceLevelObjective) + return object; + var message = new $root.google.monitoring.v3.ServiceLevelObjective(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.serviceLevelIndicator != null) { + if (typeof object.serviceLevelIndicator !== "object") + throw TypeError(".google.monitoring.v3.ServiceLevelObjective.serviceLevelIndicator: object expected"); + message.serviceLevelIndicator = $root.google.monitoring.v3.ServiceLevelIndicator.fromObject(object.serviceLevelIndicator); + } + if (object.goal != null) + message.goal = Number(object.goal); + if (object.rollingPeriod != null) { + if (typeof object.rollingPeriod !== "object") + throw TypeError(".google.monitoring.v3.ServiceLevelObjective.rollingPeriod: object expected"); + message.rollingPeriod = $root.google.protobuf.Duration.fromObject(object.rollingPeriod); + } + switch (object.calendarPeriod) { + default: + if (typeof object.calendarPeriod === "number") { + message.calendarPeriod = object.calendarPeriod; + break; + } + break; + case "CALENDAR_PERIOD_UNSPECIFIED": + case 0: + message.calendarPeriod = 0; + break; + case "DAY": + case 1: + message.calendarPeriod = 1; + break; + case "WEEK": + case 2: + message.calendarPeriod = 2; + break; + case "FORTNIGHT": + case 3: + message.calendarPeriod = 3; + break; + case "MONTH": + case 4: + message.calendarPeriod = 4; + break; + case "QUARTER": + case 5: + message.calendarPeriod = 5; + break; + case "HALF": + case 6: + message.calendarPeriod = 6; + break; + case "YEAR": + case 7: + message.calendarPeriod = 7; + break; + } + return message; + }; + + /** + * Creates a plain object from a ServiceLevelObjective message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {google.monitoring.v3.ServiceLevelObjective} message ServiceLevelObjective + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceLevelObjective.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.serviceLevelIndicator = null; + object.goal = 0; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.serviceLevelIndicator != null && message.hasOwnProperty("serviceLevelIndicator")) + object.serviceLevelIndicator = $root.google.monitoring.v3.ServiceLevelIndicator.toObject(message.serviceLevelIndicator, options); + if (message.goal != null && message.hasOwnProperty("goal")) + object.goal = options.json && !isFinite(message.goal) ? String(message.goal) : message.goal; + if (message.rollingPeriod != null && message.hasOwnProperty("rollingPeriod")) { + object.rollingPeriod = $root.google.protobuf.Duration.toObject(message.rollingPeriod, options); + if (options.oneofs) + object.period = "rollingPeriod"; + } + if (message.calendarPeriod != null && message.hasOwnProperty("calendarPeriod")) { + object.calendarPeriod = options.enums === String ? $root.google.type.CalendarPeriod[message.calendarPeriod] === undefined ? message.calendarPeriod : $root.google.type.CalendarPeriod[message.calendarPeriod] : message.calendarPeriod; + if (options.oneofs) + object.period = "calendarPeriod"; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + return object; + }; + + /** + * Converts this ServiceLevelObjective to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ServiceLevelObjective + * @instance + * @returns {Object.} JSON object + */ + ServiceLevelObjective.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceLevelObjective + * @function getTypeUrl + * @memberof google.monitoring.v3.ServiceLevelObjective + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceLevelObjective.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ServiceLevelObjective"; + }; + + /** + * View enum. + * @name google.monitoring.v3.ServiceLevelObjective.View + * @enum {number} + * @property {number} VIEW_UNSPECIFIED=0 VIEW_UNSPECIFIED value + * @property {number} FULL=2 FULL value + * @property {number} EXPLICIT=1 EXPLICIT value + */ + ServiceLevelObjective.View = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VIEW_UNSPECIFIED"] = 0; + values[valuesById[2] = "FULL"] = 2; + values[valuesById[1] = "EXPLICIT"] = 1; + return values; + })(); + + return ServiceLevelObjective; + })(); + + v3.ServiceLevelIndicator = (function() { + + /** + * Properties of a ServiceLevelIndicator. + * @memberof google.monitoring.v3 + * @interface IServiceLevelIndicator + * @property {google.monitoring.v3.IBasicSli|null} [basicSli] ServiceLevelIndicator basicSli + * @property {google.monitoring.v3.IRequestBasedSli|null} [requestBased] ServiceLevelIndicator requestBased + * @property {google.monitoring.v3.IWindowsBasedSli|null} [windowsBased] ServiceLevelIndicator windowsBased + */ + + /** + * Constructs a new ServiceLevelIndicator. + * @memberof google.monitoring.v3 + * @classdesc Represents a ServiceLevelIndicator. + * @implements IServiceLevelIndicator + * @constructor + * @param {google.monitoring.v3.IServiceLevelIndicator=} [properties] Properties to set + */ + function ServiceLevelIndicator(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]]; + } + + /** + * ServiceLevelIndicator basicSli. + * @member {google.monitoring.v3.IBasicSli|null|undefined} basicSli + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @instance + */ + ServiceLevelIndicator.prototype.basicSli = null; + + /** + * ServiceLevelIndicator requestBased. + * @member {google.monitoring.v3.IRequestBasedSli|null|undefined} requestBased + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @instance + */ + ServiceLevelIndicator.prototype.requestBased = null; + + /** + * ServiceLevelIndicator windowsBased. + * @member {google.monitoring.v3.IWindowsBasedSli|null|undefined} windowsBased + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @instance + */ + ServiceLevelIndicator.prototype.windowsBased = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ServiceLevelIndicator type. + * @member {"basicSli"|"requestBased"|"windowsBased"|undefined} type + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @instance + */ + Object.defineProperty(ServiceLevelIndicator.prototype, "type", { + get: $util.oneOfGetter($oneOfFields = ["basicSli", "requestBased", "windowsBased"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ServiceLevelIndicator instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {google.monitoring.v3.IServiceLevelIndicator=} [properties] Properties to set + * @returns {google.monitoring.v3.ServiceLevelIndicator} ServiceLevelIndicator instance + */ + ServiceLevelIndicator.create = function create(properties) { + return new ServiceLevelIndicator(properties); + }; + + /** + * Encodes the specified ServiceLevelIndicator message. Does not implicitly {@link google.monitoring.v3.ServiceLevelIndicator.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {google.monitoring.v3.IServiceLevelIndicator} message ServiceLevelIndicator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceLevelIndicator.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.requestBased != null && Object.hasOwnProperty.call(message, "requestBased")) + $root.google.monitoring.v3.RequestBasedSli.encode(message.requestBased, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.windowsBased != null && Object.hasOwnProperty.call(message, "windowsBased")) + $root.google.monitoring.v3.WindowsBasedSli.encode(message.windowsBased, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.basicSli != null && Object.hasOwnProperty.call(message, "basicSli")) + $root.google.monitoring.v3.BasicSli.encode(message.basicSli, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceLevelIndicator message, length delimited. Does not implicitly {@link google.monitoring.v3.ServiceLevelIndicator.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {google.monitoring.v3.IServiceLevelIndicator} message ServiceLevelIndicator message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceLevelIndicator.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceLevelIndicator message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ServiceLevelIndicator} ServiceLevelIndicator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceLevelIndicator.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ServiceLevelIndicator(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.basicSli = $root.google.monitoring.v3.BasicSli.decode(reader, reader.uint32()); + break; + } + case 1: { + message.requestBased = $root.google.monitoring.v3.RequestBasedSli.decode(reader, reader.uint32()); + break; + } + case 2: { + message.windowsBased = $root.google.monitoring.v3.WindowsBasedSli.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceLevelIndicator message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ServiceLevelIndicator} ServiceLevelIndicator + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceLevelIndicator.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceLevelIndicator message. + * @function verify + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceLevelIndicator.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.basicSli != null && message.hasOwnProperty("basicSli")) { + properties.type = 1; + { + var error = $root.google.monitoring.v3.BasicSli.verify(message.basicSli); + if (error) + return "basicSli." + error; + } + } + if (message.requestBased != null && message.hasOwnProperty("requestBased")) { + if (properties.type === 1) + return "type: multiple values"; + properties.type = 1; + { + var error = $root.google.monitoring.v3.RequestBasedSli.verify(message.requestBased); + if (error) + return "requestBased." + error; + } + } + if (message.windowsBased != null && message.hasOwnProperty("windowsBased")) { + if (properties.type === 1) + return "type: multiple values"; + properties.type = 1; + { + var error = $root.google.monitoring.v3.WindowsBasedSli.verify(message.windowsBased); + if (error) + return "windowsBased." + error; + } + } + return null; + }; + + /** + * Creates a ServiceLevelIndicator message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ServiceLevelIndicator} ServiceLevelIndicator + */ + ServiceLevelIndicator.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ServiceLevelIndicator) + return object; + var message = new $root.google.monitoring.v3.ServiceLevelIndicator(); + if (object.basicSli != null) { + if (typeof object.basicSli !== "object") + throw TypeError(".google.monitoring.v3.ServiceLevelIndicator.basicSli: object expected"); + message.basicSli = $root.google.monitoring.v3.BasicSli.fromObject(object.basicSli); + } + if (object.requestBased != null) { + if (typeof object.requestBased !== "object") + throw TypeError(".google.monitoring.v3.ServiceLevelIndicator.requestBased: object expected"); + message.requestBased = $root.google.monitoring.v3.RequestBasedSli.fromObject(object.requestBased); + } + if (object.windowsBased != null) { + if (typeof object.windowsBased !== "object") + throw TypeError(".google.monitoring.v3.ServiceLevelIndicator.windowsBased: object expected"); + message.windowsBased = $root.google.monitoring.v3.WindowsBasedSli.fromObject(object.windowsBased); + } + return message; + }; + + /** + * Creates a plain object from a ServiceLevelIndicator message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {google.monitoring.v3.ServiceLevelIndicator} message ServiceLevelIndicator + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceLevelIndicator.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.requestBased != null && message.hasOwnProperty("requestBased")) { + object.requestBased = $root.google.monitoring.v3.RequestBasedSli.toObject(message.requestBased, options); + if (options.oneofs) + object.type = "requestBased"; + } + if (message.windowsBased != null && message.hasOwnProperty("windowsBased")) { + object.windowsBased = $root.google.monitoring.v3.WindowsBasedSli.toObject(message.windowsBased, options); + if (options.oneofs) + object.type = "windowsBased"; + } + if (message.basicSli != null && message.hasOwnProperty("basicSli")) { + object.basicSli = $root.google.monitoring.v3.BasicSli.toObject(message.basicSli, options); + if (options.oneofs) + object.type = "basicSli"; + } + return object; + }; + + /** + * Converts this ServiceLevelIndicator to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @instance + * @returns {Object.} JSON object + */ + ServiceLevelIndicator.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceLevelIndicator + * @function getTypeUrl + * @memberof google.monitoring.v3.ServiceLevelIndicator + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceLevelIndicator.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ServiceLevelIndicator"; + }; + + return ServiceLevelIndicator; + })(); + + v3.BasicSli = (function() { + + /** + * Properties of a BasicSli. + * @memberof google.monitoring.v3 + * @interface IBasicSli + * @property {Array.|null} [method] BasicSli method + * @property {Array.|null} [location] BasicSli location + * @property {Array.|null} [version] BasicSli version + * @property {google.monitoring.v3.BasicSli.IAvailabilityCriteria|null} [availability] BasicSli availability + * @property {google.monitoring.v3.BasicSli.ILatencyCriteria|null} [latency] BasicSli latency + */ + + /** + * Constructs a new BasicSli. + * @memberof google.monitoring.v3 + * @classdesc Represents a BasicSli. + * @implements IBasicSli + * @constructor + * @param {google.monitoring.v3.IBasicSli=} [properties] Properties to set + */ + function BasicSli(properties) { + this.method = []; + this.location = []; + this.version = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BasicSli method. + * @member {Array.} method + * @memberof google.monitoring.v3.BasicSli + * @instance + */ + BasicSli.prototype.method = $util.emptyArray; + + /** + * BasicSli location. + * @member {Array.} location + * @memberof google.monitoring.v3.BasicSli + * @instance + */ + BasicSli.prototype.location = $util.emptyArray; + + /** + * BasicSli version. + * @member {Array.} version + * @memberof google.monitoring.v3.BasicSli + * @instance + */ + BasicSli.prototype.version = $util.emptyArray; + + /** + * BasicSli availability. + * @member {google.monitoring.v3.BasicSli.IAvailabilityCriteria|null|undefined} availability + * @memberof google.monitoring.v3.BasicSli + * @instance + */ + BasicSli.prototype.availability = null; + + /** + * BasicSli latency. + * @member {google.monitoring.v3.BasicSli.ILatencyCriteria|null|undefined} latency + * @memberof google.monitoring.v3.BasicSli + * @instance + */ + BasicSli.prototype.latency = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BasicSli sliCriteria. + * @member {"availability"|"latency"|undefined} sliCriteria + * @memberof google.monitoring.v3.BasicSli + * @instance + */ + Object.defineProperty(BasicSli.prototype, "sliCriteria", { + get: $util.oneOfGetter($oneOfFields = ["availability", "latency"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BasicSli instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {google.monitoring.v3.IBasicSli=} [properties] Properties to set + * @returns {google.monitoring.v3.BasicSli} BasicSli instance + */ + BasicSli.create = function create(properties) { + return new BasicSli(properties); + }; + + /** + * Encodes the specified BasicSli message. Does not implicitly {@link google.monitoring.v3.BasicSli.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {google.monitoring.v3.IBasicSli} message BasicSli message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BasicSli.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.availability != null && Object.hasOwnProperty.call(message, "availability")) + $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.encode(message.availability, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.latency != null && Object.hasOwnProperty.call(message, "latency")) + $root.google.monitoring.v3.BasicSli.LatencyCriteria.encode(message.latency, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.method[i]); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.location[i]); + if (message.version != null && message.version.length) + for (var i = 0; i < message.version.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.version[i]); + return writer; + }; + + /** + * Encodes the specified BasicSli message, length delimited. Does not implicitly {@link google.monitoring.v3.BasicSli.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {google.monitoring.v3.IBasicSli} message BasicSli message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BasicSli.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BasicSli message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.BasicSli} BasicSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BasicSli.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.BasicSli(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 7: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push(reader.string()); + break; + } + case 8: { + if (!(message.location && message.location.length)) + message.location = []; + message.location.push(reader.string()); + break; + } + case 9: { + if (!(message.version && message.version.length)) + message.version = []; + message.version.push(reader.string()); + break; + } + case 2: { + message.availability = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.decode(reader, reader.uint32()); + break; + } + case 3: { + message.latency = $root.google.monitoring.v3.BasicSli.LatencyCriteria.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BasicSli message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.BasicSli} BasicSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BasicSli.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BasicSli message. + * @function verify + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BasicSli.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + 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) + if (!$util.isString(message.method[i])) + return "method: string[] 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) + if (!$util.isString(message.location[i])) + return "location: string[] expected"; + } + if (message.version != null && message.hasOwnProperty("version")) { + if (!Array.isArray(message.version)) + return "version: array expected"; + for (var i = 0; i < message.version.length; ++i) + if (!$util.isString(message.version[i])) + return "version: string[] expected"; + } + if (message.availability != null && message.hasOwnProperty("availability")) { + properties.sliCriteria = 1; + { + var error = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.verify(message.availability); + if (error) + return "availability." + error; + } + } + if (message.latency != null && message.hasOwnProperty("latency")) { + if (properties.sliCriteria === 1) + return "sliCriteria: multiple values"; + properties.sliCriteria = 1; + { + var error = $root.google.monitoring.v3.BasicSli.LatencyCriteria.verify(message.latency); + if (error) + return "latency." + error; + } + } + return null; + }; + + /** + * Creates a BasicSli message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.BasicSli} BasicSli + */ + BasicSli.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.BasicSli) + return object; + var message = new $root.google.monitoring.v3.BasicSli(); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.monitoring.v3.BasicSli.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) + message.method[i] = String(object.method[i]); + } + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.monitoring.v3.BasicSli.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) + message.location[i] = String(object.location[i]); + } + if (object.version) { + if (!Array.isArray(object.version)) + throw TypeError(".google.monitoring.v3.BasicSli.version: array expected"); + message.version = []; + for (var i = 0; i < object.version.length; ++i) + message.version[i] = String(object.version[i]); + } + if (object.availability != null) { + if (typeof object.availability !== "object") + throw TypeError(".google.monitoring.v3.BasicSli.availability: object expected"); + message.availability = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.fromObject(object.availability); + } + if (object.latency != null) { + if (typeof object.latency !== "object") + throw TypeError(".google.monitoring.v3.BasicSli.latency: object expected"); + message.latency = $root.google.monitoring.v3.BasicSli.LatencyCriteria.fromObject(object.latency); + } + return message; + }; + + /** + * Creates a plain object from a BasicSli message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {google.monitoring.v3.BasicSli} message BasicSli + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BasicSli.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.method = []; + object.location = []; + object.version = []; + } + if (message.availability != null && message.hasOwnProperty("availability")) { + object.availability = $root.google.monitoring.v3.BasicSli.AvailabilityCriteria.toObject(message.availability, options); + if (options.oneofs) + object.sliCriteria = "availability"; + } + if (message.latency != null && message.hasOwnProperty("latency")) { + object.latency = $root.google.monitoring.v3.BasicSli.LatencyCriteria.toObject(message.latency, options); + if (options.oneofs) + object.sliCriteria = "latency"; + } + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = message.method[j]; + } + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = message.location[j]; + } + if (message.version && message.version.length) { + object.version = []; + for (var j = 0; j < message.version.length; ++j) + object.version[j] = message.version[j]; + } + return object; + }; + + /** + * Converts this BasicSli to JSON. + * @function toJSON + * @memberof google.monitoring.v3.BasicSli + * @instance + * @returns {Object.} JSON object + */ + BasicSli.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BasicSli + * @function getTypeUrl + * @memberof google.monitoring.v3.BasicSli + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BasicSli.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.BasicSli"; + }; + + BasicSli.AvailabilityCriteria = (function() { + + /** + * Properties of an AvailabilityCriteria. + * @memberof google.monitoring.v3.BasicSli + * @interface IAvailabilityCriteria + */ + + /** + * Constructs a new AvailabilityCriteria. + * @memberof google.monitoring.v3.BasicSli + * @classdesc Represents an AvailabilityCriteria. + * @implements IAvailabilityCriteria + * @constructor + * @param {google.monitoring.v3.BasicSli.IAvailabilityCriteria=} [properties] Properties to set + */ + function AvailabilityCriteria(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new AvailabilityCriteria instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {google.monitoring.v3.BasicSli.IAvailabilityCriteria=} [properties] Properties to set + * @returns {google.monitoring.v3.BasicSli.AvailabilityCriteria} AvailabilityCriteria instance + */ + AvailabilityCriteria.create = function create(properties) { + return new AvailabilityCriteria(properties); + }; + + /** + * Encodes the specified AvailabilityCriteria message. Does not implicitly {@link google.monitoring.v3.BasicSli.AvailabilityCriteria.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {google.monitoring.v3.BasicSli.IAvailabilityCriteria} message AvailabilityCriteria message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvailabilityCriteria.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified AvailabilityCriteria message, length delimited. Does not implicitly {@link google.monitoring.v3.BasicSli.AvailabilityCriteria.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {google.monitoring.v3.BasicSli.IAvailabilityCriteria} message AvailabilityCriteria message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvailabilityCriteria.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AvailabilityCriteria message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.BasicSli.AvailabilityCriteria} AvailabilityCriteria + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvailabilityCriteria.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.BasicSli.AvailabilityCriteria(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AvailabilityCriteria message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.BasicSli.AvailabilityCriteria} AvailabilityCriteria + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvailabilityCriteria.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AvailabilityCriteria message. + * @function verify + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AvailabilityCriteria.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an AvailabilityCriteria message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.BasicSli.AvailabilityCriteria} AvailabilityCriteria + */ + AvailabilityCriteria.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.BasicSli.AvailabilityCriteria) + return object; + return new $root.google.monitoring.v3.BasicSli.AvailabilityCriteria(); + }; + + /** + * Creates a plain object from an AvailabilityCriteria message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {google.monitoring.v3.BasicSli.AvailabilityCriteria} message AvailabilityCriteria + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AvailabilityCriteria.toObject = function toObject() { + return {}; + }; + + /** + * Converts this AvailabilityCriteria to JSON. + * @function toJSON + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @instance + * @returns {Object.} JSON object + */ + AvailabilityCriteria.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AvailabilityCriteria + * @function getTypeUrl + * @memberof google.monitoring.v3.BasicSli.AvailabilityCriteria + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AvailabilityCriteria.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.BasicSli.AvailabilityCriteria"; + }; + + return AvailabilityCriteria; + })(); + + BasicSli.LatencyCriteria = (function() { + + /** + * Properties of a LatencyCriteria. + * @memberof google.monitoring.v3.BasicSli + * @interface ILatencyCriteria + * @property {google.protobuf.IDuration|null} [threshold] LatencyCriteria threshold + */ + + /** + * Constructs a new LatencyCriteria. + * @memberof google.monitoring.v3.BasicSli + * @classdesc Represents a LatencyCriteria. + * @implements ILatencyCriteria + * @constructor + * @param {google.monitoring.v3.BasicSli.ILatencyCriteria=} [properties] Properties to set + */ + function LatencyCriteria(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]]; + } + + /** + * LatencyCriteria threshold. + * @member {google.protobuf.IDuration|null|undefined} threshold + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @instance + */ + LatencyCriteria.prototype.threshold = null; + + /** + * Creates a new LatencyCriteria instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {google.monitoring.v3.BasicSli.ILatencyCriteria=} [properties] Properties to set + * @returns {google.monitoring.v3.BasicSli.LatencyCriteria} LatencyCriteria instance + */ + LatencyCriteria.create = function create(properties) { + return new LatencyCriteria(properties); + }; + + /** + * Encodes the specified LatencyCriteria message. Does not implicitly {@link google.monitoring.v3.BasicSli.LatencyCriteria.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {google.monitoring.v3.BasicSli.ILatencyCriteria} message LatencyCriteria message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LatencyCriteria.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) + $root.google.protobuf.Duration.encode(message.threshold, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LatencyCriteria message, length delimited. Does not implicitly {@link google.monitoring.v3.BasicSli.LatencyCriteria.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {google.monitoring.v3.BasicSli.ILatencyCriteria} message LatencyCriteria message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LatencyCriteria.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LatencyCriteria message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.BasicSli.LatencyCriteria} LatencyCriteria + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LatencyCriteria.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.BasicSli.LatencyCriteria(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.threshold = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LatencyCriteria message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.BasicSli.LatencyCriteria} LatencyCriteria + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LatencyCriteria.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LatencyCriteria message. + * @function verify + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LatencyCriteria.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.threshold != null && message.hasOwnProperty("threshold")) { + var error = $root.google.protobuf.Duration.verify(message.threshold); + if (error) + return "threshold." + error; + } + return null; + }; + + /** + * Creates a LatencyCriteria message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.BasicSli.LatencyCriteria} LatencyCriteria + */ + LatencyCriteria.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.BasicSli.LatencyCriteria) + return object; + var message = new $root.google.monitoring.v3.BasicSli.LatencyCriteria(); + if (object.threshold != null) { + if (typeof object.threshold !== "object") + throw TypeError(".google.monitoring.v3.BasicSli.LatencyCriteria.threshold: object expected"); + message.threshold = $root.google.protobuf.Duration.fromObject(object.threshold); + } + return message; + }; + + /** + * Creates a plain object from a LatencyCriteria message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {google.monitoring.v3.BasicSli.LatencyCriteria} message LatencyCriteria + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LatencyCriteria.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.threshold = null; + if (message.threshold != null && message.hasOwnProperty("threshold")) + object.threshold = $root.google.protobuf.Duration.toObject(message.threshold, options); + return object; + }; + + /** + * Converts this LatencyCriteria to JSON. + * @function toJSON + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @instance + * @returns {Object.} JSON object + */ + LatencyCriteria.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LatencyCriteria + * @function getTypeUrl + * @memberof google.monitoring.v3.BasicSli.LatencyCriteria + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LatencyCriteria.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.BasicSli.LatencyCriteria"; + }; + + return LatencyCriteria; + })(); + + return BasicSli; + })(); + + v3.Range = (function() { + + /** + * Properties of a Range. + * @memberof google.monitoring.v3 + * @interface IRange + * @property {number|null} [min] Range min + * @property {number|null} [max] Range max + */ + + /** + * Constructs a new Range. + * @memberof google.monitoring.v3 + * @classdesc Represents a Range. + * @implements IRange + * @constructor + * @param {google.monitoring.v3.IRange=} [properties] Properties to set + */ + function Range(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]]; + } + + /** + * Range min. + * @member {number} min + * @memberof google.monitoring.v3.Range + * @instance + */ + Range.prototype.min = 0; + + /** + * Range max. + * @member {number} max + * @memberof google.monitoring.v3.Range + * @instance + */ + Range.prototype.max = 0; + + /** + * Creates a new Range instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.Range + * @static + * @param {google.monitoring.v3.IRange=} [properties] Properties to set + * @returns {google.monitoring.v3.Range} Range instance + */ + Range.create = function create(properties) { + return new Range(properties); + }; + + /** + * Encodes the specified Range message. Does not implicitly {@link google.monitoring.v3.Range.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.Range + * @static + * @param {google.monitoring.v3.IRange} message Range message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Range.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.min != null && Object.hasOwnProperty.call(message, "min")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.min); + if (message.max != null && Object.hasOwnProperty.call(message, "max")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.max); + return writer; + }; + + /** + * Encodes the specified Range message, length delimited. Does not implicitly {@link google.monitoring.v3.Range.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.Range + * @static + * @param {google.monitoring.v3.IRange} message Range message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Range.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Range message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.Range + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.Range} Range + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Range.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.Range(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.min = reader.double(); + break; + } + case 2: { + message.max = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Range message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.Range + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.Range} Range + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Range.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Range message. + * @function verify + * @memberof google.monitoring.v3.Range + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Range.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.min != null && message.hasOwnProperty("min")) + if (typeof message.min !== "number") + return "min: number expected"; + if (message.max != null && message.hasOwnProperty("max")) + if (typeof message.max !== "number") + return "max: number expected"; + return null; + }; + + /** + * Creates a Range message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.Range + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.Range} Range + */ + Range.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.Range) + return object; + var message = new $root.google.monitoring.v3.Range(); + if (object.min != null) + message.min = Number(object.min); + if (object.max != null) + message.max = Number(object.max); + return message; + }; + + /** + * Creates a plain object from a Range message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.Range + * @static + * @param {google.monitoring.v3.Range} message Range + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Range.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.min = 0; + object.max = 0; + } + if (message.min != null && message.hasOwnProperty("min")) + object.min = options.json && !isFinite(message.min) ? String(message.min) : message.min; + if (message.max != null && message.hasOwnProperty("max")) + object.max = options.json && !isFinite(message.max) ? String(message.max) : message.max; + return object; + }; + + /** + * Converts this Range to JSON. + * @function toJSON + * @memberof google.monitoring.v3.Range + * @instance + * @returns {Object.} JSON object + */ + Range.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Range + * @function getTypeUrl + * @memberof google.monitoring.v3.Range + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Range.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.Range"; + }; + + return Range; + })(); + + v3.RequestBasedSli = (function() { + + /** + * Properties of a RequestBasedSli. + * @memberof google.monitoring.v3 + * @interface IRequestBasedSli + * @property {google.monitoring.v3.ITimeSeriesRatio|null} [goodTotalRatio] RequestBasedSli goodTotalRatio + * @property {google.monitoring.v3.IDistributionCut|null} [distributionCut] RequestBasedSli distributionCut + */ + + /** + * Constructs a new RequestBasedSli. + * @memberof google.monitoring.v3 + * @classdesc Represents a RequestBasedSli. + * @implements IRequestBasedSli + * @constructor + * @param {google.monitoring.v3.IRequestBasedSli=} [properties] Properties to set + */ + function RequestBasedSli(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]]; + } + + /** + * RequestBasedSli goodTotalRatio. + * @member {google.monitoring.v3.ITimeSeriesRatio|null|undefined} goodTotalRatio + * @memberof google.monitoring.v3.RequestBasedSli + * @instance + */ + RequestBasedSli.prototype.goodTotalRatio = null; + + /** + * RequestBasedSli distributionCut. + * @member {google.monitoring.v3.IDistributionCut|null|undefined} distributionCut + * @memberof google.monitoring.v3.RequestBasedSli + * @instance + */ + RequestBasedSli.prototype.distributionCut = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RequestBasedSli method. + * @member {"goodTotalRatio"|"distributionCut"|undefined} method + * @memberof google.monitoring.v3.RequestBasedSli + * @instance + */ + Object.defineProperty(RequestBasedSli.prototype, "method", { + get: $util.oneOfGetter($oneOfFields = ["goodTotalRatio", "distributionCut"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RequestBasedSli instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {google.monitoring.v3.IRequestBasedSli=} [properties] Properties to set + * @returns {google.monitoring.v3.RequestBasedSli} RequestBasedSli instance + */ + RequestBasedSli.create = function create(properties) { + return new RequestBasedSli(properties); + }; + + /** + * Encodes the specified RequestBasedSli message. Does not implicitly {@link google.monitoring.v3.RequestBasedSli.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {google.monitoring.v3.IRequestBasedSli} message RequestBasedSli message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestBasedSli.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.goodTotalRatio != null && Object.hasOwnProperty.call(message, "goodTotalRatio")) + $root.google.monitoring.v3.TimeSeriesRatio.encode(message.goodTotalRatio, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.distributionCut != null && Object.hasOwnProperty.call(message, "distributionCut")) + $root.google.monitoring.v3.DistributionCut.encode(message.distributionCut, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RequestBasedSli message, length delimited. Does not implicitly {@link google.monitoring.v3.RequestBasedSli.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {google.monitoring.v3.IRequestBasedSli} message RequestBasedSli message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RequestBasedSli.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RequestBasedSli message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.RequestBasedSli} RequestBasedSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestBasedSli.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.RequestBasedSli(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.goodTotalRatio = $root.google.monitoring.v3.TimeSeriesRatio.decode(reader, reader.uint32()); + break; + } + case 3: { + message.distributionCut = $root.google.monitoring.v3.DistributionCut.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RequestBasedSli message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.RequestBasedSli} RequestBasedSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RequestBasedSli.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RequestBasedSli message. + * @function verify + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RequestBasedSli.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.goodTotalRatio != null && message.hasOwnProperty("goodTotalRatio")) { + properties.method = 1; + { + var error = $root.google.monitoring.v3.TimeSeriesRatio.verify(message.goodTotalRatio); + if (error) + return "goodTotalRatio." + error; + } + } + if (message.distributionCut != null && message.hasOwnProperty("distributionCut")) { + if (properties.method === 1) + return "method: multiple values"; + properties.method = 1; + { + var error = $root.google.monitoring.v3.DistributionCut.verify(message.distributionCut); + if (error) + return "distributionCut." + error; + } + } + return null; + }; + + /** + * Creates a RequestBasedSli message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.RequestBasedSli} RequestBasedSli + */ + RequestBasedSli.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.RequestBasedSli) + return object; + var message = new $root.google.monitoring.v3.RequestBasedSli(); + if (object.goodTotalRatio != null) { + if (typeof object.goodTotalRatio !== "object") + throw TypeError(".google.monitoring.v3.RequestBasedSli.goodTotalRatio: object expected"); + message.goodTotalRatio = $root.google.monitoring.v3.TimeSeriesRatio.fromObject(object.goodTotalRatio); + } + if (object.distributionCut != null) { + if (typeof object.distributionCut !== "object") + throw TypeError(".google.monitoring.v3.RequestBasedSli.distributionCut: object expected"); + message.distributionCut = $root.google.monitoring.v3.DistributionCut.fromObject(object.distributionCut); + } + return message; + }; + + /** + * Creates a plain object from a RequestBasedSli message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {google.monitoring.v3.RequestBasedSli} message RequestBasedSli + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RequestBasedSli.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.goodTotalRatio != null && message.hasOwnProperty("goodTotalRatio")) { + object.goodTotalRatio = $root.google.monitoring.v3.TimeSeriesRatio.toObject(message.goodTotalRatio, options); + if (options.oneofs) + object.method = "goodTotalRatio"; + } + if (message.distributionCut != null && message.hasOwnProperty("distributionCut")) { + object.distributionCut = $root.google.monitoring.v3.DistributionCut.toObject(message.distributionCut, options); + if (options.oneofs) + object.method = "distributionCut"; + } + return object; + }; + + /** + * Converts this RequestBasedSli to JSON. + * @function toJSON + * @memberof google.monitoring.v3.RequestBasedSli + * @instance + * @returns {Object.} JSON object + */ + RequestBasedSli.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RequestBasedSli + * @function getTypeUrl + * @memberof google.monitoring.v3.RequestBasedSli + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RequestBasedSli.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.RequestBasedSli"; + }; + + return RequestBasedSli; + })(); + + v3.TimeSeriesRatio = (function() { + + /** + * Properties of a TimeSeriesRatio. + * @memberof google.monitoring.v3 + * @interface ITimeSeriesRatio + * @property {string|null} [goodServiceFilter] TimeSeriesRatio goodServiceFilter + * @property {string|null} [badServiceFilter] TimeSeriesRatio badServiceFilter + * @property {string|null} [totalServiceFilter] TimeSeriesRatio totalServiceFilter + */ + + /** + * Constructs a new TimeSeriesRatio. + * @memberof google.monitoring.v3 + * @classdesc Represents a TimeSeriesRatio. + * @implements ITimeSeriesRatio + * @constructor + * @param {google.monitoring.v3.ITimeSeriesRatio=} [properties] Properties to set + */ + function TimeSeriesRatio(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]]; + } + + /** + * TimeSeriesRatio goodServiceFilter. + * @member {string} goodServiceFilter + * @memberof google.monitoring.v3.TimeSeriesRatio + * @instance + */ + TimeSeriesRatio.prototype.goodServiceFilter = ""; + + /** + * TimeSeriesRatio badServiceFilter. + * @member {string} badServiceFilter + * @memberof google.monitoring.v3.TimeSeriesRatio + * @instance + */ + TimeSeriesRatio.prototype.badServiceFilter = ""; + + /** + * TimeSeriesRatio totalServiceFilter. + * @member {string} totalServiceFilter + * @memberof google.monitoring.v3.TimeSeriesRatio + * @instance + */ + TimeSeriesRatio.prototype.totalServiceFilter = ""; + + /** + * Creates a new TimeSeriesRatio instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {google.monitoring.v3.ITimeSeriesRatio=} [properties] Properties to set + * @returns {google.monitoring.v3.TimeSeriesRatio} TimeSeriesRatio instance + */ + TimeSeriesRatio.create = function create(properties) { + return new TimeSeriesRatio(properties); + }; + + /** + * Encodes the specified TimeSeriesRatio message. Does not implicitly {@link google.monitoring.v3.TimeSeriesRatio.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {google.monitoring.v3.ITimeSeriesRatio} message TimeSeriesRatio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeSeriesRatio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.goodServiceFilter != null && Object.hasOwnProperty.call(message, "goodServiceFilter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.goodServiceFilter); + if (message.badServiceFilter != null && Object.hasOwnProperty.call(message, "badServiceFilter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.badServiceFilter); + if (message.totalServiceFilter != null && Object.hasOwnProperty.call(message, "totalServiceFilter")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.totalServiceFilter); + return writer; + }; + + /** + * Encodes the specified TimeSeriesRatio message, length delimited. Does not implicitly {@link google.monitoring.v3.TimeSeriesRatio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {google.monitoring.v3.ITimeSeriesRatio} message TimeSeriesRatio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TimeSeriesRatio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TimeSeriesRatio message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.TimeSeriesRatio} TimeSeriesRatio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeSeriesRatio.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.TimeSeriesRatio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.goodServiceFilter = reader.string(); + break; + } + case 5: { + message.badServiceFilter = reader.string(); + break; + } + case 6: { + message.totalServiceFilter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TimeSeriesRatio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.TimeSeriesRatio} TimeSeriesRatio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TimeSeriesRatio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TimeSeriesRatio message. + * @function verify + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TimeSeriesRatio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.goodServiceFilter != null && message.hasOwnProperty("goodServiceFilter")) + if (!$util.isString(message.goodServiceFilter)) + return "goodServiceFilter: string expected"; + if (message.badServiceFilter != null && message.hasOwnProperty("badServiceFilter")) + if (!$util.isString(message.badServiceFilter)) + return "badServiceFilter: string expected"; + if (message.totalServiceFilter != null && message.hasOwnProperty("totalServiceFilter")) + if (!$util.isString(message.totalServiceFilter)) + return "totalServiceFilter: string expected"; + return null; + }; + + /** + * Creates a TimeSeriesRatio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.TimeSeriesRatio} TimeSeriesRatio + */ + TimeSeriesRatio.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.TimeSeriesRatio) + return object; + var message = new $root.google.monitoring.v3.TimeSeriesRatio(); + if (object.goodServiceFilter != null) + message.goodServiceFilter = String(object.goodServiceFilter); + if (object.badServiceFilter != null) + message.badServiceFilter = String(object.badServiceFilter); + if (object.totalServiceFilter != null) + message.totalServiceFilter = String(object.totalServiceFilter); + return message; + }; + + /** + * Creates a plain object from a TimeSeriesRatio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {google.monitoring.v3.TimeSeriesRatio} message TimeSeriesRatio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TimeSeriesRatio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.goodServiceFilter = ""; + object.badServiceFilter = ""; + object.totalServiceFilter = ""; + } + if (message.goodServiceFilter != null && message.hasOwnProperty("goodServiceFilter")) + object.goodServiceFilter = message.goodServiceFilter; + if (message.badServiceFilter != null && message.hasOwnProperty("badServiceFilter")) + object.badServiceFilter = message.badServiceFilter; + if (message.totalServiceFilter != null && message.hasOwnProperty("totalServiceFilter")) + object.totalServiceFilter = message.totalServiceFilter; + return object; + }; + + /** + * Converts this TimeSeriesRatio to JSON. + * @function toJSON + * @memberof google.monitoring.v3.TimeSeriesRatio + * @instance + * @returns {Object.} JSON object + */ + TimeSeriesRatio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TimeSeriesRatio + * @function getTypeUrl + * @memberof google.monitoring.v3.TimeSeriesRatio + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TimeSeriesRatio.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.TimeSeriesRatio"; + }; + + return TimeSeriesRatio; + })(); + + v3.DistributionCut = (function() { + + /** + * Properties of a DistributionCut. + * @memberof google.monitoring.v3 + * @interface IDistributionCut + * @property {string|null} [distributionFilter] DistributionCut distributionFilter + * @property {google.monitoring.v3.IRange|null} [range] DistributionCut range + */ + + /** + * Constructs a new DistributionCut. + * @memberof google.monitoring.v3 + * @classdesc Represents a DistributionCut. + * @implements IDistributionCut + * @constructor + * @param {google.monitoring.v3.IDistributionCut=} [properties] Properties to set + */ + function DistributionCut(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]]; + } + + /** + * DistributionCut distributionFilter. + * @member {string} distributionFilter + * @memberof google.monitoring.v3.DistributionCut + * @instance + */ + DistributionCut.prototype.distributionFilter = ""; + + /** + * DistributionCut range. + * @member {google.monitoring.v3.IRange|null|undefined} range + * @memberof google.monitoring.v3.DistributionCut + * @instance + */ + DistributionCut.prototype.range = null; + + /** + * Creates a new DistributionCut instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {google.monitoring.v3.IDistributionCut=} [properties] Properties to set + * @returns {google.monitoring.v3.DistributionCut} DistributionCut instance + */ + DistributionCut.create = function create(properties) { + return new DistributionCut(properties); + }; + + /** + * Encodes the specified DistributionCut message. Does not implicitly {@link google.monitoring.v3.DistributionCut.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {google.monitoring.v3.IDistributionCut} message DistributionCut message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DistributionCut.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.distributionFilter != null && Object.hasOwnProperty.call(message, "distributionFilter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.distributionFilter); + if (message.range != null && Object.hasOwnProperty.call(message, "range")) + $root.google.monitoring.v3.Range.encode(message.range, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DistributionCut message, length delimited. Does not implicitly {@link google.monitoring.v3.DistributionCut.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {google.monitoring.v3.IDistributionCut} message DistributionCut message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DistributionCut.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DistributionCut message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DistributionCut} DistributionCut + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DistributionCut.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DistributionCut(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.distributionFilter = reader.string(); + break; + } + case 5: { + message.range = $root.google.monitoring.v3.Range.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DistributionCut message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DistributionCut} DistributionCut + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DistributionCut.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DistributionCut message. + * @function verify + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DistributionCut.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.distributionFilter != null && message.hasOwnProperty("distributionFilter")) + if (!$util.isString(message.distributionFilter)) + return "distributionFilter: string expected"; + if (message.range != null && message.hasOwnProperty("range")) { + var error = $root.google.monitoring.v3.Range.verify(message.range); + if (error) + return "range." + error; + } + return null; + }; + + /** + * Creates a DistributionCut message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DistributionCut} DistributionCut + */ + DistributionCut.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DistributionCut) + return object; + var message = new $root.google.monitoring.v3.DistributionCut(); + if (object.distributionFilter != null) + message.distributionFilter = String(object.distributionFilter); + if (object.range != null) { + if (typeof object.range !== "object") + throw TypeError(".google.monitoring.v3.DistributionCut.range: object expected"); + message.range = $root.google.monitoring.v3.Range.fromObject(object.range); + } + return message; + }; + + /** + * Creates a plain object from a DistributionCut message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {google.monitoring.v3.DistributionCut} message DistributionCut + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DistributionCut.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.distributionFilter = ""; + object.range = null; + } + if (message.distributionFilter != null && message.hasOwnProperty("distributionFilter")) + object.distributionFilter = message.distributionFilter; + if (message.range != null && message.hasOwnProperty("range")) + object.range = $root.google.monitoring.v3.Range.toObject(message.range, options); + return object; + }; + + /** + * Converts this DistributionCut to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DistributionCut + * @instance + * @returns {Object.} JSON object + */ + DistributionCut.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DistributionCut + * @function getTypeUrl + * @memberof google.monitoring.v3.DistributionCut + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DistributionCut.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DistributionCut"; + }; + + return DistributionCut; + })(); + + v3.WindowsBasedSli = (function() { + + /** + * Properties of a WindowsBasedSli. + * @memberof google.monitoring.v3 + * @interface IWindowsBasedSli + * @property {string|null} [goodBadMetricFilter] WindowsBasedSli goodBadMetricFilter + * @property {google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold|null} [goodTotalRatioThreshold] WindowsBasedSli goodTotalRatioThreshold + * @property {google.monitoring.v3.WindowsBasedSli.IMetricRange|null} [metricMeanInRange] WindowsBasedSli metricMeanInRange + * @property {google.monitoring.v3.WindowsBasedSli.IMetricRange|null} [metricSumInRange] WindowsBasedSli metricSumInRange + * @property {google.protobuf.IDuration|null} [windowPeriod] WindowsBasedSli windowPeriod + */ + + /** + * Constructs a new WindowsBasedSli. + * @memberof google.monitoring.v3 + * @classdesc Represents a WindowsBasedSli. + * @implements IWindowsBasedSli + * @constructor + * @param {google.monitoring.v3.IWindowsBasedSli=} [properties] Properties to set + */ + function WindowsBasedSli(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]]; + } + + /** + * WindowsBasedSli goodBadMetricFilter. + * @member {string|null|undefined} goodBadMetricFilter + * @memberof google.monitoring.v3.WindowsBasedSli + * @instance + */ + WindowsBasedSli.prototype.goodBadMetricFilter = null; + + /** + * WindowsBasedSli goodTotalRatioThreshold. + * @member {google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold|null|undefined} goodTotalRatioThreshold + * @memberof google.monitoring.v3.WindowsBasedSli + * @instance + */ + WindowsBasedSli.prototype.goodTotalRatioThreshold = null; + + /** + * WindowsBasedSli metricMeanInRange. + * @member {google.monitoring.v3.WindowsBasedSli.IMetricRange|null|undefined} metricMeanInRange + * @memberof google.monitoring.v3.WindowsBasedSli + * @instance + */ + WindowsBasedSli.prototype.metricMeanInRange = null; + + /** + * WindowsBasedSli metricSumInRange. + * @member {google.monitoring.v3.WindowsBasedSli.IMetricRange|null|undefined} metricSumInRange + * @memberof google.monitoring.v3.WindowsBasedSli + * @instance + */ + WindowsBasedSli.prototype.metricSumInRange = null; + + /** + * WindowsBasedSli windowPeriod. + * @member {google.protobuf.IDuration|null|undefined} windowPeriod + * @memberof google.monitoring.v3.WindowsBasedSli + * @instance + */ + WindowsBasedSli.prototype.windowPeriod = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * WindowsBasedSli windowCriterion. + * @member {"goodBadMetricFilter"|"goodTotalRatioThreshold"|"metricMeanInRange"|"metricSumInRange"|undefined} windowCriterion + * @memberof google.monitoring.v3.WindowsBasedSli + * @instance + */ + Object.defineProperty(WindowsBasedSli.prototype, "windowCriterion", { + get: $util.oneOfGetter($oneOfFields = ["goodBadMetricFilter", "goodTotalRatioThreshold", "metricMeanInRange", "metricSumInRange"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new WindowsBasedSli instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {google.monitoring.v3.IWindowsBasedSli=} [properties] Properties to set + * @returns {google.monitoring.v3.WindowsBasedSli} WindowsBasedSli instance + */ + WindowsBasedSli.create = function create(properties) { + return new WindowsBasedSli(properties); + }; + + /** + * Encodes the specified WindowsBasedSli message. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {google.monitoring.v3.IWindowsBasedSli} message WindowsBasedSli message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WindowsBasedSli.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.goodTotalRatioThreshold != null && Object.hasOwnProperty.call(message, "goodTotalRatioThreshold")) + $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.encode(message.goodTotalRatioThreshold, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.windowPeriod != null && Object.hasOwnProperty.call(message, "windowPeriod")) + $root.google.protobuf.Duration.encode(message.windowPeriod, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.goodBadMetricFilter != null && Object.hasOwnProperty.call(message, "goodBadMetricFilter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.goodBadMetricFilter); + if (message.metricMeanInRange != null && Object.hasOwnProperty.call(message, "metricMeanInRange")) + $root.google.monitoring.v3.WindowsBasedSli.MetricRange.encode(message.metricMeanInRange, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.metricSumInRange != null && Object.hasOwnProperty.call(message, "metricSumInRange")) + $root.google.monitoring.v3.WindowsBasedSli.MetricRange.encode(message.metricSumInRange, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WindowsBasedSli message, length delimited. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {google.monitoring.v3.IWindowsBasedSli} message WindowsBasedSli message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WindowsBasedSli.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WindowsBasedSli message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.WindowsBasedSli} WindowsBasedSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WindowsBasedSli.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.WindowsBasedSli(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.goodBadMetricFilter = reader.string(); + break; + } + case 2: { + message.goodTotalRatioThreshold = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.decode(reader, reader.uint32()); + break; + } + case 6: { + message.metricMeanInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.decode(reader, reader.uint32()); + break; + } + case 7: { + message.metricSumInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.decode(reader, reader.uint32()); + break; + } + case 4: { + message.windowPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WindowsBasedSli message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.WindowsBasedSli} WindowsBasedSli + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WindowsBasedSli.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WindowsBasedSli message. + * @function verify + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WindowsBasedSli.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.goodBadMetricFilter != null && message.hasOwnProperty("goodBadMetricFilter")) { + properties.windowCriterion = 1; + if (!$util.isString(message.goodBadMetricFilter)) + return "goodBadMetricFilter: string expected"; + } + if (message.goodTotalRatioThreshold != null && message.hasOwnProperty("goodTotalRatioThreshold")) { + if (properties.windowCriterion === 1) + return "windowCriterion: multiple values"; + properties.windowCriterion = 1; + { + var error = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.verify(message.goodTotalRatioThreshold); + if (error) + return "goodTotalRatioThreshold." + error; + } + } + if (message.metricMeanInRange != null && message.hasOwnProperty("metricMeanInRange")) { + if (properties.windowCriterion === 1) + return "windowCriterion: multiple values"; + properties.windowCriterion = 1; + { + var error = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.verify(message.metricMeanInRange); + if (error) + return "metricMeanInRange." + error; + } + } + if (message.metricSumInRange != null && message.hasOwnProperty("metricSumInRange")) { + if (properties.windowCriterion === 1) + return "windowCriterion: multiple values"; + properties.windowCriterion = 1; + { + var error = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.verify(message.metricSumInRange); + if (error) + return "metricSumInRange." + error; + } + } + if (message.windowPeriod != null && message.hasOwnProperty("windowPeriod")) { + var error = $root.google.protobuf.Duration.verify(message.windowPeriod); + if (error) + return "windowPeriod." + error; + } + return null; + }; + + /** + * Creates a WindowsBasedSli message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.WindowsBasedSli} WindowsBasedSli + */ + WindowsBasedSli.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.WindowsBasedSli) + return object; + var message = new $root.google.monitoring.v3.WindowsBasedSli(); + if (object.goodBadMetricFilter != null) + message.goodBadMetricFilter = String(object.goodBadMetricFilter); + if (object.goodTotalRatioThreshold != null) { + if (typeof object.goodTotalRatioThreshold !== "object") + throw TypeError(".google.monitoring.v3.WindowsBasedSli.goodTotalRatioThreshold: object expected"); + message.goodTotalRatioThreshold = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.fromObject(object.goodTotalRatioThreshold); + } + if (object.metricMeanInRange != null) { + if (typeof object.metricMeanInRange !== "object") + throw TypeError(".google.monitoring.v3.WindowsBasedSli.metricMeanInRange: object expected"); + message.metricMeanInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.fromObject(object.metricMeanInRange); + } + if (object.metricSumInRange != null) { + if (typeof object.metricSumInRange !== "object") + throw TypeError(".google.monitoring.v3.WindowsBasedSli.metricSumInRange: object expected"); + message.metricSumInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.fromObject(object.metricSumInRange); + } + if (object.windowPeriod != null) { + if (typeof object.windowPeriod !== "object") + throw TypeError(".google.monitoring.v3.WindowsBasedSli.windowPeriod: object expected"); + message.windowPeriod = $root.google.protobuf.Duration.fromObject(object.windowPeriod); + } + return message; + }; + + /** + * Creates a plain object from a WindowsBasedSli message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {google.monitoring.v3.WindowsBasedSli} message WindowsBasedSli + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WindowsBasedSli.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.windowPeriod = null; + if (message.goodTotalRatioThreshold != null && message.hasOwnProperty("goodTotalRatioThreshold")) { + object.goodTotalRatioThreshold = $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.toObject(message.goodTotalRatioThreshold, options); + if (options.oneofs) + object.windowCriterion = "goodTotalRatioThreshold"; + } + if (message.windowPeriod != null && message.hasOwnProperty("windowPeriod")) + object.windowPeriod = $root.google.protobuf.Duration.toObject(message.windowPeriod, options); + if (message.goodBadMetricFilter != null && message.hasOwnProperty("goodBadMetricFilter")) { + object.goodBadMetricFilter = message.goodBadMetricFilter; + if (options.oneofs) + object.windowCriterion = "goodBadMetricFilter"; + } + if (message.metricMeanInRange != null && message.hasOwnProperty("metricMeanInRange")) { + object.metricMeanInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.toObject(message.metricMeanInRange, options); + if (options.oneofs) + object.windowCriterion = "metricMeanInRange"; + } + if (message.metricSumInRange != null && message.hasOwnProperty("metricSumInRange")) { + object.metricSumInRange = $root.google.monitoring.v3.WindowsBasedSli.MetricRange.toObject(message.metricSumInRange, options); + if (options.oneofs) + object.windowCriterion = "metricSumInRange"; + } + return object; + }; + + /** + * Converts this WindowsBasedSli to JSON. + * @function toJSON + * @memberof google.monitoring.v3.WindowsBasedSli + * @instance + * @returns {Object.} JSON object + */ + WindowsBasedSli.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WindowsBasedSli + * @function getTypeUrl + * @memberof google.monitoring.v3.WindowsBasedSli + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WindowsBasedSli.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.WindowsBasedSli"; + }; + + WindowsBasedSli.PerformanceThreshold = (function() { + + /** + * Properties of a PerformanceThreshold. + * @memberof google.monitoring.v3.WindowsBasedSli + * @interface IPerformanceThreshold + * @property {google.monitoring.v3.IRequestBasedSli|null} [performance] PerformanceThreshold performance + * @property {google.monitoring.v3.IBasicSli|null} [basicSliPerformance] PerformanceThreshold basicSliPerformance + * @property {number|null} [threshold] PerformanceThreshold threshold + */ + + /** + * Constructs a new PerformanceThreshold. + * @memberof google.monitoring.v3.WindowsBasedSli + * @classdesc Represents a PerformanceThreshold. + * @implements IPerformanceThreshold + * @constructor + * @param {google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold=} [properties] Properties to set + */ + function PerformanceThreshold(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]]; + } + + /** + * PerformanceThreshold performance. + * @member {google.monitoring.v3.IRequestBasedSli|null|undefined} performance + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @instance + */ + PerformanceThreshold.prototype.performance = null; + + /** + * PerformanceThreshold basicSliPerformance. + * @member {google.monitoring.v3.IBasicSli|null|undefined} basicSliPerformance + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @instance + */ + PerformanceThreshold.prototype.basicSliPerformance = null; + + /** + * PerformanceThreshold threshold. + * @member {number} threshold + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @instance + */ + PerformanceThreshold.prototype.threshold = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * PerformanceThreshold type. + * @member {"performance"|"basicSliPerformance"|undefined} type + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @instance + */ + Object.defineProperty(PerformanceThreshold.prototype, "type", { + get: $util.oneOfGetter($oneOfFields = ["performance", "basicSliPerformance"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PerformanceThreshold instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold=} [properties] Properties to set + * @returns {google.monitoring.v3.WindowsBasedSli.PerformanceThreshold} PerformanceThreshold instance + */ + PerformanceThreshold.create = function create(properties) { + return new PerformanceThreshold(properties); + }; + + /** + * Encodes the specified PerformanceThreshold message. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold} message PerformanceThreshold message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformanceThreshold.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.performance != null && Object.hasOwnProperty.call(message, "performance")) + $root.google.monitoring.v3.RequestBasedSli.encode(message.performance, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.threshold != null && Object.hasOwnProperty.call(message, "threshold")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.threshold); + if (message.basicSliPerformance != null && Object.hasOwnProperty.call(message, "basicSliPerformance")) + $root.google.monitoring.v3.BasicSli.encode(message.basicSliPerformance, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PerformanceThreshold message, length delimited. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {google.monitoring.v3.WindowsBasedSli.IPerformanceThreshold} message PerformanceThreshold message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformanceThreshold.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PerformanceThreshold message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.WindowsBasedSli.PerformanceThreshold} PerformanceThreshold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformanceThreshold.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.performance = $root.google.monitoring.v3.RequestBasedSli.decode(reader, reader.uint32()); + break; + } + case 3: { + message.basicSliPerformance = $root.google.monitoring.v3.BasicSli.decode(reader, reader.uint32()); + break; + } + case 2: { + message.threshold = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PerformanceThreshold message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.WindowsBasedSli.PerformanceThreshold} PerformanceThreshold + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformanceThreshold.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PerformanceThreshold message. + * @function verify + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PerformanceThreshold.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.performance != null && message.hasOwnProperty("performance")) { + properties.type = 1; + { + var error = $root.google.monitoring.v3.RequestBasedSli.verify(message.performance); + if (error) + return "performance." + error; + } + } + if (message.basicSliPerformance != null && message.hasOwnProperty("basicSliPerformance")) { + if (properties.type === 1) + return "type: multiple values"; + properties.type = 1; + { + var error = $root.google.monitoring.v3.BasicSli.verify(message.basicSliPerformance); + if (error) + return "basicSliPerformance." + error; + } + } + if (message.threshold != null && message.hasOwnProperty("threshold")) + if (typeof message.threshold !== "number") + return "threshold: number expected"; + return null; + }; + + /** + * Creates a PerformanceThreshold message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.WindowsBasedSli.PerformanceThreshold} PerformanceThreshold + */ + PerformanceThreshold.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold) + return object; + var message = new $root.google.monitoring.v3.WindowsBasedSli.PerformanceThreshold(); + if (object.performance != null) { + if (typeof object.performance !== "object") + throw TypeError(".google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.performance: object expected"); + message.performance = $root.google.monitoring.v3.RequestBasedSli.fromObject(object.performance); + } + if (object.basicSliPerformance != null) { + if (typeof object.basicSliPerformance !== "object") + throw TypeError(".google.monitoring.v3.WindowsBasedSli.PerformanceThreshold.basicSliPerformance: object expected"); + message.basicSliPerformance = $root.google.monitoring.v3.BasicSli.fromObject(object.basicSliPerformance); + } + if (object.threshold != null) + message.threshold = Number(object.threshold); + return message; + }; + + /** + * Creates a plain object from a PerformanceThreshold message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {google.monitoring.v3.WindowsBasedSli.PerformanceThreshold} message PerformanceThreshold + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PerformanceThreshold.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.threshold = 0; + if (message.performance != null && message.hasOwnProperty("performance")) { + object.performance = $root.google.monitoring.v3.RequestBasedSli.toObject(message.performance, options); + if (options.oneofs) + object.type = "performance"; + } + if (message.threshold != null && message.hasOwnProperty("threshold")) + object.threshold = options.json && !isFinite(message.threshold) ? String(message.threshold) : message.threshold; + if (message.basicSliPerformance != null && message.hasOwnProperty("basicSliPerformance")) { + object.basicSliPerformance = $root.google.monitoring.v3.BasicSli.toObject(message.basicSliPerformance, options); + if (options.oneofs) + object.type = "basicSliPerformance"; + } + return object; + }; + + /** + * Converts this PerformanceThreshold to JSON. + * @function toJSON + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @instance + * @returns {Object.} JSON object + */ + PerformanceThreshold.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PerformanceThreshold + * @function getTypeUrl + * @memberof google.monitoring.v3.WindowsBasedSli.PerformanceThreshold + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PerformanceThreshold.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.WindowsBasedSli.PerformanceThreshold"; + }; + + return PerformanceThreshold; + })(); + + WindowsBasedSli.MetricRange = (function() { + + /** + * Properties of a MetricRange. + * @memberof google.monitoring.v3.WindowsBasedSli + * @interface IMetricRange + * @property {string|null} [timeSeries] MetricRange timeSeries + * @property {google.monitoring.v3.IRange|null} [range] MetricRange range + */ + + /** + * Constructs a new MetricRange. + * @memberof google.monitoring.v3.WindowsBasedSli + * @classdesc Represents a MetricRange. + * @implements IMetricRange + * @constructor + * @param {google.monitoring.v3.WindowsBasedSli.IMetricRange=} [properties] Properties to set + */ + function MetricRange(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]]; + } + + /** + * MetricRange timeSeries. + * @member {string} timeSeries + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @instance + */ + MetricRange.prototype.timeSeries = ""; + + /** + * MetricRange range. + * @member {google.monitoring.v3.IRange|null|undefined} range + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @instance + */ + MetricRange.prototype.range = null; + + /** + * Creates a new MetricRange instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {google.monitoring.v3.WindowsBasedSli.IMetricRange=} [properties] Properties to set + * @returns {google.monitoring.v3.WindowsBasedSli.MetricRange} MetricRange instance + */ + MetricRange.create = function create(properties) { + return new MetricRange(properties); + }; + + /** + * Encodes the specified MetricRange message. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.MetricRange.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {google.monitoring.v3.WindowsBasedSli.IMetricRange} message MetricRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timeSeries != null && Object.hasOwnProperty.call(message, "timeSeries")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.timeSeries); + if (message.range != null && Object.hasOwnProperty.call(message, "range")) + $root.google.monitoring.v3.Range.encode(message.range, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MetricRange message, length delimited. Does not implicitly {@link google.monitoring.v3.WindowsBasedSli.MetricRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {google.monitoring.v3.WindowsBasedSli.IMetricRange} message MetricRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MetricRange message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.WindowsBasedSli.MetricRange} MetricRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.WindowsBasedSli.MetricRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.timeSeries = reader.string(); + break; + } + case 4: { + message.range = $root.google.monitoring.v3.Range.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MetricRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.WindowsBasedSli.MetricRange} MetricRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MetricRange message. + * @function verify + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MetricRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timeSeries != null && message.hasOwnProperty("timeSeries")) + if (!$util.isString(message.timeSeries)) + return "timeSeries: string expected"; + if (message.range != null && message.hasOwnProperty("range")) { + var error = $root.google.monitoring.v3.Range.verify(message.range); + if (error) + return "range." + error; + } + return null; + }; + + /** + * Creates a MetricRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.WindowsBasedSli.MetricRange} MetricRange + */ + MetricRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.WindowsBasedSli.MetricRange) + return object; + var message = new $root.google.monitoring.v3.WindowsBasedSli.MetricRange(); + if (object.timeSeries != null) + message.timeSeries = String(object.timeSeries); + if (object.range != null) { + if (typeof object.range !== "object") + throw TypeError(".google.monitoring.v3.WindowsBasedSli.MetricRange.range: object expected"); + message.range = $root.google.monitoring.v3.Range.fromObject(object.range); + } + return message; + }; + + /** + * Creates a plain object from a MetricRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {google.monitoring.v3.WindowsBasedSli.MetricRange} message MetricRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MetricRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.timeSeries = ""; + object.range = null; + } + if (message.timeSeries != null && message.hasOwnProperty("timeSeries")) + object.timeSeries = message.timeSeries; + if (message.range != null && message.hasOwnProperty("range")) + object.range = $root.google.monitoring.v3.Range.toObject(message.range, options); + return object; + }; + + /** + * Converts this MetricRange to JSON. + * @function toJSON + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @instance + * @returns {Object.} JSON object + */ + MetricRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MetricRange + * @function getTypeUrl + * @memberof google.monitoring.v3.WindowsBasedSli.MetricRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MetricRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.WindowsBasedSli.MetricRange"; + }; + + return MetricRange; + })(); + + return WindowsBasedSli; + })(); + + v3.ServiceMonitoringService = (function() { + + /** + * Constructs a new ServiceMonitoringService service. + * @memberof google.monitoring.v3 + * @classdesc Represents a ServiceMonitoringService + * @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 ServiceMonitoringService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ServiceMonitoringService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ServiceMonitoringService; + + /** + * Creates new ServiceMonitoringService service using the specified rpc implementation. + * @function create + * @memberof google.monitoring.v3.ServiceMonitoringService + * @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 {ServiceMonitoringService} RPC service. Useful where requests and/or responses are streamed. + */ + ServiceMonitoringService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|createService}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef CreateServiceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.Service} [response] Service + */ + + /** + * Calls CreateService. + * @function createService + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.ICreateServiceRequest} request CreateServiceRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.CreateServiceCallback} callback Node-style callback called with the error, if any, and Service + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.createService = function createService(request, callback) { + return this.rpcCall(createService, $root.google.monitoring.v3.CreateServiceRequest, $root.google.monitoring.v3.Service, request, callback); + }, "name", { value: "CreateService" }); + + /** + * Calls CreateService. + * @function createService + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.ICreateServiceRequest} request CreateServiceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|getService}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef GetServiceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.Service} [response] Service + */ + + /** + * Calls GetService. + * @function getService + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IGetServiceRequest} request GetServiceRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.GetServiceCallback} callback Node-style callback called with the error, if any, and Service + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.getService = function getService(request, callback) { + return this.rpcCall(getService, $root.google.monitoring.v3.GetServiceRequest, $root.google.monitoring.v3.Service, request, callback); + }, "name", { value: "GetService" }); + + /** + * Calls GetService. + * @function getService + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IGetServiceRequest} request GetServiceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|listServices}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef ListServicesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListServicesResponse} [response] ListServicesResponse + */ + + /** + * Calls ListServices. + * @function listServices + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IListServicesRequest} request ListServicesRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.ListServicesCallback} callback Node-style callback called with the error, if any, and ListServicesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.listServices = function listServices(request, callback) { + return this.rpcCall(listServices, $root.google.monitoring.v3.ListServicesRequest, $root.google.monitoring.v3.ListServicesResponse, request, callback); + }, "name", { value: "ListServices" }); + + /** + * Calls ListServices. + * @function listServices + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IListServicesRequest} request ListServicesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|updateService}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef UpdateServiceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.Service} [response] Service + */ + + /** + * Calls UpdateService. + * @function updateService + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IUpdateServiceRequest} request UpdateServiceRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.UpdateServiceCallback} callback Node-style callback called with the error, if any, and Service + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.updateService = function updateService(request, callback) { + return this.rpcCall(updateService, $root.google.monitoring.v3.UpdateServiceRequest, $root.google.monitoring.v3.Service, request, callback); + }, "name", { value: "UpdateService" }); + + /** + * Calls UpdateService. + * @function updateService + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IUpdateServiceRequest} request UpdateServiceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|deleteService}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef DeleteServiceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteService. + * @function deleteService + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IDeleteServiceRequest} request DeleteServiceRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.DeleteServiceCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.deleteService = function deleteService(request, callback) { + return this.rpcCall(deleteService, $root.google.monitoring.v3.DeleteServiceRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteService" }); + + /** + * Calls DeleteService. + * @function deleteService + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IDeleteServiceRequest} request DeleteServiceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|createServiceLevelObjective}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef CreateServiceLevelObjectiveCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ServiceLevelObjective} [response] ServiceLevelObjective + */ + + /** + * Calls CreateServiceLevelObjective. + * @function createServiceLevelObjective + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.ICreateServiceLevelObjectiveRequest} request CreateServiceLevelObjectiveRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.CreateServiceLevelObjectiveCallback} callback Node-style callback called with the error, if any, and ServiceLevelObjective + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.createServiceLevelObjective = function createServiceLevelObjective(request, callback) { + return this.rpcCall(createServiceLevelObjective, $root.google.monitoring.v3.CreateServiceLevelObjectiveRequest, $root.google.monitoring.v3.ServiceLevelObjective, request, callback); + }, "name", { value: "CreateServiceLevelObjective" }); + + /** + * Calls CreateServiceLevelObjective. + * @function createServiceLevelObjective + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.ICreateServiceLevelObjectiveRequest} request CreateServiceLevelObjectiveRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|getServiceLevelObjective}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef GetServiceLevelObjectiveCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ServiceLevelObjective} [response] ServiceLevelObjective + */ + + /** + * Calls GetServiceLevelObjective. + * @function getServiceLevelObjective + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IGetServiceLevelObjectiveRequest} request GetServiceLevelObjectiveRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.GetServiceLevelObjectiveCallback} callback Node-style callback called with the error, if any, and ServiceLevelObjective + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.getServiceLevelObjective = function getServiceLevelObjective(request, callback) { + return this.rpcCall(getServiceLevelObjective, $root.google.monitoring.v3.GetServiceLevelObjectiveRequest, $root.google.monitoring.v3.ServiceLevelObjective, request, callback); + }, "name", { value: "GetServiceLevelObjective" }); + + /** + * Calls GetServiceLevelObjective. + * @function getServiceLevelObjective + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IGetServiceLevelObjectiveRequest} request GetServiceLevelObjectiveRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|listServiceLevelObjectives}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef ListServiceLevelObjectivesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListServiceLevelObjectivesResponse} [response] ListServiceLevelObjectivesResponse + */ + + /** + * Calls ListServiceLevelObjectives. + * @function listServiceLevelObjectives + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IListServiceLevelObjectivesRequest} request ListServiceLevelObjectivesRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.ListServiceLevelObjectivesCallback} callback Node-style callback called with the error, if any, and ListServiceLevelObjectivesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.listServiceLevelObjectives = function listServiceLevelObjectives(request, callback) { + return this.rpcCall(listServiceLevelObjectives, $root.google.monitoring.v3.ListServiceLevelObjectivesRequest, $root.google.monitoring.v3.ListServiceLevelObjectivesResponse, request, callback); + }, "name", { value: "ListServiceLevelObjectives" }); + + /** + * Calls ListServiceLevelObjectives. + * @function listServiceLevelObjectives + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IListServiceLevelObjectivesRequest} request ListServiceLevelObjectivesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|updateServiceLevelObjective}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef UpdateServiceLevelObjectiveCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ServiceLevelObjective} [response] ServiceLevelObjective + */ + + /** + * Calls UpdateServiceLevelObjective. + * @function updateServiceLevelObjective + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IUpdateServiceLevelObjectiveRequest} request UpdateServiceLevelObjectiveRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.UpdateServiceLevelObjectiveCallback} callback Node-style callback called with the error, if any, and ServiceLevelObjective + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.updateServiceLevelObjective = function updateServiceLevelObjective(request, callback) { + return this.rpcCall(updateServiceLevelObjective, $root.google.monitoring.v3.UpdateServiceLevelObjectiveRequest, $root.google.monitoring.v3.ServiceLevelObjective, request, callback); + }, "name", { value: "UpdateServiceLevelObjective" }); + + /** + * Calls UpdateServiceLevelObjective. + * @function updateServiceLevelObjective + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IUpdateServiceLevelObjectiveRequest} request UpdateServiceLevelObjectiveRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.ServiceMonitoringService|deleteServiceLevelObjective}. + * @memberof google.monitoring.v3.ServiceMonitoringService + * @typedef DeleteServiceLevelObjectiveCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteServiceLevelObjective. + * @function deleteServiceLevelObjective + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IDeleteServiceLevelObjectiveRequest} request DeleteServiceLevelObjectiveRequest message or plain object + * @param {google.monitoring.v3.ServiceMonitoringService.DeleteServiceLevelObjectiveCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ServiceMonitoringService.prototype.deleteServiceLevelObjective = function deleteServiceLevelObjective(request, callback) { + return this.rpcCall(deleteServiceLevelObjective, $root.google.monitoring.v3.DeleteServiceLevelObjectiveRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteServiceLevelObjective" }); + + /** + * Calls DeleteServiceLevelObjective. + * @function deleteServiceLevelObjective + * @memberof google.monitoring.v3.ServiceMonitoringService + * @instance + * @param {google.monitoring.v3.IDeleteServiceLevelObjectiveRequest} request DeleteServiceLevelObjectiveRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ServiceMonitoringService; + })(); + + v3.CreateServiceRequest = (function() { + + /** + * Properties of a CreateServiceRequest. + * @memberof google.monitoring.v3 + * @interface ICreateServiceRequest + * @property {string|null} [parent] CreateServiceRequest parent + * @property {string|null} [serviceId] CreateServiceRequest serviceId + * @property {google.monitoring.v3.IService|null} [service] CreateServiceRequest service + */ + + /** + * Constructs a new CreateServiceRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateServiceRequest. + * @implements ICreateServiceRequest + * @constructor + * @param {google.monitoring.v3.ICreateServiceRequest=} [properties] Properties to set + */ + function CreateServiceRequest(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]]; + } + + /** + * CreateServiceRequest parent. + * @member {string} parent + * @memberof google.monitoring.v3.CreateServiceRequest + * @instance + */ + CreateServiceRequest.prototype.parent = ""; + + /** + * CreateServiceRequest serviceId. + * @member {string} serviceId + * @memberof google.monitoring.v3.CreateServiceRequest + * @instance + */ + CreateServiceRequest.prototype.serviceId = ""; + + /** + * CreateServiceRequest service. + * @member {google.monitoring.v3.IService|null|undefined} service + * @memberof google.monitoring.v3.CreateServiceRequest + * @instance + */ + CreateServiceRequest.prototype.service = null; + + /** + * Creates a new CreateServiceRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {google.monitoring.v3.ICreateServiceRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateServiceRequest} CreateServiceRequest instance + */ + CreateServiceRequest.create = function create(properties) { + return new CreateServiceRequest(properties); + }; + + /** + * Encodes the specified CreateServiceRequest message. Does not implicitly {@link google.monitoring.v3.CreateServiceRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {google.monitoring.v3.ICreateServiceRequest} message CreateServiceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServiceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + $root.google.monitoring.v3.Service.encode(message.service, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.serviceId != null && Object.hasOwnProperty.call(message, "serviceId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.serviceId); + return writer; + }; + + /** + * Encodes the specified CreateServiceRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateServiceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {google.monitoring.v3.ICreateServiceRequest} message CreateServiceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServiceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateServiceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateServiceRequest} CreateServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateServiceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateServiceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 3: { + message.serviceId = reader.string(); + break; + } + case 2: { + message.service = $root.google.monitoring.v3.Service.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateServiceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateServiceRequest} CreateServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateServiceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateServiceRequest message. + * @function verify + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateServiceRequest.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.serviceId != null && message.hasOwnProperty("serviceId")) + if (!$util.isString(message.serviceId)) + return "serviceId: string expected"; + if (message.service != null && message.hasOwnProperty("service")) { + var error = $root.google.monitoring.v3.Service.verify(message.service); + if (error) + return "service." + error; + } + return null; + }; + + /** + * Creates a CreateServiceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateServiceRequest} CreateServiceRequest + */ + CreateServiceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateServiceRequest) + return object; + var message = new $root.google.monitoring.v3.CreateServiceRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.serviceId != null) + message.serviceId = String(object.serviceId); + if (object.service != null) { + if (typeof object.service !== "object") + throw TypeError(".google.monitoring.v3.CreateServiceRequest.service: object expected"); + message.service = $root.google.monitoring.v3.Service.fromObject(object.service); + } + return message; + }; + + /** + * Creates a plain object from a CreateServiceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {google.monitoring.v3.CreateServiceRequest} message CreateServiceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateServiceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.service = null; + object.serviceId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.service != null && message.hasOwnProperty("service")) + object.service = $root.google.monitoring.v3.Service.toObject(message.service, options); + if (message.serviceId != null && message.hasOwnProperty("serviceId")) + object.serviceId = message.serviceId; + return object; + }; + + /** + * Converts this CreateServiceRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateServiceRequest + * @instance + * @returns {Object.} JSON object + */ + CreateServiceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateServiceRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateServiceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateServiceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateServiceRequest"; + }; + + return CreateServiceRequest; + })(); + + v3.GetServiceRequest = (function() { + + /** + * Properties of a GetServiceRequest. + * @memberof google.monitoring.v3 + * @interface IGetServiceRequest + * @property {string|null} [name] GetServiceRequest name + */ + + /** + * Constructs a new GetServiceRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetServiceRequest. + * @implements IGetServiceRequest + * @constructor + * @param {google.monitoring.v3.IGetServiceRequest=} [properties] Properties to set + */ + function GetServiceRequest(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]]; + } + + /** + * GetServiceRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetServiceRequest + * @instance + */ + GetServiceRequest.prototype.name = ""; + + /** + * Creates a new GetServiceRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {google.monitoring.v3.IGetServiceRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetServiceRequest} GetServiceRequest instance + */ + GetServiceRequest.create = function create(properties) { + return new GetServiceRequest(properties); + }; + + /** + * Encodes the specified GetServiceRequest message. Does not implicitly {@link google.monitoring.v3.GetServiceRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {google.monitoring.v3.IGetServiceRequest} message GetServiceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetServiceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetServiceRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetServiceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {google.monitoring.v3.IGetServiceRequest} message GetServiceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetServiceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetServiceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetServiceRequest} GetServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetServiceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetServiceRequest(); + 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 GetServiceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetServiceRequest} GetServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetServiceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetServiceRequest message. + * @function verify + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetServiceRequest.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 GetServiceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetServiceRequest} GetServiceRequest + */ + GetServiceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetServiceRequest) + return object; + var message = new $root.google.monitoring.v3.GetServiceRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetServiceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {google.monitoring.v3.GetServiceRequest} message GetServiceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetServiceRequest.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 GetServiceRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetServiceRequest + * @instance + * @returns {Object.} JSON object + */ + GetServiceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetServiceRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetServiceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetServiceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetServiceRequest"; + }; + + return GetServiceRequest; + })(); + + v3.ListServicesRequest = (function() { + + /** + * Properties of a ListServicesRequest. + * @memberof google.monitoring.v3 + * @interface IListServicesRequest + * @property {string|null} [parent] ListServicesRequest parent + * @property {string|null} [filter] ListServicesRequest filter + * @property {number|null} [pageSize] ListServicesRequest pageSize + * @property {string|null} [pageToken] ListServicesRequest pageToken + */ + + /** + * Constructs a new ListServicesRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListServicesRequest. + * @implements IListServicesRequest + * @constructor + * @param {google.monitoring.v3.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 parent. + * @member {string} parent + * @memberof google.monitoring.v3.ListServicesRequest + * @instance + */ + ListServicesRequest.prototype.parent = ""; + + /** + * ListServicesRequest filter. + * @member {string} filter + * @memberof google.monitoring.v3.ListServicesRequest + * @instance + */ + ListServicesRequest.prototype.filter = ""; + + /** + * ListServicesRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListServicesRequest + * @instance + */ + ListServicesRequest.prototype.pageSize = 0; + + /** + * ListServicesRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListServicesRequest + * @instance + */ + ListServicesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListServicesRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListServicesRequest + * @static + * @param {google.monitoring.v3.IListServicesRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListServicesRequest} ListServicesRequest instance + */ + ListServicesRequest.create = function create(properties) { + return new ListServicesRequest(properties); + }; + + /** + * Encodes the specified ListServicesRequest message. Does not implicitly {@link google.monitoring.v3.ListServicesRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListServicesRequest + * @static + * @param {google.monitoring.v3.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.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListServicesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListServicesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListServicesRequest + * @static + * @param {google.monitoring.v3.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.monitoring.v3.ListServicesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.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.monitoring.v3.ListServicesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + 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.monitoring.v3.ListServicesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.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.monitoring.v3.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.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + 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.monitoring.v3.ListServicesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListServicesRequest} ListServicesRequest + */ + ListServicesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListServicesRequest) + return object; + var message = new $root.google.monitoring.v3.ListServicesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListServicesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListServicesRequest + * @static + * @param {google.monitoring.v3.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.parent = ""; + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListServicesRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListServicesRequest + * @instance + * @returns {Object.} JSON object + */ + ListServicesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListServicesRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.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.monitoring.v3.ListServicesRequest"; + }; + + return ListServicesRequest; + })(); + + v3.ListServicesResponse = (function() { + + /** + * Properties of a ListServicesResponse. + * @memberof google.monitoring.v3 + * @interface IListServicesResponse + * @property {Array.|null} [services] ListServicesResponse services + * @property {string|null} [nextPageToken] ListServicesResponse nextPageToken + */ + + /** + * Constructs a new ListServicesResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListServicesResponse. + * @implements IListServicesResponse + * @constructor + * @param {google.monitoring.v3.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.monitoring.v3.ListServicesResponse + * @instance + */ + ListServicesResponse.prototype.services = $util.emptyArray; + + /** + * ListServicesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListServicesResponse + * @instance + */ + ListServicesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListServicesResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListServicesResponse + * @static + * @param {google.monitoring.v3.IListServicesResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListServicesResponse} ListServicesResponse instance + */ + ListServicesResponse.create = function create(properties) { + return new ListServicesResponse(properties); + }; + + /** + * Encodes the specified ListServicesResponse message. Does not implicitly {@link google.monitoring.v3.ListServicesResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListServicesResponse + * @static + * @param {google.monitoring.v3.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.monitoring.v3.Service.encode(message.services[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListServicesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListServicesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListServicesResponse + * @static + * @param {google.monitoring.v3.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.monitoring.v3.ListServicesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.ListServicesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.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.monitoring.v3.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.monitoring.v3.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.monitoring.v3.ListServicesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListServicesResponse} ListServicesResponse + */ + ListServicesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListServicesResponse) + return object; + var message = new $root.google.monitoring.v3.ListServicesResponse(); + if (object.services) { + if (!Array.isArray(object.services)) + throw TypeError(".google.monitoring.v3.ListServicesResponse.services: array expected"); + message.services = []; + for (var i = 0; i < object.services.length; ++i) { + if (typeof object.services[i] !== "object") + throw TypeError(".google.monitoring.v3.ListServicesResponse.services: object expected"); + message.services[i] = $root.google.monitoring.v3.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.monitoring.v3.ListServicesResponse + * @static + * @param {google.monitoring.v3.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.monitoring.v3.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.monitoring.v3.ListServicesResponse + * @instance + * @returns {Object.} JSON object + */ + ListServicesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListServicesResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.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.monitoring.v3.ListServicesResponse"; + }; + + return ListServicesResponse; + })(); + + v3.UpdateServiceRequest = (function() { + + /** + * Properties of an UpdateServiceRequest. + * @memberof google.monitoring.v3 + * @interface IUpdateServiceRequest + * @property {google.monitoring.v3.IService|null} [service] UpdateServiceRequest service + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateServiceRequest updateMask + */ + + /** + * Constructs a new UpdateServiceRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents an UpdateServiceRequest. + * @implements IUpdateServiceRequest + * @constructor + * @param {google.monitoring.v3.IUpdateServiceRequest=} [properties] Properties to set + */ + function UpdateServiceRequest(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]]; + } + + /** + * UpdateServiceRequest service. + * @member {google.monitoring.v3.IService|null|undefined} service + * @memberof google.monitoring.v3.UpdateServiceRequest + * @instance + */ + UpdateServiceRequest.prototype.service = null; + + /** + * UpdateServiceRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.monitoring.v3.UpdateServiceRequest + * @instance + */ + UpdateServiceRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateServiceRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {google.monitoring.v3.IUpdateServiceRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.UpdateServiceRequest} UpdateServiceRequest instance + */ + UpdateServiceRequest.create = function create(properties) { + return new UpdateServiceRequest(properties); + }; + + /** + * Encodes the specified UpdateServiceRequest message. Does not implicitly {@link google.monitoring.v3.UpdateServiceRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {google.monitoring.v3.IUpdateServiceRequest} message UpdateServiceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServiceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.service != null && Object.hasOwnProperty.call(message, "service")) + $root.google.monitoring.v3.Service.encode(message.service, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateServiceRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateServiceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {google.monitoring.v3.IUpdateServiceRequest} message UpdateServiceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServiceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateServiceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UpdateServiceRequest} UpdateServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateServiceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateServiceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.service = $root.google.monitoring.v3.Service.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateServiceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UpdateServiceRequest} UpdateServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateServiceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateServiceRequest message. + * @function verify + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateServiceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.service != null && message.hasOwnProperty("service")) { + var error = $root.google.monitoring.v3.Service.verify(message.service); + if (error) + return "service." + 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 UpdateServiceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UpdateServiceRequest} UpdateServiceRequest + */ + UpdateServiceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UpdateServiceRequest) + return object; + var message = new $root.google.monitoring.v3.UpdateServiceRequest(); + if (object.service != null) { + if (typeof object.service !== "object") + throw TypeError(".google.monitoring.v3.UpdateServiceRequest.service: object expected"); + message.service = $root.google.monitoring.v3.Service.fromObject(object.service); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.monitoring.v3.UpdateServiceRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateServiceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {google.monitoring.v3.UpdateServiceRequest} message UpdateServiceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateServiceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.service = null; + object.updateMask = null; + } + if (message.service != null && message.hasOwnProperty("service")) + object.service = $root.google.monitoring.v3.Service.toObject(message.service, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateServiceRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UpdateServiceRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateServiceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateServiceRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.UpdateServiceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateServiceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UpdateServiceRequest"; + }; + + return UpdateServiceRequest; + })(); + + v3.DeleteServiceRequest = (function() { + + /** + * Properties of a DeleteServiceRequest. + * @memberof google.monitoring.v3 + * @interface IDeleteServiceRequest + * @property {string|null} [name] DeleteServiceRequest name + */ + + /** + * Constructs a new DeleteServiceRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a DeleteServiceRequest. + * @implements IDeleteServiceRequest + * @constructor + * @param {google.monitoring.v3.IDeleteServiceRequest=} [properties] Properties to set + */ + function DeleteServiceRequest(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]]; + } + + /** + * DeleteServiceRequest name. + * @member {string} name + * @memberof google.monitoring.v3.DeleteServiceRequest + * @instance + */ + DeleteServiceRequest.prototype.name = ""; + + /** + * Creates a new DeleteServiceRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {google.monitoring.v3.IDeleteServiceRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.DeleteServiceRequest} DeleteServiceRequest instance + */ + DeleteServiceRequest.create = function create(properties) { + return new DeleteServiceRequest(properties); + }; + + /** + * Encodes the specified DeleteServiceRequest message. Does not implicitly {@link google.monitoring.v3.DeleteServiceRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {google.monitoring.v3.IDeleteServiceRequest} message DeleteServiceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteServiceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteServiceRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteServiceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {google.monitoring.v3.IDeleteServiceRequest} message DeleteServiceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteServiceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteServiceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DeleteServiceRequest} DeleteServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteServiceRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteServiceRequest(); + 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 DeleteServiceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DeleteServiceRequest} DeleteServiceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteServiceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteServiceRequest message. + * @function verify + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteServiceRequest.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 DeleteServiceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DeleteServiceRequest} DeleteServiceRequest + */ + DeleteServiceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DeleteServiceRequest) + return object; + var message = new $root.google.monitoring.v3.DeleteServiceRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteServiceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {google.monitoring.v3.DeleteServiceRequest} message DeleteServiceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteServiceRequest.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 DeleteServiceRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DeleteServiceRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteServiceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteServiceRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.DeleteServiceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteServiceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DeleteServiceRequest"; + }; + + return DeleteServiceRequest; + })(); + + v3.CreateServiceLevelObjectiveRequest = (function() { + + /** + * Properties of a CreateServiceLevelObjectiveRequest. + * @memberof google.monitoring.v3 + * @interface ICreateServiceLevelObjectiveRequest + * @property {string|null} [parent] CreateServiceLevelObjectiveRequest parent + * @property {string|null} [serviceLevelObjectiveId] CreateServiceLevelObjectiveRequest serviceLevelObjectiveId + * @property {google.monitoring.v3.IServiceLevelObjective|null} [serviceLevelObjective] CreateServiceLevelObjectiveRequest serviceLevelObjective + */ + + /** + * Constructs a new CreateServiceLevelObjectiveRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateServiceLevelObjectiveRequest. + * @implements ICreateServiceLevelObjectiveRequest + * @constructor + * @param {google.monitoring.v3.ICreateServiceLevelObjectiveRequest=} [properties] Properties to set + */ + function CreateServiceLevelObjectiveRequest(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]]; + } + + /** + * CreateServiceLevelObjectiveRequest parent. + * @member {string} parent + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @instance + */ + CreateServiceLevelObjectiveRequest.prototype.parent = ""; + + /** + * CreateServiceLevelObjectiveRequest serviceLevelObjectiveId. + * @member {string} serviceLevelObjectiveId + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @instance + */ + CreateServiceLevelObjectiveRequest.prototype.serviceLevelObjectiveId = ""; + + /** + * CreateServiceLevelObjectiveRequest serviceLevelObjective. + * @member {google.monitoring.v3.IServiceLevelObjective|null|undefined} serviceLevelObjective + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @instance + */ + CreateServiceLevelObjectiveRequest.prototype.serviceLevelObjective = null; + + /** + * Creates a new CreateServiceLevelObjectiveRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.ICreateServiceLevelObjectiveRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateServiceLevelObjectiveRequest} CreateServiceLevelObjectiveRequest instance + */ + CreateServiceLevelObjectiveRequest.create = function create(properties) { + return new CreateServiceLevelObjectiveRequest(properties); + }; + + /** + * Encodes the specified CreateServiceLevelObjectiveRequest message. Does not implicitly {@link google.monitoring.v3.CreateServiceLevelObjectiveRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.ICreateServiceLevelObjectiveRequest} message CreateServiceLevelObjectiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServiceLevelObjectiveRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.serviceLevelObjective != null && Object.hasOwnProperty.call(message, "serviceLevelObjective")) + $root.google.monitoring.v3.ServiceLevelObjective.encode(message.serviceLevelObjective, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.serviceLevelObjectiveId != null && Object.hasOwnProperty.call(message, "serviceLevelObjectiveId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.serviceLevelObjectiveId); + return writer; + }; + + /** + * Encodes the specified CreateServiceLevelObjectiveRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateServiceLevelObjectiveRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.ICreateServiceLevelObjectiveRequest} message CreateServiceLevelObjectiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateServiceLevelObjectiveRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateServiceLevelObjectiveRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateServiceLevelObjectiveRequest} CreateServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateServiceLevelObjectiveRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateServiceLevelObjectiveRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 3: { + message.serviceLevelObjectiveId = reader.string(); + break; + } + case 2: { + message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateServiceLevelObjectiveRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateServiceLevelObjectiveRequest} CreateServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateServiceLevelObjectiveRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateServiceLevelObjectiveRequest message. + * @function verify + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateServiceLevelObjectiveRequest.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.serviceLevelObjectiveId != null && message.hasOwnProperty("serviceLevelObjectiveId")) + if (!$util.isString(message.serviceLevelObjectiveId)) + return "serviceLevelObjectiveId: string expected"; + if (message.serviceLevelObjective != null && message.hasOwnProperty("serviceLevelObjective")) { + var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjective); + if (error) + return "serviceLevelObjective." + error; + } + return null; + }; + + /** + * Creates a CreateServiceLevelObjectiveRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateServiceLevelObjectiveRequest} CreateServiceLevelObjectiveRequest + */ + CreateServiceLevelObjectiveRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateServiceLevelObjectiveRequest) + return object; + var message = new $root.google.monitoring.v3.CreateServiceLevelObjectiveRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.serviceLevelObjectiveId != null) + message.serviceLevelObjectiveId = String(object.serviceLevelObjectiveId); + if (object.serviceLevelObjective != null) { + if (typeof object.serviceLevelObjective !== "object") + throw TypeError(".google.monitoring.v3.CreateServiceLevelObjectiveRequest.serviceLevelObjective: object expected"); + message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjective); + } + return message; + }; + + /** + * Creates a plain object from a CreateServiceLevelObjectiveRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.CreateServiceLevelObjectiveRequest} message CreateServiceLevelObjectiveRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateServiceLevelObjectiveRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.serviceLevelObjective = null; + object.serviceLevelObjectiveId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.serviceLevelObjective != null && message.hasOwnProperty("serviceLevelObjective")) + object.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.toObject(message.serviceLevelObjective, options); + if (message.serviceLevelObjectiveId != null && message.hasOwnProperty("serviceLevelObjectiveId")) + object.serviceLevelObjectiveId = message.serviceLevelObjectiveId; + return object; + }; + + /** + * Converts this CreateServiceLevelObjectiveRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @instance + * @returns {Object.} JSON object + */ + CreateServiceLevelObjectiveRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateServiceLevelObjectiveRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateServiceLevelObjectiveRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateServiceLevelObjectiveRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateServiceLevelObjectiveRequest"; + }; + + return CreateServiceLevelObjectiveRequest; + })(); + + v3.GetServiceLevelObjectiveRequest = (function() { + + /** + * Properties of a GetServiceLevelObjectiveRequest. + * @memberof google.monitoring.v3 + * @interface IGetServiceLevelObjectiveRequest + * @property {string|null} [name] GetServiceLevelObjectiveRequest name + * @property {google.monitoring.v3.ServiceLevelObjective.View|null} [view] GetServiceLevelObjectiveRequest view + */ + + /** + * Constructs a new GetServiceLevelObjectiveRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetServiceLevelObjectiveRequest. + * @implements IGetServiceLevelObjectiveRequest + * @constructor + * @param {google.monitoring.v3.IGetServiceLevelObjectiveRequest=} [properties] Properties to set + */ + function GetServiceLevelObjectiveRequest(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]]; + } + + /** + * GetServiceLevelObjectiveRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @instance + */ + GetServiceLevelObjectiveRequest.prototype.name = ""; + + /** + * GetServiceLevelObjectiveRequest view. + * @member {google.monitoring.v3.ServiceLevelObjective.View} view + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @instance + */ + GetServiceLevelObjectiveRequest.prototype.view = 0; + + /** + * Creates a new GetServiceLevelObjectiveRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IGetServiceLevelObjectiveRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetServiceLevelObjectiveRequest} GetServiceLevelObjectiveRequest instance + */ + GetServiceLevelObjectiveRequest.create = function create(properties) { + return new GetServiceLevelObjectiveRequest(properties); + }; + + /** + * Encodes the specified GetServiceLevelObjectiveRequest message. Does not implicitly {@link google.monitoring.v3.GetServiceLevelObjectiveRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IGetServiceLevelObjectiveRequest} message GetServiceLevelObjectiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetServiceLevelObjectiveRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.view != null && Object.hasOwnProperty.call(message, "view")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.view); + return writer; + }; + + /** + * Encodes the specified GetServiceLevelObjectiveRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetServiceLevelObjectiveRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IGetServiceLevelObjectiveRequest} message GetServiceLevelObjectiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetServiceLevelObjectiveRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetServiceLevelObjectiveRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetServiceLevelObjectiveRequest} GetServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetServiceLevelObjectiveRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetServiceLevelObjectiveRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.view = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetServiceLevelObjectiveRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetServiceLevelObjectiveRequest} GetServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetServiceLevelObjectiveRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetServiceLevelObjectiveRequest message. + * @function verify + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetServiceLevelObjectiveRequest.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.view != null && message.hasOwnProperty("view")) + switch (message.view) { + default: + return "view: enum value expected"; + case 0: + case 2: + case 1: + break; + } + return null; + }; + + /** + * Creates a GetServiceLevelObjectiveRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetServiceLevelObjectiveRequest} GetServiceLevelObjectiveRequest + */ + GetServiceLevelObjectiveRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetServiceLevelObjectiveRequest) + return object; + var message = new $root.google.monitoring.v3.GetServiceLevelObjectiveRequest(); + if (object.name != null) + message.name = String(object.name); + switch (object.view) { + default: + if (typeof object.view === "number") { + message.view = object.view; + break; + } + break; + case "VIEW_UNSPECIFIED": + case 0: + message.view = 0; + break; + case "FULL": + case 2: + message.view = 2; + break; + case "EXPLICIT": + case 1: + message.view = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a GetServiceLevelObjectiveRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.GetServiceLevelObjectiveRequest} message GetServiceLevelObjectiveRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetServiceLevelObjectiveRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.view = options.enums === String ? "VIEW_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.view != null && message.hasOwnProperty("view")) + object.view = options.enums === String ? $root.google.monitoring.v3.ServiceLevelObjective.View[message.view] === undefined ? message.view : $root.google.monitoring.v3.ServiceLevelObjective.View[message.view] : message.view; + return object; + }; + + /** + * Converts this GetServiceLevelObjectiveRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @instance + * @returns {Object.} JSON object + */ + GetServiceLevelObjectiveRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetServiceLevelObjectiveRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetServiceLevelObjectiveRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetServiceLevelObjectiveRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetServiceLevelObjectiveRequest"; + }; + + return GetServiceLevelObjectiveRequest; + })(); + + v3.ListServiceLevelObjectivesRequest = (function() { + + /** + * Properties of a ListServiceLevelObjectivesRequest. + * @memberof google.monitoring.v3 + * @interface IListServiceLevelObjectivesRequest + * @property {string|null} [parent] ListServiceLevelObjectivesRequest parent + * @property {string|null} [filter] ListServiceLevelObjectivesRequest filter + * @property {number|null} [pageSize] ListServiceLevelObjectivesRequest pageSize + * @property {string|null} [pageToken] ListServiceLevelObjectivesRequest pageToken + * @property {google.monitoring.v3.ServiceLevelObjective.View|null} [view] ListServiceLevelObjectivesRequest view + */ + + /** + * Constructs a new ListServiceLevelObjectivesRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListServiceLevelObjectivesRequest. + * @implements IListServiceLevelObjectivesRequest + * @constructor + * @param {google.monitoring.v3.IListServiceLevelObjectivesRequest=} [properties] Properties to set + */ + function ListServiceLevelObjectivesRequest(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]]; + } + + /** + * ListServiceLevelObjectivesRequest parent. + * @member {string} parent + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @instance + */ + ListServiceLevelObjectivesRequest.prototype.parent = ""; + + /** + * ListServiceLevelObjectivesRequest filter. + * @member {string} filter + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @instance + */ + ListServiceLevelObjectivesRequest.prototype.filter = ""; + + /** + * ListServiceLevelObjectivesRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @instance + */ + ListServiceLevelObjectivesRequest.prototype.pageSize = 0; + + /** + * ListServiceLevelObjectivesRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @instance + */ + ListServiceLevelObjectivesRequest.prototype.pageToken = ""; + + /** + * ListServiceLevelObjectivesRequest view. + * @member {google.monitoring.v3.ServiceLevelObjective.View} view + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @instance + */ + ListServiceLevelObjectivesRequest.prototype.view = 0; + + /** + * Creates a new ListServiceLevelObjectivesRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {google.monitoring.v3.IListServiceLevelObjectivesRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListServiceLevelObjectivesRequest} ListServiceLevelObjectivesRequest instance + */ + ListServiceLevelObjectivesRequest.create = function create(properties) { + return new ListServiceLevelObjectivesRequest(properties); + }; + + /** + * Encodes the specified ListServiceLevelObjectivesRequest message. Does not implicitly {@link google.monitoring.v3.ListServiceLevelObjectivesRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {google.monitoring.v3.IListServiceLevelObjectivesRequest} message ListServiceLevelObjectivesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServiceLevelObjectivesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + if (message.view != null && Object.hasOwnProperty.call(message, "view")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.view); + return writer; + }; + + /** + * Encodes the specified ListServiceLevelObjectivesRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListServiceLevelObjectivesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {google.monitoring.v3.IListServiceLevelObjectivesRequest} message ListServiceLevelObjectivesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServiceLevelObjectivesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListServiceLevelObjectivesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListServiceLevelObjectivesRequest} ListServiceLevelObjectivesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServiceLevelObjectivesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListServiceLevelObjectivesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + case 5: { + message.view = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListServiceLevelObjectivesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListServiceLevelObjectivesRequest} ListServiceLevelObjectivesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServiceLevelObjectivesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListServiceLevelObjectivesRequest message. + * @function verify + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServiceLevelObjectivesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + 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.view != null && message.hasOwnProperty("view")) + switch (message.view) { + default: + return "view: enum value expected"; + case 0: + case 2: + case 1: + break; + } + return null; + }; + + /** + * Creates a ListServiceLevelObjectivesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListServiceLevelObjectivesRequest} ListServiceLevelObjectivesRequest + */ + ListServiceLevelObjectivesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListServiceLevelObjectivesRequest) + return object; + var message = new $root.google.monitoring.v3.ListServiceLevelObjectivesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + switch (object.view) { + default: + if (typeof object.view === "number") { + message.view = object.view; + break; + } + break; + case "VIEW_UNSPECIFIED": + case 0: + message.view = 0; + break; + case "FULL": + case 2: + message.view = 2; + break; + case "EXPLICIT": + case 1: + message.view = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a ListServiceLevelObjectivesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {google.monitoring.v3.ListServiceLevelObjectivesRequest} message ListServiceLevelObjectivesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServiceLevelObjectivesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.view = options.enums === String ? "VIEW_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.view != null && message.hasOwnProperty("view")) + object.view = options.enums === String ? $root.google.monitoring.v3.ServiceLevelObjective.View[message.view] === undefined ? message.view : $root.google.monitoring.v3.ServiceLevelObjective.View[message.view] : message.view; + return object; + }; + + /** + * Converts this ListServiceLevelObjectivesRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @instance + * @returns {Object.} JSON object + */ + ListServiceLevelObjectivesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListServiceLevelObjectivesRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListServiceLevelObjectivesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServiceLevelObjectivesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListServiceLevelObjectivesRequest"; + }; + + return ListServiceLevelObjectivesRequest; + })(); + + v3.ListServiceLevelObjectivesResponse = (function() { + + /** + * Properties of a ListServiceLevelObjectivesResponse. + * @memberof google.monitoring.v3 + * @interface IListServiceLevelObjectivesResponse + * @property {Array.|null} [serviceLevelObjectives] ListServiceLevelObjectivesResponse serviceLevelObjectives + * @property {string|null} [nextPageToken] ListServiceLevelObjectivesResponse nextPageToken + */ + + /** + * Constructs a new ListServiceLevelObjectivesResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListServiceLevelObjectivesResponse. + * @implements IListServiceLevelObjectivesResponse + * @constructor + * @param {google.monitoring.v3.IListServiceLevelObjectivesResponse=} [properties] Properties to set + */ + function ListServiceLevelObjectivesResponse(properties) { + this.serviceLevelObjectives = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListServiceLevelObjectivesResponse serviceLevelObjectives. + * @member {Array.} serviceLevelObjectives + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @instance + */ + ListServiceLevelObjectivesResponse.prototype.serviceLevelObjectives = $util.emptyArray; + + /** + * ListServiceLevelObjectivesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @instance + */ + ListServiceLevelObjectivesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListServiceLevelObjectivesResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {google.monitoring.v3.IListServiceLevelObjectivesResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListServiceLevelObjectivesResponse} ListServiceLevelObjectivesResponse instance + */ + ListServiceLevelObjectivesResponse.create = function create(properties) { + return new ListServiceLevelObjectivesResponse(properties); + }; + + /** + * Encodes the specified ListServiceLevelObjectivesResponse message. Does not implicitly {@link google.monitoring.v3.ListServiceLevelObjectivesResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {google.monitoring.v3.IListServiceLevelObjectivesResponse} message ListServiceLevelObjectivesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServiceLevelObjectivesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.serviceLevelObjectives != null && message.serviceLevelObjectives.length) + for (var i = 0; i < message.serviceLevelObjectives.length; ++i) + $root.google.monitoring.v3.ServiceLevelObjective.encode(message.serviceLevelObjectives[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListServiceLevelObjectivesResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListServiceLevelObjectivesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {google.monitoring.v3.IListServiceLevelObjectivesResponse} message ListServiceLevelObjectivesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListServiceLevelObjectivesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListServiceLevelObjectivesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListServiceLevelObjectivesResponse} ListServiceLevelObjectivesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServiceLevelObjectivesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListServiceLevelObjectivesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.serviceLevelObjectives && message.serviceLevelObjectives.length)) + message.serviceLevelObjectives = []; + message.serviceLevelObjectives.push($root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListServiceLevelObjectivesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListServiceLevelObjectivesResponse} ListServiceLevelObjectivesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListServiceLevelObjectivesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListServiceLevelObjectivesResponse message. + * @function verify + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListServiceLevelObjectivesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.serviceLevelObjectives != null && message.hasOwnProperty("serviceLevelObjectives")) { + if (!Array.isArray(message.serviceLevelObjectives)) + return "serviceLevelObjectives: array expected"; + for (var i = 0; i < message.serviceLevelObjectives.length; ++i) { + var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjectives[i]); + if (error) + return "serviceLevelObjectives." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListServiceLevelObjectivesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListServiceLevelObjectivesResponse} ListServiceLevelObjectivesResponse + */ + ListServiceLevelObjectivesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListServiceLevelObjectivesResponse) + return object; + var message = new $root.google.monitoring.v3.ListServiceLevelObjectivesResponse(); + if (object.serviceLevelObjectives) { + if (!Array.isArray(object.serviceLevelObjectives)) + throw TypeError(".google.monitoring.v3.ListServiceLevelObjectivesResponse.serviceLevelObjectives: array expected"); + message.serviceLevelObjectives = []; + for (var i = 0; i < object.serviceLevelObjectives.length; ++i) { + if (typeof object.serviceLevelObjectives[i] !== "object") + throw TypeError(".google.monitoring.v3.ListServiceLevelObjectivesResponse.serviceLevelObjectives: object expected"); + message.serviceLevelObjectives[i] = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjectives[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListServiceLevelObjectivesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {google.monitoring.v3.ListServiceLevelObjectivesResponse} message ListServiceLevelObjectivesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListServiceLevelObjectivesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.serviceLevelObjectives = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.serviceLevelObjectives && message.serviceLevelObjectives.length) { + object.serviceLevelObjectives = []; + for (var j = 0; j < message.serviceLevelObjectives.length; ++j) + object.serviceLevelObjectives[j] = $root.google.monitoring.v3.ServiceLevelObjective.toObject(message.serviceLevelObjectives[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListServiceLevelObjectivesResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @instance + * @returns {Object.} JSON object + */ + ListServiceLevelObjectivesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListServiceLevelObjectivesResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListServiceLevelObjectivesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListServiceLevelObjectivesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListServiceLevelObjectivesResponse"; + }; + + return ListServiceLevelObjectivesResponse; + })(); + + v3.UpdateServiceLevelObjectiveRequest = (function() { + + /** + * Properties of an UpdateServiceLevelObjectiveRequest. + * @memberof google.monitoring.v3 + * @interface IUpdateServiceLevelObjectiveRequest + * @property {google.monitoring.v3.IServiceLevelObjective|null} [serviceLevelObjective] UpdateServiceLevelObjectiveRequest serviceLevelObjective + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateServiceLevelObjectiveRequest updateMask + */ + + /** + * Constructs a new UpdateServiceLevelObjectiveRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents an UpdateServiceLevelObjectiveRequest. + * @implements IUpdateServiceLevelObjectiveRequest + * @constructor + * @param {google.monitoring.v3.IUpdateServiceLevelObjectiveRequest=} [properties] Properties to set + */ + function UpdateServiceLevelObjectiveRequest(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]]; + } + + /** + * UpdateServiceLevelObjectiveRequest serviceLevelObjective. + * @member {google.monitoring.v3.IServiceLevelObjective|null|undefined} serviceLevelObjective + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @instance + */ + UpdateServiceLevelObjectiveRequest.prototype.serviceLevelObjective = null; + + /** + * UpdateServiceLevelObjectiveRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @instance + */ + UpdateServiceLevelObjectiveRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateServiceLevelObjectiveRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IUpdateServiceLevelObjectiveRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.UpdateServiceLevelObjectiveRequest} UpdateServiceLevelObjectiveRequest instance + */ + UpdateServiceLevelObjectiveRequest.create = function create(properties) { + return new UpdateServiceLevelObjectiveRequest(properties); + }; + + /** + * Encodes the specified UpdateServiceLevelObjectiveRequest message. Does not implicitly {@link google.monitoring.v3.UpdateServiceLevelObjectiveRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IUpdateServiceLevelObjectiveRequest} message UpdateServiceLevelObjectiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServiceLevelObjectiveRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.serviceLevelObjective != null && Object.hasOwnProperty.call(message, "serviceLevelObjective")) + $root.google.monitoring.v3.ServiceLevelObjective.encode(message.serviceLevelObjective, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateServiceLevelObjectiveRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateServiceLevelObjectiveRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IUpdateServiceLevelObjectiveRequest} message UpdateServiceLevelObjectiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateServiceLevelObjectiveRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateServiceLevelObjectiveRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UpdateServiceLevelObjectiveRequest} UpdateServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateServiceLevelObjectiveRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateServiceLevelObjectiveRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateServiceLevelObjectiveRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UpdateServiceLevelObjectiveRequest} UpdateServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateServiceLevelObjectiveRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateServiceLevelObjectiveRequest message. + * @function verify + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateServiceLevelObjectiveRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.serviceLevelObjective != null && message.hasOwnProperty("serviceLevelObjective")) { + var error = $root.google.monitoring.v3.ServiceLevelObjective.verify(message.serviceLevelObjective); + if (error) + return "serviceLevelObjective." + 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 UpdateServiceLevelObjectiveRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UpdateServiceLevelObjectiveRequest} UpdateServiceLevelObjectiveRequest + */ + UpdateServiceLevelObjectiveRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UpdateServiceLevelObjectiveRequest) + return object; + var message = new $root.google.monitoring.v3.UpdateServiceLevelObjectiveRequest(); + if (object.serviceLevelObjective != null) { + if (typeof object.serviceLevelObjective !== "object") + throw TypeError(".google.monitoring.v3.UpdateServiceLevelObjectiveRequest.serviceLevelObjective: object expected"); + message.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.fromObject(object.serviceLevelObjective); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.monitoring.v3.UpdateServiceLevelObjectiveRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateServiceLevelObjectiveRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.UpdateServiceLevelObjectiveRequest} message UpdateServiceLevelObjectiveRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateServiceLevelObjectiveRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.serviceLevelObjective = null; + object.updateMask = null; + } + if (message.serviceLevelObjective != null && message.hasOwnProperty("serviceLevelObjective")) + object.serviceLevelObjective = $root.google.monitoring.v3.ServiceLevelObjective.toObject(message.serviceLevelObjective, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateServiceLevelObjectiveRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateServiceLevelObjectiveRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateServiceLevelObjectiveRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.UpdateServiceLevelObjectiveRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateServiceLevelObjectiveRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UpdateServiceLevelObjectiveRequest"; + }; + + return UpdateServiceLevelObjectiveRequest; + })(); + + v3.DeleteServiceLevelObjectiveRequest = (function() { + + /** + * Properties of a DeleteServiceLevelObjectiveRequest. + * @memberof google.monitoring.v3 + * @interface IDeleteServiceLevelObjectiveRequest + * @property {string|null} [name] DeleteServiceLevelObjectiveRequest name + */ + + /** + * Constructs a new DeleteServiceLevelObjectiveRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a DeleteServiceLevelObjectiveRequest. + * @implements IDeleteServiceLevelObjectiveRequest + * @constructor + * @param {google.monitoring.v3.IDeleteServiceLevelObjectiveRequest=} [properties] Properties to set + */ + function DeleteServiceLevelObjectiveRequest(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]]; + } + + /** + * DeleteServiceLevelObjectiveRequest name. + * @member {string} name + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @instance + */ + DeleteServiceLevelObjectiveRequest.prototype.name = ""; + + /** + * Creates a new DeleteServiceLevelObjectiveRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IDeleteServiceLevelObjectiveRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.DeleteServiceLevelObjectiveRequest} DeleteServiceLevelObjectiveRequest instance + */ + DeleteServiceLevelObjectiveRequest.create = function create(properties) { + return new DeleteServiceLevelObjectiveRequest(properties); + }; + + /** + * Encodes the specified DeleteServiceLevelObjectiveRequest message. Does not implicitly {@link google.monitoring.v3.DeleteServiceLevelObjectiveRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IDeleteServiceLevelObjectiveRequest} message DeleteServiceLevelObjectiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteServiceLevelObjectiveRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteServiceLevelObjectiveRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteServiceLevelObjectiveRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.IDeleteServiceLevelObjectiveRequest} message DeleteServiceLevelObjectiveRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteServiceLevelObjectiveRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteServiceLevelObjectiveRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DeleteServiceLevelObjectiveRequest} DeleteServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteServiceLevelObjectiveRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteServiceLevelObjectiveRequest(); + 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 DeleteServiceLevelObjectiveRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DeleteServiceLevelObjectiveRequest} DeleteServiceLevelObjectiveRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteServiceLevelObjectiveRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteServiceLevelObjectiveRequest message. + * @function verify + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteServiceLevelObjectiveRequest.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 DeleteServiceLevelObjectiveRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DeleteServiceLevelObjectiveRequest} DeleteServiceLevelObjectiveRequest + */ + DeleteServiceLevelObjectiveRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DeleteServiceLevelObjectiveRequest) + return object; + var message = new $root.google.monitoring.v3.DeleteServiceLevelObjectiveRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteServiceLevelObjectiveRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {google.monitoring.v3.DeleteServiceLevelObjectiveRequest} message DeleteServiceLevelObjectiveRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteServiceLevelObjectiveRequest.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 DeleteServiceLevelObjectiveRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteServiceLevelObjectiveRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteServiceLevelObjectiveRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.DeleteServiceLevelObjectiveRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteServiceLevelObjectiveRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DeleteServiceLevelObjectiveRequest"; + }; + + return DeleteServiceLevelObjectiveRequest; + })(); + + v3.SpanContext = (function() { + + /** + * Properties of a SpanContext. + * @memberof google.monitoring.v3 + * @interface ISpanContext + * @property {string|null} [spanName] SpanContext spanName + */ + + /** + * Constructs a new SpanContext. + * @memberof google.monitoring.v3 + * @classdesc Represents a SpanContext. + * @implements ISpanContext + * @constructor + * @param {google.monitoring.v3.ISpanContext=} [properties] Properties to set + */ + function SpanContext(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]]; + } + + /** + * SpanContext spanName. + * @member {string} spanName + * @memberof google.monitoring.v3.SpanContext + * @instance + */ + SpanContext.prototype.spanName = ""; + + /** + * Creates a new SpanContext instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {google.monitoring.v3.ISpanContext=} [properties] Properties to set + * @returns {google.monitoring.v3.SpanContext} SpanContext instance + */ + SpanContext.create = function create(properties) { + return new SpanContext(properties); + }; + + /** + * Encodes the specified SpanContext message. Does not implicitly {@link google.monitoring.v3.SpanContext.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {google.monitoring.v3.ISpanContext} message SpanContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpanContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.spanName != null && Object.hasOwnProperty.call(message, "spanName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.spanName); + return writer; + }; + + /** + * Encodes the specified SpanContext message, length delimited. Does not implicitly {@link google.monitoring.v3.SpanContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {google.monitoring.v3.ISpanContext} message SpanContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpanContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpanContext message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.SpanContext} SpanContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpanContext.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.SpanContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.spanName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpanContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.SpanContext} SpanContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpanContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpanContext message. + * @function verify + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpanContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.spanName != null && message.hasOwnProperty("spanName")) + if (!$util.isString(message.spanName)) + return "spanName: string expected"; + return null; + }; + + /** + * Creates a SpanContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.SpanContext} SpanContext + */ + SpanContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.SpanContext) + return object; + var message = new $root.google.monitoring.v3.SpanContext(); + if (object.spanName != null) + message.spanName = String(object.spanName); + return message; + }; + + /** + * Creates a plain object from a SpanContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {google.monitoring.v3.SpanContext} message SpanContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpanContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.spanName = ""; + if (message.spanName != null && message.hasOwnProperty("spanName")) + object.spanName = message.spanName; + return object; + }; + + /** + * Converts this SpanContext to JSON. + * @function toJSON + * @memberof google.monitoring.v3.SpanContext + * @instance + * @returns {Object.} JSON object + */ + SpanContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SpanContext + * @function getTypeUrl + * @memberof google.monitoring.v3.SpanContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpanContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.SpanContext"; + }; + + return SpanContext; + })(); + + /** + * UptimeCheckRegion enum. + * @name google.monitoring.v3.UptimeCheckRegion + * @enum {number} + * @property {number} REGION_UNSPECIFIED=0 REGION_UNSPECIFIED value + * @property {number} USA=1 USA value + * @property {number} EUROPE=2 EUROPE value + * @property {number} SOUTH_AMERICA=3 SOUTH_AMERICA value + * @property {number} ASIA_PACIFIC=4 ASIA_PACIFIC value + */ + v3.UptimeCheckRegion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REGION_UNSPECIFIED"] = 0; + values[valuesById[1] = "USA"] = 1; + values[valuesById[2] = "EUROPE"] = 2; + values[valuesById[3] = "SOUTH_AMERICA"] = 3; + values[valuesById[4] = "ASIA_PACIFIC"] = 4; + return values; + })(); + + v3.InternalChecker = (function() { + + /** + * Properties of an InternalChecker. + * @memberof google.monitoring.v3 + * @interface IInternalChecker + * @property {string|null} [name] InternalChecker name + * @property {string|null} [displayName] InternalChecker displayName + * @property {string|null} [network] InternalChecker network + * @property {string|null} [gcpZone] InternalChecker gcpZone + * @property {string|null} [peerProjectId] InternalChecker peerProjectId + * @property {google.monitoring.v3.InternalChecker.State|null} [state] InternalChecker state + */ + + /** + * Constructs a new InternalChecker. + * @memberof google.monitoring.v3 + * @classdesc Represents an InternalChecker. + * @implements IInternalChecker + * @constructor + * @param {google.monitoring.v3.IInternalChecker=} [properties] Properties to set + */ + function InternalChecker(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]]; + } + + /** + * InternalChecker name. + * @member {string} name + * @memberof google.monitoring.v3.InternalChecker + * @instance + */ + InternalChecker.prototype.name = ""; + + /** + * InternalChecker displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.InternalChecker + * @instance + */ + InternalChecker.prototype.displayName = ""; + + /** + * InternalChecker network. + * @member {string} network + * @memberof google.monitoring.v3.InternalChecker + * @instance + */ + InternalChecker.prototype.network = ""; + + /** + * InternalChecker gcpZone. + * @member {string} gcpZone + * @memberof google.monitoring.v3.InternalChecker + * @instance + */ + InternalChecker.prototype.gcpZone = ""; + + /** + * InternalChecker peerProjectId. + * @member {string} peerProjectId + * @memberof google.monitoring.v3.InternalChecker + * @instance + */ + InternalChecker.prototype.peerProjectId = ""; + + /** + * InternalChecker state. + * @member {google.monitoring.v3.InternalChecker.State} state + * @memberof google.monitoring.v3.InternalChecker + * @instance + */ + InternalChecker.prototype.state = 0; + + /** + * Creates a new InternalChecker instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {google.monitoring.v3.IInternalChecker=} [properties] Properties to set + * @returns {google.monitoring.v3.InternalChecker} InternalChecker instance + */ + InternalChecker.create = function create(properties) { + return new InternalChecker(properties); + }; + + /** + * Encodes the specified InternalChecker message. Does not implicitly {@link google.monitoring.v3.InternalChecker.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {google.monitoring.v3.IInternalChecker} message InternalChecker message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InternalChecker.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.network != null && Object.hasOwnProperty.call(message, "network")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.network); + if (message.gcpZone != null && Object.hasOwnProperty.call(message, "gcpZone")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.gcpZone); + if (message.peerProjectId != null && Object.hasOwnProperty.call(message, "peerProjectId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.peerProjectId); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.state); + return writer; + }; + + /** + * Encodes the specified InternalChecker message, length delimited. Does not implicitly {@link google.monitoring.v3.InternalChecker.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {google.monitoring.v3.IInternalChecker} message InternalChecker message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InternalChecker.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InternalChecker message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.InternalChecker} InternalChecker + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InternalChecker.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.InternalChecker(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.network = reader.string(); + break; + } + case 4: { + message.gcpZone = reader.string(); + break; + } + case 6: { + message.peerProjectId = reader.string(); + break; + } + case 7: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InternalChecker message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.InternalChecker} InternalChecker + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InternalChecker.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InternalChecker message. + * @function verify + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InternalChecker.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.network != null && message.hasOwnProperty("network")) + if (!$util.isString(message.network)) + return "network: string expected"; + if (message.gcpZone != null && message.hasOwnProperty("gcpZone")) + if (!$util.isString(message.gcpZone)) + return "gcpZone: string expected"; + if (message.peerProjectId != null && message.hasOwnProperty("peerProjectId")) + if (!$util.isString(message.peerProjectId)) + return "peerProjectId: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an InternalChecker message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.InternalChecker} InternalChecker + */ + InternalChecker.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.InternalChecker) + return object; + var message = new $root.google.monitoring.v3.InternalChecker(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.network != null) + message.network = String(object.network); + if (object.gcpZone != null) + message.gcpZone = String(object.gcpZone); + if (object.peerProjectId != null) + message.peerProjectId = String(object.peerProjectId); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATING": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an InternalChecker message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {google.monitoring.v3.InternalChecker} message InternalChecker + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InternalChecker.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.network = ""; + object.gcpZone = ""; + object.peerProjectId = ""; + object.state = options.enums === String ? "UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.network != null && message.hasOwnProperty("network")) + object.network = message.network; + if (message.gcpZone != null && message.hasOwnProperty("gcpZone")) + object.gcpZone = message.gcpZone; + if (message.peerProjectId != null && message.hasOwnProperty("peerProjectId")) + object.peerProjectId = message.peerProjectId; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.monitoring.v3.InternalChecker.State[message.state] === undefined ? message.state : $root.google.monitoring.v3.InternalChecker.State[message.state] : message.state; + return object; + }; + + /** + * Converts this InternalChecker to JSON. + * @function toJSON + * @memberof google.monitoring.v3.InternalChecker + * @instance + * @returns {Object.} JSON object + */ + InternalChecker.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InternalChecker + * @function getTypeUrl + * @memberof google.monitoring.v3.InternalChecker + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InternalChecker.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.InternalChecker"; + }; + + /** + * State enum. + * @name google.monitoring.v3.InternalChecker.State + * @enum {number} + * @property {number} UNSPECIFIED=0 UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} RUNNING=2 RUNNING value + */ + InternalChecker.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + return values; + })(); + + return InternalChecker; + })(); + + v3.UptimeCheckConfig = (function() { + + /** + * Properties of an UptimeCheckConfig. + * @memberof google.monitoring.v3 + * @interface IUptimeCheckConfig + * @property {string|null} [name] UptimeCheckConfig name + * @property {string|null} [displayName] UptimeCheckConfig displayName + * @property {google.api.IMonitoredResource|null} [monitoredResource] UptimeCheckConfig monitoredResource + * @property {google.monitoring.v3.UptimeCheckConfig.IResourceGroup|null} [resourceGroup] UptimeCheckConfig resourceGroup + * @property {google.monitoring.v3.UptimeCheckConfig.IHttpCheck|null} [httpCheck] UptimeCheckConfig httpCheck + * @property {google.monitoring.v3.UptimeCheckConfig.ITcpCheck|null} [tcpCheck] UptimeCheckConfig tcpCheck + * @property {google.protobuf.IDuration|null} [period] UptimeCheckConfig period + * @property {google.protobuf.IDuration|null} [timeout] UptimeCheckConfig timeout + * @property {Array.|null} [contentMatchers] UptimeCheckConfig contentMatchers + * @property {Array.|null} [selectedRegions] UptimeCheckConfig selectedRegions + * @property {boolean|null} [isInternal] UptimeCheckConfig isInternal + * @property {Array.|null} [internalCheckers] UptimeCheckConfig internalCheckers + */ + + /** + * Constructs a new UptimeCheckConfig. + * @memberof google.monitoring.v3 + * @classdesc Represents an UptimeCheckConfig. + * @implements IUptimeCheckConfig + * @constructor + * @param {google.monitoring.v3.IUptimeCheckConfig=} [properties] Properties to set + */ + function UptimeCheckConfig(properties) { + this.contentMatchers = []; + this.selectedRegions = []; + this.internalCheckers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UptimeCheckConfig name. + * @member {string} name + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.name = ""; + + /** + * UptimeCheckConfig displayName. + * @member {string} displayName + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.displayName = ""; + + /** + * UptimeCheckConfig monitoredResource. + * @member {google.api.IMonitoredResource|null|undefined} monitoredResource + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.monitoredResource = null; + + /** + * UptimeCheckConfig resourceGroup. + * @member {google.monitoring.v3.UptimeCheckConfig.IResourceGroup|null|undefined} resourceGroup + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.resourceGroup = null; + + /** + * UptimeCheckConfig httpCheck. + * @member {google.monitoring.v3.UptimeCheckConfig.IHttpCheck|null|undefined} httpCheck + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.httpCheck = null; + + /** + * UptimeCheckConfig tcpCheck. + * @member {google.monitoring.v3.UptimeCheckConfig.ITcpCheck|null|undefined} tcpCheck + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.tcpCheck = null; + + /** + * UptimeCheckConfig period. + * @member {google.protobuf.IDuration|null|undefined} period + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.period = null; + + /** + * UptimeCheckConfig timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.timeout = null; + + /** + * UptimeCheckConfig contentMatchers. + * @member {Array.} contentMatchers + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.contentMatchers = $util.emptyArray; + + /** + * UptimeCheckConfig selectedRegions. + * @member {Array.} selectedRegions + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.selectedRegions = $util.emptyArray; + + /** + * UptimeCheckConfig isInternal. + * @member {boolean} isInternal + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.isInternal = false; + + /** + * UptimeCheckConfig internalCheckers. + * @member {Array.} internalCheckers + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + UptimeCheckConfig.prototype.internalCheckers = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * UptimeCheckConfig resource. + * @member {"monitoredResource"|"resourceGroup"|undefined} resource + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + Object.defineProperty(UptimeCheckConfig.prototype, "resource", { + get: $util.oneOfGetter($oneOfFields = ["monitoredResource", "resourceGroup"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * UptimeCheckConfig checkRequestType. + * @member {"httpCheck"|"tcpCheck"|undefined} checkRequestType + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + */ + Object.defineProperty(UptimeCheckConfig.prototype, "checkRequestType", { + get: $util.oneOfGetter($oneOfFields = ["httpCheck", "tcpCheck"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new UptimeCheckConfig instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {google.monitoring.v3.IUptimeCheckConfig=} [properties] Properties to set + * @returns {google.monitoring.v3.UptimeCheckConfig} UptimeCheckConfig instance + */ + UptimeCheckConfig.create = function create(properties) { + return new UptimeCheckConfig(properties); + }; + + /** + * Encodes the specified UptimeCheckConfig message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {google.monitoring.v3.IUptimeCheckConfig} message UptimeCheckConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UptimeCheckConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.monitoredResource != null && Object.hasOwnProperty.call(message, "monitoredResource")) + $root.google.api.MonitoredResource.encode(message.monitoredResource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.resourceGroup != null && Object.hasOwnProperty.call(message, "resourceGroup")) + $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.encode(message.resourceGroup, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.httpCheck != null && Object.hasOwnProperty.call(message, "httpCheck")) + $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.encode(message.httpCheck, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.tcpCheck != null && Object.hasOwnProperty.call(message, "tcpCheck")) + $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.encode(message.tcpCheck, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.period != null && Object.hasOwnProperty.call(message, "period")) + $root.google.protobuf.Duration.encode(message.period, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.contentMatchers != null && message.contentMatchers.length) + for (var i = 0; i < message.contentMatchers.length; ++i) + $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.encode(message.contentMatchers[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.selectedRegions != null && message.selectedRegions.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.selectedRegions.length; ++i) + writer.int32(message.selectedRegions[i]); + writer.ldelim(); + } + if (message.internalCheckers != null && message.internalCheckers.length) + for (var i = 0; i < message.internalCheckers.length; ++i) + $root.google.monitoring.v3.InternalChecker.encode(message.internalCheckers[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.isInternal != null && Object.hasOwnProperty.call(message, "isInternal")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.isInternal); + return writer; + }; + + /** + * Encodes the specified UptimeCheckConfig message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {google.monitoring.v3.IUptimeCheckConfig} message UptimeCheckConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UptimeCheckConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UptimeCheckConfig message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UptimeCheckConfig} UptimeCheckConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UptimeCheckConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.monitoredResource = $root.google.api.MonitoredResource.decode(reader, reader.uint32()); + break; + } + case 4: { + message.resourceGroup = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.decode(reader, reader.uint32()); + break; + } + case 5: { + message.httpCheck = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.decode(reader, reader.uint32()); + break; + } + case 6: { + message.tcpCheck = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.decode(reader, reader.uint32()); + break; + } + case 7: { + message.period = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 8: { + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.contentMatchers && message.contentMatchers.length)) + message.contentMatchers = []; + message.contentMatchers.push($root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.selectedRegions && message.selectedRegions.length)) + message.selectedRegions = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.selectedRegions.push(reader.int32()); + } else + message.selectedRegions.push(reader.int32()); + break; + } + case 15: { + message.isInternal = reader.bool(); + break; + } + case 14: { + if (!(message.internalCheckers && message.internalCheckers.length)) + message.internalCheckers = []; + message.internalCheckers.push($root.google.monitoring.v3.InternalChecker.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UptimeCheckConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UptimeCheckConfig} UptimeCheckConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UptimeCheckConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UptimeCheckConfig message. + * @function verify + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UptimeCheckConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.monitoredResource != null && message.hasOwnProperty("monitoredResource")) { + properties.resource = 1; + { + var error = $root.google.api.MonitoredResource.verify(message.monitoredResource); + if (error) + return "monitoredResource." + error; + } + } + if (message.resourceGroup != null && message.hasOwnProperty("resourceGroup")) { + if (properties.resource === 1) + return "resource: multiple values"; + properties.resource = 1; + { + var error = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.verify(message.resourceGroup); + if (error) + return "resourceGroup." + error; + } + } + if (message.httpCheck != null && message.hasOwnProperty("httpCheck")) { + properties.checkRequestType = 1; + { + var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.verify(message.httpCheck); + if (error) + return "httpCheck." + error; + } + } + if (message.tcpCheck != null && message.hasOwnProperty("tcpCheck")) { + if (properties.checkRequestType === 1) + return "checkRequestType: multiple values"; + properties.checkRequestType = 1; + { + var error = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.verify(message.tcpCheck); + if (error) + return "tcpCheck." + error; + } + } + if (message.period != null && message.hasOwnProperty("period")) { + var error = $root.google.protobuf.Duration.verify(message.period); + if (error) + return "period." + error; + } + if (message.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + if (message.contentMatchers != null && message.hasOwnProperty("contentMatchers")) { + if (!Array.isArray(message.contentMatchers)) + return "contentMatchers: array expected"; + for (var i = 0; i < message.contentMatchers.length; ++i) { + var error = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.verify(message.contentMatchers[i]); + if (error) + return "contentMatchers." + error; + } + } + if (message.selectedRegions != null && message.hasOwnProperty("selectedRegions")) { + if (!Array.isArray(message.selectedRegions)) + return "selectedRegions: array expected"; + for (var i = 0; i < message.selectedRegions.length; ++i) + switch (message.selectedRegions[i]) { + default: + return "selectedRegions: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + if (message.isInternal != null && message.hasOwnProperty("isInternal")) + if (typeof message.isInternal !== "boolean") + return "isInternal: boolean expected"; + if (message.internalCheckers != null && message.hasOwnProperty("internalCheckers")) { + if (!Array.isArray(message.internalCheckers)) + return "internalCheckers: array expected"; + for (var i = 0; i < message.internalCheckers.length; ++i) { + var error = $root.google.monitoring.v3.InternalChecker.verify(message.internalCheckers[i]); + if (error) + return "internalCheckers." + error; + } + } + return null; + }; + + /** + * Creates an UptimeCheckConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UptimeCheckConfig} UptimeCheckConfig + */ + UptimeCheckConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig) + return object; + var message = new $root.google.monitoring.v3.UptimeCheckConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.monitoredResource != null) { + if (typeof object.monitoredResource !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.monitoredResource: object expected"); + message.monitoredResource = $root.google.api.MonitoredResource.fromObject(object.monitoredResource); + } + if (object.resourceGroup != null) { + if (typeof object.resourceGroup !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.resourceGroup: object expected"); + message.resourceGroup = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.fromObject(object.resourceGroup); + } + if (object.httpCheck != null) { + if (typeof object.httpCheck !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.httpCheck: object expected"); + message.httpCheck = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.fromObject(object.httpCheck); + } + if (object.tcpCheck != null) { + if (typeof object.tcpCheck !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.tcpCheck: object expected"); + message.tcpCheck = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.fromObject(object.tcpCheck); + } + if (object.period != null) { + if (typeof object.period !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.period: object expected"); + message.period = $root.google.protobuf.Duration.fromObject(object.period); + } + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + if (object.contentMatchers) { + if (!Array.isArray(object.contentMatchers)) + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.contentMatchers: array expected"); + message.contentMatchers = []; + for (var i = 0; i < object.contentMatchers.length; ++i) { + if (typeof object.contentMatchers[i] !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.contentMatchers: object expected"); + message.contentMatchers[i] = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.fromObject(object.contentMatchers[i]); + } + } + if (object.selectedRegions) { + if (!Array.isArray(object.selectedRegions)) + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.selectedRegions: array expected"); + message.selectedRegions = []; + for (var i = 0; i < object.selectedRegions.length; ++i) + switch (object.selectedRegions[i]) { + default: + if (typeof object.selectedRegions[i] === "number") { + message.selectedRegions[i] = object.selectedRegions[i]; + break; + } + case "REGION_UNSPECIFIED": + case 0: + message.selectedRegions[i] = 0; + break; + case "USA": + case 1: + message.selectedRegions[i] = 1; + break; + case "EUROPE": + case 2: + message.selectedRegions[i] = 2; + break; + case "SOUTH_AMERICA": + case 3: + message.selectedRegions[i] = 3; + break; + case "ASIA_PACIFIC": + case 4: + message.selectedRegions[i] = 4; + break; + } + } + if (object.isInternal != null) + message.isInternal = Boolean(object.isInternal); + if (object.internalCheckers) { + if (!Array.isArray(object.internalCheckers)) + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.internalCheckers: array expected"); + message.internalCheckers = []; + for (var i = 0; i < object.internalCheckers.length; ++i) { + if (typeof object.internalCheckers[i] !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.internalCheckers: object expected"); + message.internalCheckers[i] = $root.google.monitoring.v3.InternalChecker.fromObject(object.internalCheckers[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an UptimeCheckConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {google.monitoring.v3.UptimeCheckConfig} message UptimeCheckConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UptimeCheckConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.contentMatchers = []; + object.selectedRegions = []; + object.internalCheckers = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.period = null; + object.timeout = null; + object.isInternal = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.monitoredResource != null && message.hasOwnProperty("monitoredResource")) { + object.monitoredResource = $root.google.api.MonitoredResource.toObject(message.monitoredResource, options); + if (options.oneofs) + object.resource = "monitoredResource"; + } + if (message.resourceGroup != null && message.hasOwnProperty("resourceGroup")) { + object.resourceGroup = $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup.toObject(message.resourceGroup, options); + if (options.oneofs) + object.resource = "resourceGroup"; + } + if (message.httpCheck != null && message.hasOwnProperty("httpCheck")) { + object.httpCheck = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.toObject(message.httpCheck, options); + if (options.oneofs) + object.checkRequestType = "httpCheck"; + } + if (message.tcpCheck != null && message.hasOwnProperty("tcpCheck")) { + object.tcpCheck = $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck.toObject(message.tcpCheck, options); + if (options.oneofs) + object.checkRequestType = "tcpCheck"; + } + if (message.period != null && message.hasOwnProperty("period")) + object.period = $root.google.protobuf.Duration.toObject(message.period, options); + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + if (message.contentMatchers && message.contentMatchers.length) { + object.contentMatchers = []; + for (var j = 0; j < message.contentMatchers.length; ++j) + object.contentMatchers[j] = $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.toObject(message.contentMatchers[j], options); + } + if (message.selectedRegions && message.selectedRegions.length) { + object.selectedRegions = []; + for (var j = 0; j < message.selectedRegions.length; ++j) + object.selectedRegions[j] = options.enums === String ? $root.google.monitoring.v3.UptimeCheckRegion[message.selectedRegions[j]] === undefined ? message.selectedRegions[j] : $root.google.monitoring.v3.UptimeCheckRegion[message.selectedRegions[j]] : message.selectedRegions[j]; + } + if (message.internalCheckers && message.internalCheckers.length) { + object.internalCheckers = []; + for (var j = 0; j < message.internalCheckers.length; ++j) + object.internalCheckers[j] = $root.google.monitoring.v3.InternalChecker.toObject(message.internalCheckers[j], options); + } + if (message.isInternal != null && message.hasOwnProperty("isInternal")) + object.isInternal = message.isInternal; + return object; + }; + + /** + * Converts this UptimeCheckConfig to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UptimeCheckConfig + * @instance + * @returns {Object.} JSON object + */ + UptimeCheckConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UptimeCheckConfig + * @function getTypeUrl + * @memberof google.monitoring.v3.UptimeCheckConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UptimeCheckConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UptimeCheckConfig"; + }; + + UptimeCheckConfig.ResourceGroup = (function() { + + /** + * Properties of a ResourceGroup. + * @memberof google.monitoring.v3.UptimeCheckConfig + * @interface IResourceGroup + * @property {string|null} [groupId] ResourceGroup groupId + * @property {google.monitoring.v3.GroupResourceType|null} [resourceType] ResourceGroup resourceType + */ + + /** + * Constructs a new ResourceGroup. + * @memberof google.monitoring.v3.UptimeCheckConfig + * @classdesc Represents a ResourceGroup. + * @implements IResourceGroup + * @constructor + * @param {google.monitoring.v3.UptimeCheckConfig.IResourceGroup=} [properties] Properties to set + */ + function ResourceGroup(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]]; + } + + /** + * ResourceGroup groupId. + * @member {string} groupId + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @instance + */ + ResourceGroup.prototype.groupId = ""; + + /** + * ResourceGroup resourceType. + * @member {google.monitoring.v3.GroupResourceType} resourceType + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @instance + */ + ResourceGroup.prototype.resourceType = 0; + + /** + * Creates a new ResourceGroup instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IResourceGroup=} [properties] Properties to set + * @returns {google.monitoring.v3.UptimeCheckConfig.ResourceGroup} ResourceGroup instance + */ + ResourceGroup.create = function create(properties) { + return new ResourceGroup(properties); + }; + + /** + * Encodes the specified ResourceGroup message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.ResourceGroup.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IResourceGroup} message ResourceGroup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceGroup.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.groupId != null && Object.hasOwnProperty.call(message, "groupId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.groupId); + if (message.resourceType != null && Object.hasOwnProperty.call(message, "resourceType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.resourceType); + return writer; + }; + + /** + * Encodes the specified ResourceGroup message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.ResourceGroup.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IResourceGroup} message ResourceGroup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceGroup.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceGroup message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UptimeCheckConfig.ResourceGroup} ResourceGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceGroup.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.groupId = reader.string(); + break; + } + case 2: { + message.resourceType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceGroup message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UptimeCheckConfig.ResourceGroup} ResourceGroup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceGroup.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceGroup message. + * @function verify + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceGroup.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.groupId != null && message.hasOwnProperty("groupId")) + if (!$util.isString(message.groupId)) + return "groupId: string expected"; + if (message.resourceType != null && message.hasOwnProperty("resourceType")) + switch (message.resourceType) { + default: + return "resourceType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a ResourceGroup message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UptimeCheckConfig.ResourceGroup} ResourceGroup + */ + ResourceGroup.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup) + return object; + var message = new $root.google.monitoring.v3.UptimeCheckConfig.ResourceGroup(); + if (object.groupId != null) + message.groupId = String(object.groupId); + switch (object.resourceType) { + default: + if (typeof object.resourceType === "number") { + message.resourceType = object.resourceType; + break; + } + break; + case "RESOURCE_TYPE_UNSPECIFIED": + case 0: + message.resourceType = 0; + break; + case "INSTANCE": + case 1: + message.resourceType = 1; + break; + case "AWS_ELB_LOAD_BALANCER": + case 2: + message.resourceType = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a ResourceGroup message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.ResourceGroup} message ResourceGroup + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceGroup.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.groupId = ""; + object.resourceType = options.enums === String ? "RESOURCE_TYPE_UNSPECIFIED" : 0; + } + if (message.groupId != null && message.hasOwnProperty("groupId")) + object.groupId = message.groupId; + if (message.resourceType != null && message.hasOwnProperty("resourceType")) + object.resourceType = options.enums === String ? $root.google.monitoring.v3.GroupResourceType[message.resourceType] === undefined ? message.resourceType : $root.google.monitoring.v3.GroupResourceType[message.resourceType] : message.resourceType; + return object; + }; + + /** + * Converts this ResourceGroup to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @instance + * @returns {Object.} JSON object + */ + ResourceGroup.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceGroup + * @function getTypeUrl + * @memberof google.monitoring.v3.UptimeCheckConfig.ResourceGroup + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceGroup.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UptimeCheckConfig.ResourceGroup"; + }; + + return ResourceGroup; + })(); + + UptimeCheckConfig.HttpCheck = (function() { + + /** + * Properties of a HttpCheck. + * @memberof google.monitoring.v3.UptimeCheckConfig + * @interface IHttpCheck + * @property {google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod|null} [requestMethod] HttpCheck requestMethod + * @property {boolean|null} [useSsl] HttpCheck useSsl + * @property {string|null} [path] HttpCheck path + * @property {number|null} [port] HttpCheck port + * @property {google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication|null} [authInfo] HttpCheck authInfo + * @property {boolean|null} [maskHeaders] HttpCheck maskHeaders + * @property {Object.|null} [headers] HttpCheck headers + * @property {google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType|null} [contentType] HttpCheck contentType + * @property {boolean|null} [validateSsl] HttpCheck validateSsl + * @property {Uint8Array|null} [body] HttpCheck body + */ + + /** + * Constructs a new HttpCheck. + * @memberof google.monitoring.v3.UptimeCheckConfig + * @classdesc Represents a HttpCheck. + * @implements IHttpCheck + * @constructor + * @param {google.monitoring.v3.UptimeCheckConfig.IHttpCheck=} [properties] Properties to set + */ + function HttpCheck(properties) { + this.headers = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpCheck requestMethod. + * @member {google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod} requestMethod + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.requestMethod = 0; + + /** + * HttpCheck useSsl. + * @member {boolean} useSsl + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.useSsl = false; + + /** + * HttpCheck path. + * @member {string} path + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.path = ""; + + /** + * HttpCheck port. + * @member {number} port + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.port = 0; + + /** + * HttpCheck authInfo. + * @member {google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication|null|undefined} authInfo + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.authInfo = null; + + /** + * HttpCheck maskHeaders. + * @member {boolean} maskHeaders + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.maskHeaders = false; + + /** + * HttpCheck headers. + * @member {Object.} headers + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.headers = $util.emptyObject; + + /** + * HttpCheck contentType. + * @member {google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType} contentType + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.contentType = 0; + + /** + * HttpCheck validateSsl. + * @member {boolean} validateSsl + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.validateSsl = false; + + /** + * HttpCheck body. + * @member {Uint8Array} body + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + */ + HttpCheck.prototype.body = $util.newBuffer([]); + + /** + * Creates a new HttpCheck instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IHttpCheck=} [properties] Properties to set + * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck} HttpCheck instance + */ + HttpCheck.create = function create(properties) { + return new HttpCheck(properties); + }; + + /** + * Encodes the specified HttpCheck message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.HttpCheck.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IHttpCheck} message HttpCheck message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpCheck.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.useSsl != null && Object.hasOwnProperty.call(message, "useSsl")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.useSsl); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + if (message.port != null && Object.hasOwnProperty.call(message, "port")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.port); + if (message.authInfo != null && Object.hasOwnProperty.call(message, "authInfo")) + $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.encode(message.authInfo, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.maskHeaders != null && Object.hasOwnProperty.call(message, "maskHeaders")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.maskHeaders); + if (message.headers != null && Object.hasOwnProperty.call(message, "headers")) + for (var keys = Object.keys(message.headers), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.headers[keys[i]]).ldelim(); + if (message.validateSsl != null && Object.hasOwnProperty.call(message, "validateSsl")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.validateSsl); + if (message.requestMethod != null && Object.hasOwnProperty.call(message, "requestMethod")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.requestMethod); + if (message.contentType != null && Object.hasOwnProperty.call(message, "contentType")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.contentType); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 10, wireType 2 =*/82).bytes(message.body); + return writer; + }; + + /** + * Encodes the specified HttpCheck message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.HttpCheck.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IHttpCheck} message HttpCheck message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpCheck.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpCheck message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck} HttpCheck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpCheck.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 8: { + message.requestMethod = reader.int32(); + break; + } + case 1: { + message.useSsl = reader.bool(); + break; + } + case 2: { + message.path = reader.string(); + break; + } + case 3: { + message.port = reader.int32(); + break; + } + case 4: { + message.authInfo = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.decode(reader, reader.uint32()); + break; + } + case 5: { + message.maskHeaders = reader.bool(); + break; + } + case 6: { + if (message.headers === $util.emptyObject) + message.headers = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.headers[key] = value; + break; + } + case 9: { + message.contentType = reader.int32(); + break; + } + case 7: { + message.validateSsl = reader.bool(); + break; + } + case 10: { + message.body = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpCheck message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck} HttpCheck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpCheck.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpCheck message. + * @function verify + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpCheck.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.requestMethod != null && message.hasOwnProperty("requestMethod")) + switch (message.requestMethod) { + default: + return "requestMethod: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.useSsl != null && message.hasOwnProperty("useSsl")) + if (typeof message.useSsl !== "boolean") + return "useSsl: boolean expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + if (message.port != null && message.hasOwnProperty("port")) + if (!$util.isInteger(message.port)) + return "port: integer expected"; + if (message.authInfo != null && message.hasOwnProperty("authInfo")) { + var error = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.verify(message.authInfo); + if (error) + return "authInfo." + error; + } + if (message.maskHeaders != null && message.hasOwnProperty("maskHeaders")) + if (typeof message.maskHeaders !== "boolean") + return "maskHeaders: boolean expected"; + if (message.headers != null && message.hasOwnProperty("headers")) { + if (!$util.isObject(message.headers)) + return "headers: object expected"; + var key = Object.keys(message.headers); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.headers[key[i]])) + return "headers: string{k:string} expected"; + } + if (message.contentType != null && message.hasOwnProperty("contentType")) + switch (message.contentType) { + default: + return "contentType: enum value expected"; + case 0: + case 1: + break; + } + if (message.validateSsl != null && message.hasOwnProperty("validateSsl")) + if (typeof message.validateSsl !== "boolean") + return "validateSsl: boolean expected"; + if (message.body != null && message.hasOwnProperty("body")) + if (!(message.body && typeof message.body.length === "number" || $util.isString(message.body))) + return "body: buffer expected"; + return null; + }; + + /** + * Creates a HttpCheck message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck} HttpCheck + */ + HttpCheck.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck) + return object; + var message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck(); + switch (object.requestMethod) { + default: + if (typeof object.requestMethod === "number") { + message.requestMethod = object.requestMethod; + break; + } + break; + case "METHOD_UNSPECIFIED": + case 0: + message.requestMethod = 0; + break; + case "GET": + case 1: + message.requestMethod = 1; + break; + case "POST": + case 2: + message.requestMethod = 2; + break; + } + if (object.useSsl != null) + message.useSsl = Boolean(object.useSsl); + if (object.path != null) + message.path = String(object.path); + if (object.port != null) + message.port = object.port | 0; + if (object.authInfo != null) { + if (typeof object.authInfo !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.HttpCheck.authInfo: object expected"); + message.authInfo = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.fromObject(object.authInfo); + } + if (object.maskHeaders != null) + message.maskHeaders = Boolean(object.maskHeaders); + if (object.headers) { + if (typeof object.headers !== "object") + throw TypeError(".google.monitoring.v3.UptimeCheckConfig.HttpCheck.headers: object expected"); + message.headers = {}; + for (var keys = Object.keys(object.headers), i = 0; i < keys.length; ++i) + message.headers[keys[i]] = String(object.headers[keys[i]]); + } + switch (object.contentType) { + default: + if (typeof object.contentType === "number") { + message.contentType = object.contentType; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.contentType = 0; + break; + case "URL_ENCODED": + case 1: + message.contentType = 1; + break; + } + if (object.validateSsl != null) + message.validateSsl = Boolean(object.validateSsl); + if (object.body != null) + if (typeof object.body === "string") + $util.base64.decode(object.body, message.body = $util.newBuffer($util.base64.length(object.body)), 0); + else if (object.body.length >= 0) + message.body = object.body; + return message; + }; + + /** + * Creates a plain object from a HttpCheck message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.HttpCheck} message HttpCheck + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpCheck.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.headers = {}; + if (options.defaults) { + object.useSsl = false; + object.path = ""; + object.port = 0; + object.authInfo = null; + object.maskHeaders = false; + object.validateSsl = false; + object.requestMethod = options.enums === String ? "METHOD_UNSPECIFIED" : 0; + object.contentType = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + if (options.bytes === String) + object.body = ""; + else { + object.body = []; + if (options.bytes !== Array) + object.body = $util.newBuffer(object.body); + } + } + if (message.useSsl != null && message.hasOwnProperty("useSsl")) + object.useSsl = message.useSsl; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + if (message.port != null && message.hasOwnProperty("port")) + object.port = message.port; + if (message.authInfo != null && message.hasOwnProperty("authInfo")) + object.authInfo = $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.toObject(message.authInfo, options); + if (message.maskHeaders != null && message.hasOwnProperty("maskHeaders")) + object.maskHeaders = message.maskHeaders; + var keys2; + if (message.headers && (keys2 = Object.keys(message.headers)).length) { + object.headers = {}; + for (var j = 0; j < keys2.length; ++j) + object.headers[keys2[j]] = message.headers[keys2[j]]; + } + if (message.validateSsl != null && message.hasOwnProperty("validateSsl")) + object.validateSsl = message.validateSsl; + if (message.requestMethod != null && message.hasOwnProperty("requestMethod")) + object.requestMethod = options.enums === String ? $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod[message.requestMethod] === undefined ? message.requestMethod : $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod[message.requestMethod] : message.requestMethod; + if (message.contentType != null && message.hasOwnProperty("contentType")) + object.contentType = options.enums === String ? $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType[message.contentType] === undefined ? message.contentType : $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType[message.contentType] : message.contentType; + if (message.body != null && message.hasOwnProperty("body")) + object.body = options.bytes === String ? $util.base64.encode(message.body, 0, message.body.length) : options.bytes === Array ? Array.prototype.slice.call(message.body) : message.body; + return object; + }; + + /** + * Converts this HttpCheck to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @instance + * @returns {Object.} JSON object + */ + HttpCheck.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HttpCheck + * @function getTypeUrl + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpCheck.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UptimeCheckConfig.HttpCheck"; + }; + + HttpCheck.BasicAuthentication = (function() { + + /** + * Properties of a BasicAuthentication. + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @interface IBasicAuthentication + * @property {string|null} [username] BasicAuthentication username + * @property {string|null} [password] BasicAuthentication password + */ + + /** + * Constructs a new BasicAuthentication. + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck + * @classdesc Represents a BasicAuthentication. + * @implements IBasicAuthentication + * @constructor + * @param {google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication=} [properties] Properties to set + */ + function BasicAuthentication(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]]; + } + + /** + * BasicAuthentication username. + * @member {string} username + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @instance + */ + BasicAuthentication.prototype.username = ""; + + /** + * BasicAuthentication password. + * @member {string} password + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @instance + */ + BasicAuthentication.prototype.password = ""; + + /** + * Creates a new BasicAuthentication instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication=} [properties] Properties to set + * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication} BasicAuthentication instance + */ + BasicAuthentication.create = function create(properties) { + return new BasicAuthentication(properties); + }; + + /** + * Encodes the specified BasicAuthentication message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication} message BasicAuthentication message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BasicAuthentication.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.password); + return writer; + }; + + /** + * Encodes the specified BasicAuthentication message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.HttpCheck.IBasicAuthentication} message BasicAuthentication message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BasicAuthentication.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BasicAuthentication message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication} BasicAuthentication + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BasicAuthentication.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.username = reader.string(); + break; + } + case 2: { + message.password = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BasicAuthentication message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication} BasicAuthentication + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BasicAuthentication.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BasicAuthentication message. + * @function verify + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BasicAuthentication.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + return null; + }; + + /** + * Creates a BasicAuthentication message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication} BasicAuthentication + */ + BasicAuthentication.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication) + return object; + var message = new $root.google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication(); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + return message; + }; + + /** + * Creates a plain object from a BasicAuthentication message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication} message BasicAuthentication + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BasicAuthentication.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.username = ""; + object.password = ""; + } + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + return object; + }; + + /** + * Converts this BasicAuthentication to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @instance + * @returns {Object.} JSON object + */ + BasicAuthentication.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BasicAuthentication + * @function getTypeUrl + * @memberof google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BasicAuthentication.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UptimeCheckConfig.HttpCheck.BasicAuthentication"; + }; + + return BasicAuthentication; + })(); + + /** + * RequestMethod enum. + * @name google.monitoring.v3.UptimeCheckConfig.HttpCheck.RequestMethod + * @enum {number} + * @property {number} METHOD_UNSPECIFIED=0 METHOD_UNSPECIFIED value + * @property {number} GET=1 GET value + * @property {number} POST=2 POST value + */ + HttpCheck.RequestMethod = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "METHOD_UNSPECIFIED"] = 0; + values[valuesById[1] = "GET"] = 1; + values[valuesById[2] = "POST"] = 2; + return values; + })(); + + /** + * ContentType enum. + * @name google.monitoring.v3.UptimeCheckConfig.HttpCheck.ContentType + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} URL_ENCODED=1 URL_ENCODED value + */ + HttpCheck.ContentType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "URL_ENCODED"] = 1; + return values; + })(); + + return HttpCheck; + })(); + + UptimeCheckConfig.TcpCheck = (function() { + + /** + * Properties of a TcpCheck. + * @memberof google.monitoring.v3.UptimeCheckConfig + * @interface ITcpCheck + * @property {number|null} [port] TcpCheck port + */ + + /** + * Constructs a new TcpCheck. + * @memberof google.monitoring.v3.UptimeCheckConfig + * @classdesc Represents a TcpCheck. + * @implements ITcpCheck + * @constructor + * @param {google.monitoring.v3.UptimeCheckConfig.ITcpCheck=} [properties] Properties to set + */ + function TcpCheck(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]]; + } + + /** + * TcpCheck port. + * @member {number} port + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @instance + */ + TcpCheck.prototype.port = 0; + + /** + * Creates a new TcpCheck instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.ITcpCheck=} [properties] Properties to set + * @returns {google.monitoring.v3.UptimeCheckConfig.TcpCheck} TcpCheck instance + */ + TcpCheck.create = function create(properties) { + return new TcpCheck(properties); + }; + + /** + * Encodes the specified TcpCheck message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.TcpCheck.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.ITcpCheck} message TcpCheck message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TcpCheck.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.port != null && Object.hasOwnProperty.call(message, "port")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.port); + return writer; + }; + + /** + * Encodes the specified TcpCheck message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.TcpCheck.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.ITcpCheck} message TcpCheck message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TcpCheck.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TcpCheck message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UptimeCheckConfig.TcpCheck} TcpCheck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TcpCheck.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.port = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TcpCheck message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UptimeCheckConfig.TcpCheck} TcpCheck + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TcpCheck.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TcpCheck message. + * @function verify + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TcpCheck.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.port != null && message.hasOwnProperty("port")) + if (!$util.isInteger(message.port)) + return "port: integer expected"; + return null; + }; + + /** + * Creates a TcpCheck message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UptimeCheckConfig.TcpCheck} TcpCheck + */ + TcpCheck.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck) + return object; + var message = new $root.google.monitoring.v3.UptimeCheckConfig.TcpCheck(); + if (object.port != null) + message.port = object.port | 0; + return message; + }; + + /** + * Creates a plain object from a TcpCheck message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.TcpCheck} message TcpCheck + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TcpCheck.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.port = 0; + if (message.port != null && message.hasOwnProperty("port")) + object.port = message.port; + return object; + }; + + /** + * Converts this TcpCheck to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @instance + * @returns {Object.} JSON object + */ + TcpCheck.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TcpCheck + * @function getTypeUrl + * @memberof google.monitoring.v3.UptimeCheckConfig.TcpCheck + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TcpCheck.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UptimeCheckConfig.TcpCheck"; + }; + + return TcpCheck; + })(); + + UptimeCheckConfig.ContentMatcher = (function() { + + /** + * Properties of a ContentMatcher. + * @memberof google.monitoring.v3.UptimeCheckConfig + * @interface IContentMatcher + * @property {string|null} [content] ContentMatcher content + * @property {google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption|null} [matcher] ContentMatcher matcher + */ + + /** + * Constructs a new ContentMatcher. + * @memberof google.monitoring.v3.UptimeCheckConfig + * @classdesc Represents a ContentMatcher. + * @implements IContentMatcher + * @constructor + * @param {google.monitoring.v3.UptimeCheckConfig.IContentMatcher=} [properties] Properties to set + */ + function ContentMatcher(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]]; + } + + /** + * ContentMatcher content. + * @member {string} content + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @instance + */ + ContentMatcher.prototype.content = ""; + + /** + * ContentMatcher matcher. + * @member {google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption} matcher + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @instance + */ + ContentMatcher.prototype.matcher = 0; + + /** + * Creates a new ContentMatcher instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IContentMatcher=} [properties] Properties to set + * @returns {google.monitoring.v3.UptimeCheckConfig.ContentMatcher} ContentMatcher instance + */ + ContentMatcher.create = function create(properties) { + return new ContentMatcher(properties); + }; + + /** + * Encodes the specified ContentMatcher message. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.ContentMatcher.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IContentMatcher} message ContentMatcher message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContentMatcher.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.content); + if (message.matcher != null && Object.hasOwnProperty.call(message, "matcher")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.matcher); + return writer; + }; + + /** + * Encodes the specified ContentMatcher message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckConfig.ContentMatcher.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.IContentMatcher} message ContentMatcher message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContentMatcher.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContentMatcher message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UptimeCheckConfig.ContentMatcher} ContentMatcher + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContentMatcher.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.content = reader.string(); + break; + } + case 2: { + message.matcher = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContentMatcher message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UptimeCheckConfig.ContentMatcher} ContentMatcher + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContentMatcher.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContentMatcher message. + * @function verify + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContentMatcher.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; + if (message.matcher != null && message.hasOwnProperty("matcher")) + switch (message.matcher) { + default: + return "matcher: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a ContentMatcher message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UptimeCheckConfig.ContentMatcher} ContentMatcher + */ + ContentMatcher.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher) + return object; + var message = new $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher(); + if (object.content != null) + message.content = String(object.content); + switch (object.matcher) { + default: + if (typeof object.matcher === "number") { + message.matcher = object.matcher; + break; + } + break; + case "CONTENT_MATCHER_OPTION_UNSPECIFIED": + case 0: + message.matcher = 0; + break; + case "CONTAINS_STRING": + case 1: + message.matcher = 1; + break; + case "NOT_CONTAINS_STRING": + case 2: + message.matcher = 2; + break; + case "MATCHES_REGEX": + case 3: + message.matcher = 3; + break; + case "NOT_MATCHES_REGEX": + case 4: + message.matcher = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a ContentMatcher message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {google.monitoring.v3.UptimeCheckConfig.ContentMatcher} message ContentMatcher + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContentMatcher.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.content = ""; + object.matcher = options.enums === String ? "CONTENT_MATCHER_OPTION_UNSPECIFIED" : 0; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; + if (message.matcher != null && message.hasOwnProperty("matcher")) + object.matcher = options.enums === String ? $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption[message.matcher] === undefined ? message.matcher : $root.google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption[message.matcher] : message.matcher; + return object; + }; + + /** + * Converts this ContentMatcher to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @instance + * @returns {Object.} JSON object + */ + ContentMatcher.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ContentMatcher + * @function getTypeUrl + * @memberof google.monitoring.v3.UptimeCheckConfig.ContentMatcher + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ContentMatcher.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UptimeCheckConfig.ContentMatcher"; + }; + + /** + * ContentMatcherOption enum. + * @name google.monitoring.v3.UptimeCheckConfig.ContentMatcher.ContentMatcherOption + * @enum {number} + * @property {number} CONTENT_MATCHER_OPTION_UNSPECIFIED=0 CONTENT_MATCHER_OPTION_UNSPECIFIED value + * @property {number} CONTAINS_STRING=1 CONTAINS_STRING value + * @property {number} NOT_CONTAINS_STRING=2 NOT_CONTAINS_STRING value + * @property {number} MATCHES_REGEX=3 MATCHES_REGEX value + * @property {number} NOT_MATCHES_REGEX=4 NOT_MATCHES_REGEX value + */ + ContentMatcher.ContentMatcherOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONTENT_MATCHER_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "CONTAINS_STRING"] = 1; + values[valuesById[2] = "NOT_CONTAINS_STRING"] = 2; + values[valuesById[3] = "MATCHES_REGEX"] = 3; + values[valuesById[4] = "NOT_MATCHES_REGEX"] = 4; + return values; + })(); + + return ContentMatcher; + })(); + + return UptimeCheckConfig; + })(); + + v3.UptimeCheckIp = (function() { + + /** + * Properties of an UptimeCheckIp. + * @memberof google.monitoring.v3 + * @interface IUptimeCheckIp + * @property {google.monitoring.v3.UptimeCheckRegion|null} [region] UptimeCheckIp region + * @property {string|null} [location] UptimeCheckIp location + * @property {string|null} [ipAddress] UptimeCheckIp ipAddress + */ + + /** + * Constructs a new UptimeCheckIp. + * @memberof google.monitoring.v3 + * @classdesc Represents an UptimeCheckIp. + * @implements IUptimeCheckIp + * @constructor + * @param {google.monitoring.v3.IUptimeCheckIp=} [properties] Properties to set + */ + function UptimeCheckIp(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]]; + } + + /** + * UptimeCheckIp region. + * @member {google.monitoring.v3.UptimeCheckRegion} region + * @memberof google.monitoring.v3.UptimeCheckIp + * @instance + */ + UptimeCheckIp.prototype.region = 0; + + /** + * UptimeCheckIp location. + * @member {string} location + * @memberof google.monitoring.v3.UptimeCheckIp + * @instance + */ + UptimeCheckIp.prototype.location = ""; + + /** + * UptimeCheckIp ipAddress. + * @member {string} ipAddress + * @memberof google.monitoring.v3.UptimeCheckIp + * @instance + */ + UptimeCheckIp.prototype.ipAddress = ""; + + /** + * Creates a new UptimeCheckIp instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {google.monitoring.v3.IUptimeCheckIp=} [properties] Properties to set + * @returns {google.monitoring.v3.UptimeCheckIp} UptimeCheckIp instance + */ + UptimeCheckIp.create = function create(properties) { + return new UptimeCheckIp(properties); + }; + + /** + * Encodes the specified UptimeCheckIp message. Does not implicitly {@link google.monitoring.v3.UptimeCheckIp.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {google.monitoring.v3.IUptimeCheckIp} message UptimeCheckIp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UptimeCheckIp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.region); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.location); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.ipAddress); + return writer; + }; + + /** + * Encodes the specified UptimeCheckIp message, length delimited. Does not implicitly {@link google.monitoring.v3.UptimeCheckIp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {google.monitoring.v3.IUptimeCheckIp} message UptimeCheckIp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UptimeCheckIp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UptimeCheckIp message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UptimeCheckIp} UptimeCheckIp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UptimeCheckIp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UptimeCheckIp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.region = reader.int32(); + break; + } + case 2: { + message.location = reader.string(); + break; + } + case 3: { + message.ipAddress = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UptimeCheckIp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UptimeCheckIp} UptimeCheckIp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UptimeCheckIp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UptimeCheckIp message. + * @function verify + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UptimeCheckIp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.region != null && message.hasOwnProperty("region")) + switch (message.region) { + default: + return "region: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + return null; + }; + + /** + * Creates an UptimeCheckIp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UptimeCheckIp} UptimeCheckIp + */ + UptimeCheckIp.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UptimeCheckIp) + return object; + var message = new $root.google.monitoring.v3.UptimeCheckIp(); + switch (object.region) { + default: + if (typeof object.region === "number") { + message.region = object.region; + break; + } + break; + case "REGION_UNSPECIFIED": + case 0: + message.region = 0; + break; + case "USA": + case 1: + message.region = 1; + break; + case "EUROPE": + case 2: + message.region = 2; + break; + case "SOUTH_AMERICA": + case 3: + message.region = 3; + break; + case "ASIA_PACIFIC": + case 4: + message.region = 4; + break; + } + if (object.location != null) + message.location = String(object.location); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + return message; + }; + + /** + * Creates a plain object from an UptimeCheckIp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {google.monitoring.v3.UptimeCheckIp} message UptimeCheckIp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UptimeCheckIp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.region = options.enums === String ? "REGION_UNSPECIFIED" : 0; + object.location = ""; + object.ipAddress = ""; + } + if (message.region != null && message.hasOwnProperty("region")) + object.region = options.enums === String ? $root.google.monitoring.v3.UptimeCheckRegion[message.region] === undefined ? message.region : $root.google.monitoring.v3.UptimeCheckRegion[message.region] : message.region; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + return object; + }; + + /** + * Converts this UptimeCheckIp to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UptimeCheckIp + * @instance + * @returns {Object.} JSON object + */ + UptimeCheckIp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UptimeCheckIp + * @function getTypeUrl + * @memberof google.monitoring.v3.UptimeCheckIp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UptimeCheckIp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UptimeCheckIp"; + }; + + return UptimeCheckIp; + })(); + + /** + * GroupResourceType enum. + * @name google.monitoring.v3.GroupResourceType + * @enum {number} + * @property {number} RESOURCE_TYPE_UNSPECIFIED=0 RESOURCE_TYPE_UNSPECIFIED value + * @property {number} INSTANCE=1 INSTANCE value + * @property {number} AWS_ELB_LOAD_BALANCER=2 AWS_ELB_LOAD_BALANCER value + */ + v3.GroupResourceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESOURCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INSTANCE"] = 1; + values[valuesById[2] = "AWS_ELB_LOAD_BALANCER"] = 2; + return values; + })(); + + v3.UptimeCheckService = (function() { + + /** + * Constructs a new UptimeCheckService service. + * @memberof google.monitoring.v3 + * @classdesc Represents an UptimeCheckService + * @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 UptimeCheckService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (UptimeCheckService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = UptimeCheckService; + + /** + * Creates new UptimeCheckService service using the specified rpc implementation. + * @function create + * @memberof google.monitoring.v3.UptimeCheckService + * @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 {UptimeCheckService} RPC service. Useful where requests and/or responses are streamed. + */ + UptimeCheckService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|listUptimeCheckConfigs}. + * @memberof google.monitoring.v3.UptimeCheckService + * @typedef ListUptimeCheckConfigsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListUptimeCheckConfigsResponse} [response] ListUptimeCheckConfigsResponse + */ + + /** + * Calls ListUptimeCheckConfigs. + * @function listUptimeCheckConfigs + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IListUptimeCheckConfigsRequest} request ListUptimeCheckConfigsRequest message or plain object + * @param {google.monitoring.v3.UptimeCheckService.ListUptimeCheckConfigsCallback} callback Node-style callback called with the error, if any, and ListUptimeCheckConfigsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UptimeCheckService.prototype.listUptimeCheckConfigs = function listUptimeCheckConfigs(request, callback) { + return this.rpcCall(listUptimeCheckConfigs, $root.google.monitoring.v3.ListUptimeCheckConfigsRequest, $root.google.monitoring.v3.ListUptimeCheckConfigsResponse, request, callback); + }, "name", { value: "ListUptimeCheckConfigs" }); + + /** + * Calls ListUptimeCheckConfigs. + * @function listUptimeCheckConfigs + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IListUptimeCheckConfigsRequest} request ListUptimeCheckConfigsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|getUptimeCheckConfig}. + * @memberof google.monitoring.v3.UptimeCheckService + * @typedef GetUptimeCheckConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.UptimeCheckConfig} [response] UptimeCheckConfig + */ + + /** + * Calls GetUptimeCheckConfig. + * @function getUptimeCheckConfig + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IGetUptimeCheckConfigRequest} request GetUptimeCheckConfigRequest message or plain object + * @param {google.monitoring.v3.UptimeCheckService.GetUptimeCheckConfigCallback} callback Node-style callback called with the error, if any, and UptimeCheckConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UptimeCheckService.prototype.getUptimeCheckConfig = function getUptimeCheckConfig(request, callback) { + return this.rpcCall(getUptimeCheckConfig, $root.google.monitoring.v3.GetUptimeCheckConfigRequest, $root.google.monitoring.v3.UptimeCheckConfig, request, callback); + }, "name", { value: "GetUptimeCheckConfig" }); + + /** + * Calls GetUptimeCheckConfig. + * @function getUptimeCheckConfig + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IGetUptimeCheckConfigRequest} request GetUptimeCheckConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|createUptimeCheckConfig}. + * @memberof google.monitoring.v3.UptimeCheckService + * @typedef CreateUptimeCheckConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.UptimeCheckConfig} [response] UptimeCheckConfig + */ + + /** + * Calls CreateUptimeCheckConfig. + * @function createUptimeCheckConfig + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.ICreateUptimeCheckConfigRequest} request CreateUptimeCheckConfigRequest message or plain object + * @param {google.monitoring.v3.UptimeCheckService.CreateUptimeCheckConfigCallback} callback Node-style callback called with the error, if any, and UptimeCheckConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UptimeCheckService.prototype.createUptimeCheckConfig = function createUptimeCheckConfig(request, callback) { + return this.rpcCall(createUptimeCheckConfig, $root.google.monitoring.v3.CreateUptimeCheckConfigRequest, $root.google.monitoring.v3.UptimeCheckConfig, request, callback); + }, "name", { value: "CreateUptimeCheckConfig" }); + + /** + * Calls CreateUptimeCheckConfig. + * @function createUptimeCheckConfig + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.ICreateUptimeCheckConfigRequest} request CreateUptimeCheckConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|updateUptimeCheckConfig}. + * @memberof google.monitoring.v3.UptimeCheckService + * @typedef UpdateUptimeCheckConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.UptimeCheckConfig} [response] UptimeCheckConfig + */ + + /** + * Calls UpdateUptimeCheckConfig. + * @function updateUptimeCheckConfig + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IUpdateUptimeCheckConfigRequest} request UpdateUptimeCheckConfigRequest message or plain object + * @param {google.monitoring.v3.UptimeCheckService.UpdateUptimeCheckConfigCallback} callback Node-style callback called with the error, if any, and UptimeCheckConfig + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UptimeCheckService.prototype.updateUptimeCheckConfig = function updateUptimeCheckConfig(request, callback) { + return this.rpcCall(updateUptimeCheckConfig, $root.google.monitoring.v3.UpdateUptimeCheckConfigRequest, $root.google.monitoring.v3.UptimeCheckConfig, request, callback); + }, "name", { value: "UpdateUptimeCheckConfig" }); + + /** + * Calls UpdateUptimeCheckConfig. + * @function updateUptimeCheckConfig + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IUpdateUptimeCheckConfigRequest} request UpdateUptimeCheckConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|deleteUptimeCheckConfig}. + * @memberof google.monitoring.v3.UptimeCheckService + * @typedef DeleteUptimeCheckConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteUptimeCheckConfig. + * @function deleteUptimeCheckConfig + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IDeleteUptimeCheckConfigRequest} request DeleteUptimeCheckConfigRequest message or plain object + * @param {google.monitoring.v3.UptimeCheckService.DeleteUptimeCheckConfigCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UptimeCheckService.prototype.deleteUptimeCheckConfig = function deleteUptimeCheckConfig(request, callback) { + return this.rpcCall(deleteUptimeCheckConfig, $root.google.monitoring.v3.DeleteUptimeCheckConfigRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteUptimeCheckConfig" }); + + /** + * Calls DeleteUptimeCheckConfig. + * @function deleteUptimeCheckConfig + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IDeleteUptimeCheckConfigRequest} request DeleteUptimeCheckConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.monitoring.v3.UptimeCheckService|listUptimeCheckIps}. + * @memberof google.monitoring.v3.UptimeCheckService + * @typedef ListUptimeCheckIpsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.monitoring.v3.ListUptimeCheckIpsResponse} [response] ListUptimeCheckIpsResponse + */ + + /** + * Calls ListUptimeCheckIps. + * @function listUptimeCheckIps + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IListUptimeCheckIpsRequest} request ListUptimeCheckIpsRequest message or plain object + * @param {google.monitoring.v3.UptimeCheckService.ListUptimeCheckIpsCallback} callback Node-style callback called with the error, if any, and ListUptimeCheckIpsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(UptimeCheckService.prototype.listUptimeCheckIps = function listUptimeCheckIps(request, callback) { + return this.rpcCall(listUptimeCheckIps, $root.google.monitoring.v3.ListUptimeCheckIpsRequest, $root.google.monitoring.v3.ListUptimeCheckIpsResponse, request, callback); + }, "name", { value: "ListUptimeCheckIps" }); + + /** + * Calls ListUptimeCheckIps. + * @function listUptimeCheckIps + * @memberof google.monitoring.v3.UptimeCheckService + * @instance + * @param {google.monitoring.v3.IListUptimeCheckIpsRequest} request ListUptimeCheckIpsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return UptimeCheckService; + })(); + + v3.ListUptimeCheckConfigsRequest = (function() { + + /** + * Properties of a ListUptimeCheckConfigsRequest. + * @memberof google.monitoring.v3 + * @interface IListUptimeCheckConfigsRequest + * @property {string|null} [parent] ListUptimeCheckConfigsRequest parent + * @property {number|null} [pageSize] ListUptimeCheckConfigsRequest pageSize + * @property {string|null} [pageToken] ListUptimeCheckConfigsRequest pageToken + */ + + /** + * Constructs a new ListUptimeCheckConfigsRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListUptimeCheckConfigsRequest. + * @implements IListUptimeCheckConfigsRequest + * @constructor + * @param {google.monitoring.v3.IListUptimeCheckConfigsRequest=} [properties] Properties to set + */ + function ListUptimeCheckConfigsRequest(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]]; + } + + /** + * ListUptimeCheckConfigsRequest parent. + * @member {string} parent + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @instance + */ + ListUptimeCheckConfigsRequest.prototype.parent = ""; + + /** + * ListUptimeCheckConfigsRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @instance + */ + ListUptimeCheckConfigsRequest.prototype.pageSize = 0; + + /** + * ListUptimeCheckConfigsRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @instance + */ + ListUptimeCheckConfigsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListUptimeCheckConfigsRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {google.monitoring.v3.IListUptimeCheckConfigsRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListUptimeCheckConfigsRequest} ListUptimeCheckConfigsRequest instance + */ + ListUptimeCheckConfigsRequest.create = function create(properties) { + return new ListUptimeCheckConfigsRequest(properties); + }; + + /** + * Encodes the specified ListUptimeCheckConfigsRequest message. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckConfigsRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {google.monitoring.v3.IListUptimeCheckConfigsRequest} message ListUptimeCheckConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUptimeCheckConfigsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListUptimeCheckConfigsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckConfigsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {google.monitoring.v3.IListUptimeCheckConfigsRequest} message ListUptimeCheckConfigsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUptimeCheckConfigsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListUptimeCheckConfigsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListUptimeCheckConfigsRequest} ListUptimeCheckConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUptimeCheckConfigsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListUptimeCheckConfigsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListUptimeCheckConfigsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListUptimeCheckConfigsRequest} ListUptimeCheckConfigsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUptimeCheckConfigsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListUptimeCheckConfigsRequest message. + * @function verify + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListUptimeCheckConfigsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListUptimeCheckConfigsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListUptimeCheckConfigsRequest} ListUptimeCheckConfigsRequest + */ + ListUptimeCheckConfigsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListUptimeCheckConfigsRequest) + return object; + var message = new $root.google.monitoring.v3.ListUptimeCheckConfigsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListUptimeCheckConfigsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {google.monitoring.v3.ListUptimeCheckConfigsRequest} message ListUptimeCheckConfigsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListUptimeCheckConfigsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListUptimeCheckConfigsRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @instance + * @returns {Object.} JSON object + */ + ListUptimeCheckConfigsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListUptimeCheckConfigsRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListUptimeCheckConfigsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListUptimeCheckConfigsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListUptimeCheckConfigsRequest"; + }; + + return ListUptimeCheckConfigsRequest; + })(); + + v3.ListUptimeCheckConfigsResponse = (function() { + + /** + * Properties of a ListUptimeCheckConfigsResponse. + * @memberof google.monitoring.v3 + * @interface IListUptimeCheckConfigsResponse + * @property {Array.|null} [uptimeCheckConfigs] ListUptimeCheckConfigsResponse uptimeCheckConfigs + * @property {string|null} [nextPageToken] ListUptimeCheckConfigsResponse nextPageToken + * @property {number|null} [totalSize] ListUptimeCheckConfigsResponse totalSize + */ + + /** + * Constructs a new ListUptimeCheckConfigsResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListUptimeCheckConfigsResponse. + * @implements IListUptimeCheckConfigsResponse + * @constructor + * @param {google.monitoring.v3.IListUptimeCheckConfigsResponse=} [properties] Properties to set + */ + function ListUptimeCheckConfigsResponse(properties) { + this.uptimeCheckConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListUptimeCheckConfigsResponse uptimeCheckConfigs. + * @member {Array.} uptimeCheckConfigs + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @instance + */ + ListUptimeCheckConfigsResponse.prototype.uptimeCheckConfigs = $util.emptyArray; + + /** + * ListUptimeCheckConfigsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @instance + */ + ListUptimeCheckConfigsResponse.prototype.nextPageToken = ""; + + /** + * ListUptimeCheckConfigsResponse totalSize. + * @member {number} totalSize + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @instance + */ + ListUptimeCheckConfigsResponse.prototype.totalSize = 0; + + /** + * Creates a new ListUptimeCheckConfigsResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {google.monitoring.v3.IListUptimeCheckConfigsResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListUptimeCheckConfigsResponse} ListUptimeCheckConfigsResponse instance + */ + ListUptimeCheckConfigsResponse.create = function create(properties) { + return new ListUptimeCheckConfigsResponse(properties); + }; + + /** + * Encodes the specified ListUptimeCheckConfigsResponse message. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckConfigsResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {google.monitoring.v3.IListUptimeCheckConfigsResponse} message ListUptimeCheckConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUptimeCheckConfigsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uptimeCheckConfigs != null && message.uptimeCheckConfigs.length) + for (var i = 0; i < message.uptimeCheckConfigs.length; ++i) + $root.google.monitoring.v3.UptimeCheckConfig.encode(message.uptimeCheckConfigs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + return writer; + }; + + /** + * Encodes the specified ListUptimeCheckConfigsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckConfigsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {google.monitoring.v3.IListUptimeCheckConfigsResponse} message ListUptimeCheckConfigsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUptimeCheckConfigsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListUptimeCheckConfigsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListUptimeCheckConfigsResponse} ListUptimeCheckConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUptimeCheckConfigsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListUptimeCheckConfigsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.uptimeCheckConfigs && message.uptimeCheckConfigs.length)) + message.uptimeCheckConfigs = []; + message.uptimeCheckConfigs.push($root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + message.totalSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListUptimeCheckConfigsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListUptimeCheckConfigsResponse} ListUptimeCheckConfigsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUptimeCheckConfigsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListUptimeCheckConfigsResponse message. + * @function verify + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListUptimeCheckConfigsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uptimeCheckConfigs != null && message.hasOwnProperty("uptimeCheckConfigs")) { + if (!Array.isArray(message.uptimeCheckConfigs)) + return "uptimeCheckConfigs: array expected"; + for (var i = 0; i < message.uptimeCheckConfigs.length; ++i) { + var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfigs[i]); + if (error) + return "uptimeCheckConfigs." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + return null; + }; + + /** + * Creates a ListUptimeCheckConfigsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListUptimeCheckConfigsResponse} ListUptimeCheckConfigsResponse + */ + ListUptimeCheckConfigsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListUptimeCheckConfigsResponse) + return object; + var message = new $root.google.monitoring.v3.ListUptimeCheckConfigsResponse(); + if (object.uptimeCheckConfigs) { + if (!Array.isArray(object.uptimeCheckConfigs)) + throw TypeError(".google.monitoring.v3.ListUptimeCheckConfigsResponse.uptimeCheckConfigs: array expected"); + message.uptimeCheckConfigs = []; + for (var i = 0; i < object.uptimeCheckConfigs.length; ++i) { + if (typeof object.uptimeCheckConfigs[i] !== "object") + throw TypeError(".google.monitoring.v3.ListUptimeCheckConfigsResponse.uptimeCheckConfigs: object expected"); + message.uptimeCheckConfigs[i] = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfigs[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListUptimeCheckConfigsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {google.monitoring.v3.ListUptimeCheckConfigsResponse} message ListUptimeCheckConfigsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListUptimeCheckConfigsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uptimeCheckConfigs = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.uptimeCheckConfigs && message.uptimeCheckConfigs.length) { + object.uptimeCheckConfigs = []; + for (var j = 0; j < message.uptimeCheckConfigs.length; ++j) + object.uptimeCheckConfigs[j] = $root.google.monitoring.v3.UptimeCheckConfig.toObject(message.uptimeCheckConfigs[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + return object; + }; + + /** + * Converts this ListUptimeCheckConfigsResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @instance + * @returns {Object.} JSON object + */ + ListUptimeCheckConfigsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListUptimeCheckConfigsResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListUptimeCheckConfigsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListUptimeCheckConfigsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListUptimeCheckConfigsResponse"; + }; + + return ListUptimeCheckConfigsResponse; + })(); + + v3.GetUptimeCheckConfigRequest = (function() { + + /** + * Properties of a GetUptimeCheckConfigRequest. + * @memberof google.monitoring.v3 + * @interface IGetUptimeCheckConfigRequest + * @property {string|null} [name] GetUptimeCheckConfigRequest name + */ + + /** + * Constructs a new GetUptimeCheckConfigRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a GetUptimeCheckConfigRequest. + * @implements IGetUptimeCheckConfigRequest + * @constructor + * @param {google.monitoring.v3.IGetUptimeCheckConfigRequest=} [properties] Properties to set + */ + function GetUptimeCheckConfigRequest(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]]; + } + + /** + * GetUptimeCheckConfigRequest name. + * @member {string} name + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @instance + */ + GetUptimeCheckConfigRequest.prototype.name = ""; + + /** + * Creates a new GetUptimeCheckConfigRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IGetUptimeCheckConfigRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.GetUptimeCheckConfigRequest} GetUptimeCheckConfigRequest instance + */ + GetUptimeCheckConfigRequest.create = function create(properties) { + return new GetUptimeCheckConfigRequest(properties); + }; + + /** + * Encodes the specified GetUptimeCheckConfigRequest message. Does not implicitly {@link google.monitoring.v3.GetUptimeCheckConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IGetUptimeCheckConfigRequest} message GetUptimeCheckConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetUptimeCheckConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetUptimeCheckConfigRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.GetUptimeCheckConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IGetUptimeCheckConfigRequest} message GetUptimeCheckConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetUptimeCheckConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetUptimeCheckConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.GetUptimeCheckConfigRequest} GetUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetUptimeCheckConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.GetUptimeCheckConfigRequest(); + 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 GetUptimeCheckConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.GetUptimeCheckConfigRequest} GetUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetUptimeCheckConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetUptimeCheckConfigRequest message. + * @function verify + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetUptimeCheckConfigRequest.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 GetUptimeCheckConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.GetUptimeCheckConfigRequest} GetUptimeCheckConfigRequest + */ + GetUptimeCheckConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.GetUptimeCheckConfigRequest) + return object; + var message = new $root.google.monitoring.v3.GetUptimeCheckConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetUptimeCheckConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.GetUptimeCheckConfigRequest} message GetUptimeCheckConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetUptimeCheckConfigRequest.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 GetUptimeCheckConfigRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @instance + * @returns {Object.} JSON object + */ + GetUptimeCheckConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetUptimeCheckConfigRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.GetUptimeCheckConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetUptimeCheckConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.GetUptimeCheckConfigRequest"; + }; + + return GetUptimeCheckConfigRequest; + })(); + + v3.CreateUptimeCheckConfigRequest = (function() { + + /** + * Properties of a CreateUptimeCheckConfigRequest. + * @memberof google.monitoring.v3 + * @interface ICreateUptimeCheckConfigRequest + * @property {string|null} [parent] CreateUptimeCheckConfigRequest parent + * @property {google.monitoring.v3.IUptimeCheckConfig|null} [uptimeCheckConfig] CreateUptimeCheckConfigRequest uptimeCheckConfig + */ + + /** + * Constructs a new CreateUptimeCheckConfigRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a CreateUptimeCheckConfigRequest. + * @implements ICreateUptimeCheckConfigRequest + * @constructor + * @param {google.monitoring.v3.ICreateUptimeCheckConfigRequest=} [properties] Properties to set + */ + function CreateUptimeCheckConfigRequest(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]]; + } + + /** + * CreateUptimeCheckConfigRequest parent. + * @member {string} parent + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @instance + */ + CreateUptimeCheckConfigRequest.prototype.parent = ""; + + /** + * CreateUptimeCheckConfigRequest uptimeCheckConfig. + * @member {google.monitoring.v3.IUptimeCheckConfig|null|undefined} uptimeCheckConfig + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @instance + */ + CreateUptimeCheckConfigRequest.prototype.uptimeCheckConfig = null; + + /** + * Creates a new CreateUptimeCheckConfigRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.ICreateUptimeCheckConfigRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.CreateUptimeCheckConfigRequest} CreateUptimeCheckConfigRequest instance + */ + CreateUptimeCheckConfigRequest.create = function create(properties) { + return new CreateUptimeCheckConfigRequest(properties); + }; + + /** + * Encodes the specified CreateUptimeCheckConfigRequest message. Does not implicitly {@link google.monitoring.v3.CreateUptimeCheckConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.ICreateUptimeCheckConfigRequest} message CreateUptimeCheckConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateUptimeCheckConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.uptimeCheckConfig != null && Object.hasOwnProperty.call(message, "uptimeCheckConfig")) + $root.google.monitoring.v3.UptimeCheckConfig.encode(message.uptimeCheckConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateUptimeCheckConfigRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.CreateUptimeCheckConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.ICreateUptimeCheckConfigRequest} message CreateUptimeCheckConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateUptimeCheckConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateUptimeCheckConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.CreateUptimeCheckConfigRequest} CreateUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateUptimeCheckConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.CreateUptimeCheckConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateUptimeCheckConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.CreateUptimeCheckConfigRequest} CreateUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateUptimeCheckConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateUptimeCheckConfigRequest message. + * @function verify + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateUptimeCheckConfigRequest.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.uptimeCheckConfig != null && message.hasOwnProperty("uptimeCheckConfig")) { + var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfig); + if (error) + return "uptimeCheckConfig." + error; + } + return null; + }; + + /** + * Creates a CreateUptimeCheckConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.CreateUptimeCheckConfigRequest} CreateUptimeCheckConfigRequest + */ + CreateUptimeCheckConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.CreateUptimeCheckConfigRequest) + return object; + var message = new $root.google.monitoring.v3.CreateUptimeCheckConfigRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.uptimeCheckConfig != null) { + if (typeof object.uptimeCheckConfig !== "object") + throw TypeError(".google.monitoring.v3.CreateUptimeCheckConfigRequest.uptimeCheckConfig: object expected"); + message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfig); + } + return message; + }; + + /** + * Creates a plain object from a CreateUptimeCheckConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.CreateUptimeCheckConfigRequest} message CreateUptimeCheckConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateUptimeCheckConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.uptimeCheckConfig = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.uptimeCheckConfig != null && message.hasOwnProperty("uptimeCheckConfig")) + object.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.toObject(message.uptimeCheckConfig, options); + return object; + }; + + /** + * Converts this CreateUptimeCheckConfigRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @instance + * @returns {Object.} JSON object + */ + CreateUptimeCheckConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateUptimeCheckConfigRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.CreateUptimeCheckConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateUptimeCheckConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.CreateUptimeCheckConfigRequest"; + }; + + return CreateUptimeCheckConfigRequest; + })(); + + v3.UpdateUptimeCheckConfigRequest = (function() { + + /** + * Properties of an UpdateUptimeCheckConfigRequest. + * @memberof google.monitoring.v3 + * @interface IUpdateUptimeCheckConfigRequest + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateUptimeCheckConfigRequest updateMask + * @property {google.monitoring.v3.IUptimeCheckConfig|null} [uptimeCheckConfig] UpdateUptimeCheckConfigRequest uptimeCheckConfig + */ + + /** + * Constructs a new UpdateUptimeCheckConfigRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents an UpdateUptimeCheckConfigRequest. + * @implements IUpdateUptimeCheckConfigRequest + * @constructor + * @param {google.monitoring.v3.IUpdateUptimeCheckConfigRequest=} [properties] Properties to set + */ + function UpdateUptimeCheckConfigRequest(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]]; + } + + /** + * UpdateUptimeCheckConfigRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @instance + */ + UpdateUptimeCheckConfigRequest.prototype.updateMask = null; + + /** + * UpdateUptimeCheckConfigRequest uptimeCheckConfig. + * @member {google.monitoring.v3.IUptimeCheckConfig|null|undefined} uptimeCheckConfig + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @instance + */ + UpdateUptimeCheckConfigRequest.prototype.uptimeCheckConfig = null; + + /** + * Creates a new UpdateUptimeCheckConfigRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IUpdateUptimeCheckConfigRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.UpdateUptimeCheckConfigRequest} UpdateUptimeCheckConfigRequest instance + */ + UpdateUptimeCheckConfigRequest.create = function create(properties) { + return new UpdateUptimeCheckConfigRequest(properties); + }; + + /** + * Encodes the specified UpdateUptimeCheckConfigRequest message. Does not implicitly {@link google.monitoring.v3.UpdateUptimeCheckConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IUpdateUptimeCheckConfigRequest} message UpdateUptimeCheckConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateUptimeCheckConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uptimeCheckConfig != null && Object.hasOwnProperty.call(message, "uptimeCheckConfig")) + $root.google.monitoring.v3.UptimeCheckConfig.encode(message.uptimeCheckConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateUptimeCheckConfigRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.UpdateUptimeCheckConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IUpdateUptimeCheckConfigRequest} message UpdateUptimeCheckConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateUptimeCheckConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateUptimeCheckConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.UpdateUptimeCheckConfigRequest} UpdateUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateUptimeCheckConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.UpdateUptimeCheckConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateUptimeCheckConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.UpdateUptimeCheckConfigRequest} UpdateUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateUptimeCheckConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateUptimeCheckConfigRequest message. + * @function verify + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateUptimeCheckConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.uptimeCheckConfig != null && message.hasOwnProperty("uptimeCheckConfig")) { + var error = $root.google.monitoring.v3.UptimeCheckConfig.verify(message.uptimeCheckConfig); + if (error) + return "uptimeCheckConfig." + error; + } + return null; + }; + + /** + * Creates an UpdateUptimeCheckConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.UpdateUptimeCheckConfigRequest} UpdateUptimeCheckConfigRequest + */ + UpdateUptimeCheckConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.UpdateUptimeCheckConfigRequest) + return object; + var message = new $root.google.monitoring.v3.UpdateUptimeCheckConfigRequest(); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.monitoring.v3.UpdateUptimeCheckConfigRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.uptimeCheckConfig != null) { + if (typeof object.uptimeCheckConfig !== "object") + throw TypeError(".google.monitoring.v3.UpdateUptimeCheckConfigRequest.uptimeCheckConfig: object expected"); + message.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.fromObject(object.uptimeCheckConfig); + } + return message; + }; + + /** + * Creates a plain object from an UpdateUptimeCheckConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.UpdateUptimeCheckConfigRequest} message UpdateUptimeCheckConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateUptimeCheckConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.updateMask = null; + object.uptimeCheckConfig = null; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.uptimeCheckConfig != null && message.hasOwnProperty("uptimeCheckConfig")) + object.uptimeCheckConfig = $root.google.monitoring.v3.UptimeCheckConfig.toObject(message.uptimeCheckConfig, options); + return object; + }; + + /** + * Converts this UpdateUptimeCheckConfigRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateUptimeCheckConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateUptimeCheckConfigRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.UpdateUptimeCheckConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateUptimeCheckConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.UpdateUptimeCheckConfigRequest"; + }; + + return UpdateUptimeCheckConfigRequest; + })(); + + v3.DeleteUptimeCheckConfigRequest = (function() { + + /** + * Properties of a DeleteUptimeCheckConfigRequest. + * @memberof google.monitoring.v3 + * @interface IDeleteUptimeCheckConfigRequest + * @property {string|null} [name] DeleteUptimeCheckConfigRequest name + */ + + /** + * Constructs a new DeleteUptimeCheckConfigRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a DeleteUptimeCheckConfigRequest. + * @implements IDeleteUptimeCheckConfigRequest + * @constructor + * @param {google.monitoring.v3.IDeleteUptimeCheckConfigRequest=} [properties] Properties to set + */ + function DeleteUptimeCheckConfigRequest(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]]; + } + + /** + * DeleteUptimeCheckConfigRequest name. + * @member {string} name + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @instance + */ + DeleteUptimeCheckConfigRequest.prototype.name = ""; + + /** + * Creates a new DeleteUptimeCheckConfigRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IDeleteUptimeCheckConfigRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.DeleteUptimeCheckConfigRequest} DeleteUptimeCheckConfigRequest instance + */ + DeleteUptimeCheckConfigRequest.create = function create(properties) { + return new DeleteUptimeCheckConfigRequest(properties); + }; + + /** + * Encodes the specified DeleteUptimeCheckConfigRequest message. Does not implicitly {@link google.monitoring.v3.DeleteUptimeCheckConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IDeleteUptimeCheckConfigRequest} message DeleteUptimeCheckConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteUptimeCheckConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteUptimeCheckConfigRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.DeleteUptimeCheckConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.IDeleteUptimeCheckConfigRequest} message DeleteUptimeCheckConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteUptimeCheckConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteUptimeCheckConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.DeleteUptimeCheckConfigRequest} DeleteUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteUptimeCheckConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.DeleteUptimeCheckConfigRequest(); + 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 DeleteUptimeCheckConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.DeleteUptimeCheckConfigRequest} DeleteUptimeCheckConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteUptimeCheckConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteUptimeCheckConfigRequest message. + * @function verify + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteUptimeCheckConfigRequest.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 DeleteUptimeCheckConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.DeleteUptimeCheckConfigRequest} DeleteUptimeCheckConfigRequest + */ + DeleteUptimeCheckConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.DeleteUptimeCheckConfigRequest) + return object; + var message = new $root.google.monitoring.v3.DeleteUptimeCheckConfigRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteUptimeCheckConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {google.monitoring.v3.DeleteUptimeCheckConfigRequest} message DeleteUptimeCheckConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteUptimeCheckConfigRequest.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 DeleteUptimeCheckConfigRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteUptimeCheckConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteUptimeCheckConfigRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.DeleteUptimeCheckConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteUptimeCheckConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.DeleteUptimeCheckConfigRequest"; + }; + + return DeleteUptimeCheckConfigRequest; + })(); + + v3.ListUptimeCheckIpsRequest = (function() { + + /** + * Properties of a ListUptimeCheckIpsRequest. + * @memberof google.monitoring.v3 + * @interface IListUptimeCheckIpsRequest + * @property {number|null} [pageSize] ListUptimeCheckIpsRequest pageSize + * @property {string|null} [pageToken] ListUptimeCheckIpsRequest pageToken + */ + + /** + * Constructs a new ListUptimeCheckIpsRequest. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListUptimeCheckIpsRequest. + * @implements IListUptimeCheckIpsRequest + * @constructor + * @param {google.monitoring.v3.IListUptimeCheckIpsRequest=} [properties] Properties to set + */ + function ListUptimeCheckIpsRequest(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]]; + } + + /** + * ListUptimeCheckIpsRequest pageSize. + * @member {number} pageSize + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @instance + */ + ListUptimeCheckIpsRequest.prototype.pageSize = 0; + + /** + * ListUptimeCheckIpsRequest pageToken. + * @member {string} pageToken + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @instance + */ + ListUptimeCheckIpsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListUptimeCheckIpsRequest instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {google.monitoring.v3.IListUptimeCheckIpsRequest=} [properties] Properties to set + * @returns {google.monitoring.v3.ListUptimeCheckIpsRequest} ListUptimeCheckIpsRequest instance + */ + ListUptimeCheckIpsRequest.create = function create(properties) { + return new ListUptimeCheckIpsRequest(properties); + }; + + /** + * Encodes the specified ListUptimeCheckIpsRequest message. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckIpsRequest.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {google.monitoring.v3.IListUptimeCheckIpsRequest} message ListUptimeCheckIpsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUptimeCheckIpsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListUptimeCheckIpsRequest message, length delimited. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckIpsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {google.monitoring.v3.IListUptimeCheckIpsRequest} message ListUptimeCheckIpsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUptimeCheckIpsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListUptimeCheckIpsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListUptimeCheckIpsRequest} ListUptimeCheckIpsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUptimeCheckIpsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListUptimeCheckIpsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListUptimeCheckIpsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListUptimeCheckIpsRequest} ListUptimeCheckIpsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUptimeCheckIpsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListUptimeCheckIpsRequest message. + * @function verify + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListUptimeCheckIpsRequest.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 ListUptimeCheckIpsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListUptimeCheckIpsRequest} ListUptimeCheckIpsRequest + */ + ListUptimeCheckIpsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListUptimeCheckIpsRequest) + return object; + var message = new $root.google.monitoring.v3.ListUptimeCheckIpsRequest(); + 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 ListUptimeCheckIpsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {google.monitoring.v3.ListUptimeCheckIpsRequest} message ListUptimeCheckIpsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListUptimeCheckIpsRequest.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 ListUptimeCheckIpsRequest to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @instance + * @returns {Object.} JSON object + */ + ListUptimeCheckIpsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListUptimeCheckIpsRequest + * @function getTypeUrl + * @memberof google.monitoring.v3.ListUptimeCheckIpsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListUptimeCheckIpsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListUptimeCheckIpsRequest"; + }; + + return ListUptimeCheckIpsRequest; + })(); + + v3.ListUptimeCheckIpsResponse = (function() { + + /** + * Properties of a ListUptimeCheckIpsResponse. + * @memberof google.monitoring.v3 + * @interface IListUptimeCheckIpsResponse + * @property {Array.|null} [uptimeCheckIps] ListUptimeCheckIpsResponse uptimeCheckIps + * @property {string|null} [nextPageToken] ListUptimeCheckIpsResponse nextPageToken + */ + + /** + * Constructs a new ListUptimeCheckIpsResponse. + * @memberof google.monitoring.v3 + * @classdesc Represents a ListUptimeCheckIpsResponse. + * @implements IListUptimeCheckIpsResponse + * @constructor + * @param {google.monitoring.v3.IListUptimeCheckIpsResponse=} [properties] Properties to set + */ + function ListUptimeCheckIpsResponse(properties) { + this.uptimeCheckIps = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListUptimeCheckIpsResponse uptimeCheckIps. + * @member {Array.} uptimeCheckIps + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @instance + */ + ListUptimeCheckIpsResponse.prototype.uptimeCheckIps = $util.emptyArray; + + /** + * ListUptimeCheckIpsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @instance + */ + ListUptimeCheckIpsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListUptimeCheckIpsResponse instance using the specified properties. + * @function create + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {google.monitoring.v3.IListUptimeCheckIpsResponse=} [properties] Properties to set + * @returns {google.monitoring.v3.ListUptimeCheckIpsResponse} ListUptimeCheckIpsResponse instance + */ + ListUptimeCheckIpsResponse.create = function create(properties) { + return new ListUptimeCheckIpsResponse(properties); + }; + + /** + * Encodes the specified ListUptimeCheckIpsResponse message. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckIpsResponse.verify|verify} messages. + * @function encode + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {google.monitoring.v3.IListUptimeCheckIpsResponse} message ListUptimeCheckIpsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUptimeCheckIpsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uptimeCheckIps != null && message.uptimeCheckIps.length) + for (var i = 0; i < message.uptimeCheckIps.length; ++i) + $root.google.monitoring.v3.UptimeCheckIp.encode(message.uptimeCheckIps[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListUptimeCheckIpsResponse message, length delimited. Does not implicitly {@link google.monitoring.v3.ListUptimeCheckIpsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {google.monitoring.v3.IListUptimeCheckIpsResponse} message ListUptimeCheckIpsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListUptimeCheckIpsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListUptimeCheckIpsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.monitoring.v3.ListUptimeCheckIpsResponse} ListUptimeCheckIpsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUptimeCheckIpsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.monitoring.v3.ListUptimeCheckIpsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.uptimeCheckIps && message.uptimeCheckIps.length)) + message.uptimeCheckIps = []; + message.uptimeCheckIps.push($root.google.monitoring.v3.UptimeCheckIp.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListUptimeCheckIpsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.monitoring.v3.ListUptimeCheckIpsResponse} ListUptimeCheckIpsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListUptimeCheckIpsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListUptimeCheckIpsResponse message. + * @function verify + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListUptimeCheckIpsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uptimeCheckIps != null && message.hasOwnProperty("uptimeCheckIps")) { + if (!Array.isArray(message.uptimeCheckIps)) + return "uptimeCheckIps: array expected"; + for (var i = 0; i < message.uptimeCheckIps.length; ++i) { + var error = $root.google.monitoring.v3.UptimeCheckIp.verify(message.uptimeCheckIps[i]); + if (error) + return "uptimeCheckIps." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListUptimeCheckIpsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.monitoring.v3.ListUptimeCheckIpsResponse} ListUptimeCheckIpsResponse + */ + ListUptimeCheckIpsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.monitoring.v3.ListUptimeCheckIpsResponse) + return object; + var message = new $root.google.monitoring.v3.ListUptimeCheckIpsResponse(); + if (object.uptimeCheckIps) { + if (!Array.isArray(object.uptimeCheckIps)) + throw TypeError(".google.monitoring.v3.ListUptimeCheckIpsResponse.uptimeCheckIps: array expected"); + message.uptimeCheckIps = []; + for (var i = 0; i < object.uptimeCheckIps.length; ++i) { + if (typeof object.uptimeCheckIps[i] !== "object") + throw TypeError(".google.monitoring.v3.ListUptimeCheckIpsResponse.uptimeCheckIps: object expected"); + message.uptimeCheckIps[i] = $root.google.monitoring.v3.UptimeCheckIp.fromObject(object.uptimeCheckIps[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListUptimeCheckIpsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {google.monitoring.v3.ListUptimeCheckIpsResponse} message ListUptimeCheckIpsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListUptimeCheckIpsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uptimeCheckIps = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.uptimeCheckIps && message.uptimeCheckIps.length) { + object.uptimeCheckIps = []; + for (var j = 0; j < message.uptimeCheckIps.length; ++j) + object.uptimeCheckIps[j] = $root.google.monitoring.v3.UptimeCheckIp.toObject(message.uptimeCheckIps[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListUptimeCheckIpsResponse to JSON. + * @function toJSON + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @instance + * @returns {Object.} JSON object + */ + ListUptimeCheckIpsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListUptimeCheckIpsResponse + * @function getTypeUrl + * @memberof google.monitoring.v3.ListUptimeCheckIpsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListUptimeCheckIpsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.monitoring.v3.ListUptimeCheckIpsResponse"; + }; + + return ListUptimeCheckIpsResponse; + })(); + + return v3; + })(); + + return monitoring; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + + return ResourceReference; + })(); + + api.Distribution = (function() { + + /** + * Properties of a Distribution. + * @memberof google.api + * @interface IDistribution + * @property {number|Long|null} [count] Distribution count + * @property {number|null} [mean] Distribution mean + * @property {number|null} [sumOfSquaredDeviation] Distribution sumOfSquaredDeviation + * @property {google.api.Distribution.IRange|null} [range] Distribution range + * @property {google.api.Distribution.IBucketOptions|null} [bucketOptions] Distribution bucketOptions + * @property {Array.|null} [bucketCounts] Distribution bucketCounts + * @property {Array.|null} [exemplars] Distribution exemplars + */ + + /** + * Constructs a new Distribution. + * @memberof google.api + * @classdesc Represents a Distribution. + * @implements IDistribution + * @constructor + * @param {google.api.IDistribution=} [properties] Properties to set + */ + function Distribution(properties) { + this.bucketCounts = []; + this.exemplars = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Distribution count. + * @member {number|Long} count + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Distribution mean. + * @member {number} mean + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.mean = 0; + + /** + * Distribution sumOfSquaredDeviation. + * @member {number} sumOfSquaredDeviation + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.sumOfSquaredDeviation = 0; + + /** + * Distribution range. + * @member {google.api.Distribution.IRange|null|undefined} range + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.range = null; + + /** + * Distribution bucketOptions. + * @member {google.api.Distribution.IBucketOptions|null|undefined} bucketOptions + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.bucketOptions = null; + + /** + * Distribution bucketCounts. + * @member {Array.} bucketCounts + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.bucketCounts = $util.emptyArray; + + /** + * Distribution exemplars. + * @member {Array.} exemplars + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.exemplars = $util.emptyArray; + + /** + * Creates a new Distribution instance using the specified properties. + * @function create + * @memberof google.api.Distribution + * @static + * @param {google.api.IDistribution=} [properties] Properties to set + * @returns {google.api.Distribution} Distribution instance + */ + Distribution.create = function create(properties) { + return new Distribution(properties); + }; + + /** + * Encodes the specified Distribution message. Does not implicitly {@link google.api.Distribution.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution + * @static + * @param {google.api.IDistribution} message Distribution message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Distribution.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.count); + if (message.mean != null && Object.hasOwnProperty.call(message, "mean")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.mean); + if (message.sumOfSquaredDeviation != null && Object.hasOwnProperty.call(message, "sumOfSquaredDeviation")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.sumOfSquaredDeviation); + if (message.range != null && Object.hasOwnProperty.call(message, "range")) + $root.google.api.Distribution.Range.encode(message.range, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.bucketOptions != null && Object.hasOwnProperty.call(message, "bucketOptions")) + $root.google.api.Distribution.BucketOptions.encode(message.bucketOptions, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.bucketCounts != null && message.bucketCounts.length) { + writer.uint32(/* id 7, wireType 2 =*/58).fork(); + for (var i = 0; i < message.bucketCounts.length; ++i) + writer.int64(message.bucketCounts[i]); + writer.ldelim(); + } + if (message.exemplars != null && message.exemplars.length) + for (var i = 0; i < message.exemplars.length; ++i) + $root.google.api.Distribution.Exemplar.encode(message.exemplars[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Distribution message, length delimited. Does not implicitly {@link google.api.Distribution.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution + * @static + * @param {google.api.IDistribution} message Distribution message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Distribution.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Distribution message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution} Distribution + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Distribution.decode = function 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.Distribution(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.count = reader.int64(); + break; + } + case 2: { + message.mean = reader.double(); + break; + } + case 3: { + message.sumOfSquaredDeviation = reader.double(); + break; + } + case 4: { + message.range = $root.google.api.Distribution.Range.decode(reader, reader.uint32()); + break; + } + case 6: { + message.bucketOptions = $root.google.api.Distribution.BucketOptions.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.bucketCounts && message.bucketCounts.length)) + message.bucketCounts = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.bucketCounts.push(reader.int64()); + } else + message.bucketCounts.push(reader.int64()); + break; + } + case 10: { + if (!(message.exemplars && message.exemplars.length)) + message.exemplars = []; + message.exemplars.push($root.google.api.Distribution.Exemplar.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Distribution message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution} Distribution + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Distribution.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Distribution message. + * @function verify + * @memberof google.api.Distribution + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Distribution.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + if (message.mean != null && message.hasOwnProperty("mean")) + if (typeof message.mean !== "number") + return "mean: number expected"; + if (message.sumOfSquaredDeviation != null && message.hasOwnProperty("sumOfSquaredDeviation")) + if (typeof message.sumOfSquaredDeviation !== "number") + return "sumOfSquaredDeviation: number expected"; + if (message.range != null && message.hasOwnProperty("range")) { + var error = $root.google.api.Distribution.Range.verify(message.range); + if (error) + return "range." + error; + } + if (message.bucketOptions != null && message.hasOwnProperty("bucketOptions")) { + var error = $root.google.api.Distribution.BucketOptions.verify(message.bucketOptions); + if (error) + return "bucketOptions." + error; + } + if (message.bucketCounts != null && message.hasOwnProperty("bucketCounts")) { + if (!Array.isArray(message.bucketCounts)) + return "bucketCounts: array expected"; + for (var i = 0; i < message.bucketCounts.length; ++i) + if (!$util.isInteger(message.bucketCounts[i]) && !(message.bucketCounts[i] && $util.isInteger(message.bucketCounts[i].low) && $util.isInteger(message.bucketCounts[i].high))) + return "bucketCounts: integer|Long[] expected"; + } + if (message.exemplars != null && message.hasOwnProperty("exemplars")) { + if (!Array.isArray(message.exemplars)) + return "exemplars: array expected"; + for (var i = 0; i < message.exemplars.length; ++i) { + var error = $root.google.api.Distribution.Exemplar.verify(message.exemplars[i]); + if (error) + return "exemplars." + error; + } + } + return null; + }; + + /** + * Creates a Distribution message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution} Distribution + */ + Distribution.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution) + return object; + var message = new $root.google.api.Distribution(); + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + if (object.mean != null) + message.mean = Number(object.mean); + if (object.sumOfSquaredDeviation != null) + message.sumOfSquaredDeviation = Number(object.sumOfSquaredDeviation); + if (object.range != null) { + if (typeof object.range !== "object") + throw TypeError(".google.api.Distribution.range: object expected"); + message.range = $root.google.api.Distribution.Range.fromObject(object.range); + } + if (object.bucketOptions != null) { + if (typeof object.bucketOptions !== "object") + throw TypeError(".google.api.Distribution.bucketOptions: object expected"); + message.bucketOptions = $root.google.api.Distribution.BucketOptions.fromObject(object.bucketOptions); + } + if (object.bucketCounts) { + if (!Array.isArray(object.bucketCounts)) + throw TypeError(".google.api.Distribution.bucketCounts: array expected"); + message.bucketCounts = []; + for (var i = 0; i < object.bucketCounts.length; ++i) + if ($util.Long) + (message.bucketCounts[i] = $util.Long.fromValue(object.bucketCounts[i])).unsigned = false; + else if (typeof object.bucketCounts[i] === "string") + message.bucketCounts[i] = parseInt(object.bucketCounts[i], 10); + else if (typeof object.bucketCounts[i] === "number") + message.bucketCounts[i] = object.bucketCounts[i]; + else if (typeof object.bucketCounts[i] === "object") + message.bucketCounts[i] = new $util.LongBits(object.bucketCounts[i].low >>> 0, object.bucketCounts[i].high >>> 0).toNumber(); + } + if (object.exemplars) { + if (!Array.isArray(object.exemplars)) + throw TypeError(".google.api.Distribution.exemplars: array expected"); + message.exemplars = []; + for (var i = 0; i < object.exemplars.length; ++i) { + if (typeof object.exemplars[i] !== "object") + throw TypeError(".google.api.Distribution.exemplars: object expected"); + message.exemplars[i] = $root.google.api.Distribution.Exemplar.fromObject(object.exemplars[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Distribution message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution + * @static + * @param {google.api.Distribution} message Distribution + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Distribution.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.bucketCounts = []; + object.exemplars = []; + } + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + object.mean = 0; + object.sumOfSquaredDeviation = 0; + object.range = null; + object.bucketOptions = null; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (message.mean != null && message.hasOwnProperty("mean")) + object.mean = options.json && !isFinite(message.mean) ? String(message.mean) : message.mean; + if (message.sumOfSquaredDeviation != null && message.hasOwnProperty("sumOfSquaredDeviation")) + object.sumOfSquaredDeviation = options.json && !isFinite(message.sumOfSquaredDeviation) ? String(message.sumOfSquaredDeviation) : message.sumOfSquaredDeviation; + if (message.range != null && message.hasOwnProperty("range")) + object.range = $root.google.api.Distribution.Range.toObject(message.range, options); + if (message.bucketOptions != null && message.hasOwnProperty("bucketOptions")) + object.bucketOptions = $root.google.api.Distribution.BucketOptions.toObject(message.bucketOptions, options); + if (message.bucketCounts && message.bucketCounts.length) { + object.bucketCounts = []; + for (var j = 0; j < message.bucketCounts.length; ++j) + if (typeof message.bucketCounts[j] === "number") + object.bucketCounts[j] = options.longs === String ? String(message.bucketCounts[j]) : message.bucketCounts[j]; + else + object.bucketCounts[j] = options.longs === String ? $util.Long.prototype.toString.call(message.bucketCounts[j]) : options.longs === Number ? new $util.LongBits(message.bucketCounts[j].low >>> 0, message.bucketCounts[j].high >>> 0).toNumber() : message.bucketCounts[j]; + } + if (message.exemplars && message.exemplars.length) { + object.exemplars = []; + for (var j = 0; j < message.exemplars.length; ++j) + object.exemplars[j] = $root.google.api.Distribution.Exemplar.toObject(message.exemplars[j], options); + } + return object; + }; + + /** + * Converts this Distribution to JSON. + * @function toJSON + * @memberof google.api.Distribution + * @instance + * @returns {Object.} JSON object + */ + Distribution.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Distribution + * @function getTypeUrl + * @memberof google.api.Distribution + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Distribution.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution"; + }; + + Distribution.Range = (function() { + + /** + * Properties of a Range. + * @memberof google.api.Distribution + * @interface IRange + * @property {number|null} [min] Range min + * @property {number|null} [max] Range max + */ + + /** + * Constructs a new Range. + * @memberof google.api.Distribution + * @classdesc Represents a Range. + * @implements IRange + * @constructor + * @param {google.api.Distribution.IRange=} [properties] Properties to set + */ + function Range(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]]; + } + + /** + * Range min. + * @member {number} min + * @memberof google.api.Distribution.Range + * @instance + */ + Range.prototype.min = 0; + + /** + * Range max. + * @member {number} max + * @memberof google.api.Distribution.Range + * @instance + */ + Range.prototype.max = 0; + + /** + * Creates a new Range instance using the specified properties. + * @function create + * @memberof google.api.Distribution.Range + * @static + * @param {google.api.Distribution.IRange=} [properties] Properties to set + * @returns {google.api.Distribution.Range} Range instance + */ + Range.create = function create(properties) { + return new Range(properties); + }; + + /** + * Encodes the specified Range message. Does not implicitly {@link google.api.Distribution.Range.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.Range + * @static + * @param {google.api.Distribution.IRange} message Range message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Range.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.min != null && Object.hasOwnProperty.call(message, "min")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.min); + if (message.max != null && Object.hasOwnProperty.call(message, "max")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.max); + return writer; + }; + + /** + * Encodes the specified Range message, length delimited. Does not implicitly {@link google.api.Distribution.Range.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.Range + * @static + * @param {google.api.Distribution.IRange} message Range message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Range.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Range message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.Range + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.Range} Range + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Range.decode = function 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.Distribution.Range(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.min = reader.double(); + break; + } + case 2: { + message.max = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Range message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.Range + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.Range} Range + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Range.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Range message. + * @function verify + * @memberof google.api.Distribution.Range + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Range.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.min != null && message.hasOwnProperty("min")) + if (typeof message.min !== "number") + return "min: number expected"; + if (message.max != null && message.hasOwnProperty("max")) + if (typeof message.max !== "number") + return "max: number expected"; + return null; + }; + + /** + * Creates a Range message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.Range + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.Range} Range + */ + Range.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.Range) + return object; + var message = new $root.google.api.Distribution.Range(); + if (object.min != null) + message.min = Number(object.min); + if (object.max != null) + message.max = Number(object.max); + return message; + }; + + /** + * Creates a plain object from a Range message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.Range + * @static + * @param {google.api.Distribution.Range} message Range + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Range.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.min = 0; + object.max = 0; + } + if (message.min != null && message.hasOwnProperty("min")) + object.min = options.json && !isFinite(message.min) ? String(message.min) : message.min; + if (message.max != null && message.hasOwnProperty("max")) + object.max = options.json && !isFinite(message.max) ? String(message.max) : message.max; + return object; + }; + + /** + * Converts this Range to JSON. + * @function toJSON + * @memberof google.api.Distribution.Range + * @instance + * @returns {Object.} JSON object + */ + Range.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Range + * @function getTypeUrl + * @memberof google.api.Distribution.Range + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Range.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.Range"; + }; + + return Range; + })(); + + Distribution.BucketOptions = (function() { + + /** + * Properties of a BucketOptions. + * @memberof google.api.Distribution + * @interface IBucketOptions + * @property {google.api.Distribution.BucketOptions.ILinear|null} [linearBuckets] BucketOptions linearBuckets + * @property {google.api.Distribution.BucketOptions.IExponential|null} [exponentialBuckets] BucketOptions exponentialBuckets + * @property {google.api.Distribution.BucketOptions.IExplicit|null} [explicitBuckets] BucketOptions explicitBuckets + */ + + /** + * Constructs a new BucketOptions. + * @memberof google.api.Distribution + * @classdesc Represents a BucketOptions. + * @implements IBucketOptions + * @constructor + * @param {google.api.Distribution.IBucketOptions=} [properties] Properties to set + */ + function BucketOptions(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]]; + } + + /** + * BucketOptions linearBuckets. + * @member {google.api.Distribution.BucketOptions.ILinear|null|undefined} linearBuckets + * @memberof google.api.Distribution.BucketOptions + * @instance + */ + BucketOptions.prototype.linearBuckets = null; + + /** + * BucketOptions exponentialBuckets. + * @member {google.api.Distribution.BucketOptions.IExponential|null|undefined} exponentialBuckets + * @memberof google.api.Distribution.BucketOptions + * @instance + */ + BucketOptions.prototype.exponentialBuckets = null; + + /** + * BucketOptions explicitBuckets. + * @member {google.api.Distribution.BucketOptions.IExplicit|null|undefined} explicitBuckets + * @memberof google.api.Distribution.BucketOptions + * @instance + */ + BucketOptions.prototype.explicitBuckets = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BucketOptions options. + * @member {"linearBuckets"|"exponentialBuckets"|"explicitBuckets"|undefined} options + * @memberof google.api.Distribution.BucketOptions + * @instance + */ + Object.defineProperty(BucketOptions.prototype, "options", { + get: $util.oneOfGetter($oneOfFields = ["linearBuckets", "exponentialBuckets", "explicitBuckets"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BucketOptions instance using the specified properties. + * @function create + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {google.api.Distribution.IBucketOptions=} [properties] Properties to set + * @returns {google.api.Distribution.BucketOptions} BucketOptions instance + */ + BucketOptions.create = function create(properties) { + return new BucketOptions(properties); + }; + + /** + * Encodes the specified BucketOptions message. Does not implicitly {@link google.api.Distribution.BucketOptions.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {google.api.Distribution.IBucketOptions} message BucketOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BucketOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.linearBuckets != null && Object.hasOwnProperty.call(message, "linearBuckets")) + $root.google.api.Distribution.BucketOptions.Linear.encode(message.linearBuckets, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.exponentialBuckets != null && Object.hasOwnProperty.call(message, "exponentialBuckets")) + $root.google.api.Distribution.BucketOptions.Exponential.encode(message.exponentialBuckets, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.explicitBuckets != null && Object.hasOwnProperty.call(message, "explicitBuckets")) + $root.google.api.Distribution.BucketOptions.Explicit.encode(message.explicitBuckets, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BucketOptions message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {google.api.Distribution.IBucketOptions} message BucketOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BucketOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BucketOptions message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.BucketOptions} BucketOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BucketOptions.decode = function 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.Distribution.BucketOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.decode(reader, reader.uint32()); + break; + } + case 2: { + message.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.decode(reader, reader.uint32()); + break; + } + case 3: { + message.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BucketOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.BucketOptions} BucketOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BucketOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BucketOptions message. + * @function verify + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BucketOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.linearBuckets != null && message.hasOwnProperty("linearBuckets")) { + properties.options = 1; + { + var error = $root.google.api.Distribution.BucketOptions.Linear.verify(message.linearBuckets); + if (error) + return "linearBuckets." + error; + } + } + if (message.exponentialBuckets != null && message.hasOwnProperty("exponentialBuckets")) { + if (properties.options === 1) + return "options: multiple values"; + properties.options = 1; + { + var error = $root.google.api.Distribution.BucketOptions.Exponential.verify(message.exponentialBuckets); + if (error) + return "exponentialBuckets." + error; + } + } + if (message.explicitBuckets != null && message.hasOwnProperty("explicitBuckets")) { + if (properties.options === 1) + return "options: multiple values"; + properties.options = 1; + { + var error = $root.google.api.Distribution.BucketOptions.Explicit.verify(message.explicitBuckets); + if (error) + return "explicitBuckets." + error; + } + } + return null; + }; + + /** + * Creates a BucketOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.BucketOptions} BucketOptions + */ + BucketOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.BucketOptions) + return object; + var message = new $root.google.api.Distribution.BucketOptions(); + if (object.linearBuckets != null) { + if (typeof object.linearBuckets !== "object") + throw TypeError(".google.api.Distribution.BucketOptions.linearBuckets: object expected"); + message.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.fromObject(object.linearBuckets); + } + if (object.exponentialBuckets != null) { + if (typeof object.exponentialBuckets !== "object") + throw TypeError(".google.api.Distribution.BucketOptions.exponentialBuckets: object expected"); + message.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.fromObject(object.exponentialBuckets); + } + if (object.explicitBuckets != null) { + if (typeof object.explicitBuckets !== "object") + throw TypeError(".google.api.Distribution.BucketOptions.explicitBuckets: object expected"); + message.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.fromObject(object.explicitBuckets); + } + return message; + }; + + /** + * Creates a plain object from a BucketOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {google.api.Distribution.BucketOptions} message BucketOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BucketOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.linearBuckets != null && message.hasOwnProperty("linearBuckets")) { + object.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.toObject(message.linearBuckets, options); + if (options.oneofs) + object.options = "linearBuckets"; + } + if (message.exponentialBuckets != null && message.hasOwnProperty("exponentialBuckets")) { + object.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.toObject(message.exponentialBuckets, options); + if (options.oneofs) + object.options = "exponentialBuckets"; + } + if (message.explicitBuckets != null && message.hasOwnProperty("explicitBuckets")) { + object.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.toObject(message.explicitBuckets, options); + if (options.oneofs) + object.options = "explicitBuckets"; + } + return object; + }; + + /** + * Converts this BucketOptions to JSON. + * @function toJSON + * @memberof google.api.Distribution.BucketOptions + * @instance + * @returns {Object.} JSON object + */ + BucketOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BucketOptions + * @function getTypeUrl + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BucketOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.BucketOptions"; + }; + + BucketOptions.Linear = (function() { + + /** + * Properties of a Linear. + * @memberof google.api.Distribution.BucketOptions + * @interface ILinear + * @property {number|null} [numFiniteBuckets] Linear numFiniteBuckets + * @property {number|null} [width] Linear width + * @property {number|null} [offset] Linear offset + */ + + /** + * Constructs a new Linear. + * @memberof google.api.Distribution.BucketOptions + * @classdesc Represents a Linear. + * @implements ILinear + * @constructor + * @param {google.api.Distribution.BucketOptions.ILinear=} [properties] Properties to set + */ + function Linear(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]]; + } + + /** + * Linear numFiniteBuckets. + * @member {number} numFiniteBuckets + * @memberof google.api.Distribution.BucketOptions.Linear + * @instance + */ + Linear.prototype.numFiniteBuckets = 0; + + /** + * Linear width. + * @member {number} width + * @memberof google.api.Distribution.BucketOptions.Linear + * @instance + */ + Linear.prototype.width = 0; + + /** + * Linear offset. + * @member {number} offset + * @memberof google.api.Distribution.BucketOptions.Linear + * @instance + */ + Linear.prototype.offset = 0; + + /** + * Creates a new Linear instance using the specified properties. + * @function create + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {google.api.Distribution.BucketOptions.ILinear=} [properties] Properties to set + * @returns {google.api.Distribution.BucketOptions.Linear} Linear instance + */ + Linear.create = function create(properties) { + return new Linear(properties); + }; + + /** + * Encodes the specified Linear message. Does not implicitly {@link google.api.Distribution.BucketOptions.Linear.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {google.api.Distribution.BucketOptions.ILinear} message Linear message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Linear.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.numFiniteBuckets != null && Object.hasOwnProperty.call(message, "numFiniteBuckets")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.numFiniteBuckets); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.width); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.offset); + return writer; + }; + + /** + * Encodes the specified Linear message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Linear.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {google.api.Distribution.BucketOptions.ILinear} message Linear message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Linear.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Linear message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.BucketOptions.Linear} Linear + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Linear.decode = function 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.Distribution.BucketOptions.Linear(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.numFiniteBuckets = reader.int32(); + break; + } + case 2: { + message.width = reader.double(); + break; + } + case 3: { + message.offset = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Linear message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.BucketOptions.Linear} Linear + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Linear.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Linear message. + * @function verify + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Linear.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) + if (!$util.isInteger(message.numFiniteBuckets)) + return "numFiniteBuckets: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (typeof message.width !== "number") + return "width: number expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (typeof message.offset !== "number") + return "offset: number expected"; + return null; + }; + + /** + * Creates a Linear message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.BucketOptions.Linear} Linear + */ + Linear.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.BucketOptions.Linear) + return object; + var message = new $root.google.api.Distribution.BucketOptions.Linear(); + if (object.numFiniteBuckets != null) + message.numFiniteBuckets = object.numFiniteBuckets | 0; + if (object.width != null) + message.width = Number(object.width); + if (object.offset != null) + message.offset = Number(object.offset); + return message; + }; + + /** + * Creates a plain object from a Linear message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {google.api.Distribution.BucketOptions.Linear} message Linear + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Linear.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.numFiniteBuckets = 0; + object.width = 0; + object.offset = 0; + } + if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) + object.numFiniteBuckets = message.numFiniteBuckets; + if (message.width != null && message.hasOwnProperty("width")) + object.width = options.json && !isFinite(message.width) ? String(message.width) : message.width; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = options.json && !isFinite(message.offset) ? String(message.offset) : message.offset; + return object; + }; + + /** + * Converts this Linear to JSON. + * @function toJSON + * @memberof google.api.Distribution.BucketOptions.Linear + * @instance + * @returns {Object.} JSON object + */ + Linear.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Linear + * @function getTypeUrl + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Linear.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.BucketOptions.Linear"; + }; + + return Linear; + })(); + + BucketOptions.Exponential = (function() { + + /** + * Properties of an Exponential. + * @memberof google.api.Distribution.BucketOptions + * @interface IExponential + * @property {number|null} [numFiniteBuckets] Exponential numFiniteBuckets + * @property {number|null} [growthFactor] Exponential growthFactor + * @property {number|null} [scale] Exponential scale + */ + + /** + * Constructs a new Exponential. + * @memberof google.api.Distribution.BucketOptions + * @classdesc Represents an Exponential. + * @implements IExponential + * @constructor + * @param {google.api.Distribution.BucketOptions.IExponential=} [properties] Properties to set + */ + function Exponential(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]]; + } + + /** + * Exponential numFiniteBuckets. + * @member {number} numFiniteBuckets + * @memberof google.api.Distribution.BucketOptions.Exponential + * @instance + */ + Exponential.prototype.numFiniteBuckets = 0; + + /** + * Exponential growthFactor. + * @member {number} growthFactor + * @memberof google.api.Distribution.BucketOptions.Exponential + * @instance + */ + Exponential.prototype.growthFactor = 0; + + /** + * Exponential scale. + * @member {number} scale + * @memberof google.api.Distribution.BucketOptions.Exponential + * @instance + */ + Exponential.prototype.scale = 0; + + /** + * Creates a new Exponential instance using the specified properties. + * @function create + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {google.api.Distribution.BucketOptions.IExponential=} [properties] Properties to set + * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential instance + */ + Exponential.create = function create(properties) { + return new Exponential(properties); + }; + + /** + * Encodes the specified Exponential message. Does not implicitly {@link google.api.Distribution.BucketOptions.Exponential.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {google.api.Distribution.BucketOptions.IExponential} message Exponential message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Exponential.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.numFiniteBuckets != null && Object.hasOwnProperty.call(message, "numFiniteBuckets")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.numFiniteBuckets); + if (message.growthFactor != null && Object.hasOwnProperty.call(message, "growthFactor")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.growthFactor); + if (message.scale != null && Object.hasOwnProperty.call(message, "scale")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.scale); + return writer; + }; + + /** + * Encodes the specified Exponential message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Exponential.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {google.api.Distribution.BucketOptions.IExponential} message Exponential message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Exponential.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Exponential message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Exponential.decode = function 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.Distribution.BucketOptions.Exponential(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.numFiniteBuckets = reader.int32(); + break; + } + case 2: { + message.growthFactor = reader.double(); + break; + } + case 3: { + message.scale = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Exponential message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Exponential.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Exponential message. + * @function verify + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Exponential.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) + if (!$util.isInteger(message.numFiniteBuckets)) + return "numFiniteBuckets: integer expected"; + if (message.growthFactor != null && message.hasOwnProperty("growthFactor")) + if (typeof message.growthFactor !== "number") + return "growthFactor: number expected"; + if (message.scale != null && message.hasOwnProperty("scale")) + if (typeof message.scale !== "number") + return "scale: number expected"; + return null; + }; + + /** + * Creates an Exponential message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential + */ + Exponential.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.BucketOptions.Exponential) + return object; + var message = new $root.google.api.Distribution.BucketOptions.Exponential(); + if (object.numFiniteBuckets != null) + message.numFiniteBuckets = object.numFiniteBuckets | 0; + if (object.growthFactor != null) + message.growthFactor = Number(object.growthFactor); + if (object.scale != null) + message.scale = Number(object.scale); + return message; + }; + + /** + * Creates a plain object from an Exponential message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {google.api.Distribution.BucketOptions.Exponential} message Exponential + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Exponential.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.numFiniteBuckets = 0; + object.growthFactor = 0; + object.scale = 0; + } + if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) + object.numFiniteBuckets = message.numFiniteBuckets; + if (message.growthFactor != null && message.hasOwnProperty("growthFactor")) + object.growthFactor = options.json && !isFinite(message.growthFactor) ? String(message.growthFactor) : message.growthFactor; + if (message.scale != null && message.hasOwnProperty("scale")) + object.scale = options.json && !isFinite(message.scale) ? String(message.scale) : message.scale; + return object; + }; + + /** + * Converts this Exponential to JSON. + * @function toJSON + * @memberof google.api.Distribution.BucketOptions.Exponential + * @instance + * @returns {Object.} JSON object + */ + Exponential.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Exponential + * @function getTypeUrl + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Exponential.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.BucketOptions.Exponential"; + }; + + return Exponential; + })(); + + BucketOptions.Explicit = (function() { + + /** + * Properties of an Explicit. + * @memberof google.api.Distribution.BucketOptions + * @interface IExplicit + * @property {Array.|null} [bounds] Explicit bounds + */ + + /** + * Constructs a new Explicit. + * @memberof google.api.Distribution.BucketOptions + * @classdesc Represents an Explicit. + * @implements IExplicit + * @constructor + * @param {google.api.Distribution.BucketOptions.IExplicit=} [properties] Properties to set + */ + function Explicit(properties) { + this.bounds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Explicit bounds. + * @member {Array.} bounds + * @memberof google.api.Distribution.BucketOptions.Explicit + * @instance + */ + Explicit.prototype.bounds = $util.emptyArray; + + /** + * Creates a new Explicit instance using the specified properties. + * @function create + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {google.api.Distribution.BucketOptions.IExplicit=} [properties] Properties to set + * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit instance + */ + Explicit.create = function create(properties) { + return new Explicit(properties); + }; + + /** + * Encodes the specified Explicit message. Does not implicitly {@link google.api.Distribution.BucketOptions.Explicit.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {google.api.Distribution.BucketOptions.IExplicit} message Explicit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Explicit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bounds != null && message.bounds.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.bounds.length; ++i) + writer.double(message.bounds[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Explicit message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Explicit.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {google.api.Distribution.BucketOptions.IExplicit} message Explicit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Explicit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Explicit message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Explicit.decode = function 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.Distribution.BucketOptions.Explicit(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.bounds && message.bounds.length)) + message.bounds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.bounds.push(reader.double()); + } else + message.bounds.push(reader.double()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Explicit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Explicit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Explicit message. + * @function verify + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Explicit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bounds != null && message.hasOwnProperty("bounds")) { + if (!Array.isArray(message.bounds)) + return "bounds: array expected"; + for (var i = 0; i < message.bounds.length; ++i) + if (typeof message.bounds[i] !== "number") + return "bounds: number[] expected"; + } + return null; + }; + + /** + * Creates an Explicit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit + */ + Explicit.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.BucketOptions.Explicit) + return object; + var message = new $root.google.api.Distribution.BucketOptions.Explicit(); + if (object.bounds) { + if (!Array.isArray(object.bounds)) + throw TypeError(".google.api.Distribution.BucketOptions.Explicit.bounds: array expected"); + message.bounds = []; + for (var i = 0; i < object.bounds.length; ++i) + message.bounds[i] = Number(object.bounds[i]); + } + return message; + }; + + /** + * Creates a plain object from an Explicit message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {google.api.Distribution.BucketOptions.Explicit} message Explicit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Explicit.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.bounds = []; + if (message.bounds && message.bounds.length) { + object.bounds = []; + for (var j = 0; j < message.bounds.length; ++j) + object.bounds[j] = options.json && !isFinite(message.bounds[j]) ? String(message.bounds[j]) : message.bounds[j]; + } + return object; + }; + + /** + * Converts this Explicit to JSON. + * @function toJSON + * @memberof google.api.Distribution.BucketOptions.Explicit + * @instance + * @returns {Object.} JSON object + */ + Explicit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Explicit + * @function getTypeUrl + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Explicit.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.BucketOptions.Explicit"; + }; + + return Explicit; + })(); + + return BucketOptions; + })(); + + Distribution.Exemplar = (function() { + + /** + * Properties of an Exemplar. + * @memberof google.api.Distribution + * @interface IExemplar + * @property {number|null} [value] Exemplar value + * @property {google.protobuf.ITimestamp|null} [timestamp] Exemplar timestamp + * @property {Array.|null} [attachments] Exemplar attachments + */ + + /** + * Constructs a new Exemplar. + * @memberof google.api.Distribution + * @classdesc Represents an Exemplar. + * @implements IExemplar + * @constructor + * @param {google.api.Distribution.IExemplar=} [properties] Properties to set + */ + function Exemplar(properties) { + this.attachments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Exemplar value. + * @member {number} value + * @memberof google.api.Distribution.Exemplar + * @instance + */ + Exemplar.prototype.value = 0; + + /** + * Exemplar timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof google.api.Distribution.Exemplar + * @instance + */ + Exemplar.prototype.timestamp = null; + + /** + * Exemplar attachments. + * @member {Array.} attachments + * @memberof google.api.Distribution.Exemplar + * @instance + */ + Exemplar.prototype.attachments = $util.emptyArray; + + /** + * Creates a new Exemplar instance using the specified properties. + * @function create + * @memberof google.api.Distribution.Exemplar + * @static + * @param {google.api.Distribution.IExemplar=} [properties] Properties to set + * @returns {google.api.Distribution.Exemplar} Exemplar instance + */ + Exemplar.create = function create(properties) { + return new Exemplar(properties); + }; + + /** + * Encodes the specified Exemplar message. Does not implicitly {@link google.api.Distribution.Exemplar.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.Exemplar + * @static + * @param {google.api.Distribution.IExemplar} message Exemplar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Exemplar.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attachments != null && message.attachments.length) + for (var i = 0; i < message.attachments.length; ++i) + $root.google.protobuf.Any.encode(message.attachments[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Exemplar message, length delimited. Does not implicitly {@link google.api.Distribution.Exemplar.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.Exemplar + * @static + * @param {google.api.Distribution.IExemplar} message Exemplar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Exemplar.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Exemplar message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.Exemplar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.Exemplar} Exemplar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Exemplar.decode = function 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.Distribution.Exemplar(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.double(); + break; + } + case 2: { + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.attachments && message.attachments.length)) + message.attachments = []; + message.attachments.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Exemplar message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.Exemplar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.Exemplar} Exemplar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Exemplar.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Exemplar message. + * @function verify + * @memberof google.api.Distribution.Exemplar + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Exemplar.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + var error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + if (message.attachments != null && message.hasOwnProperty("attachments")) { + if (!Array.isArray(message.attachments)) + return "attachments: array expected"; + for (var i = 0; i < message.attachments.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.attachments[i]); + if (error) + return "attachments." + error; + } + } + return null; + }; + + /** + * Creates an Exemplar message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.Exemplar + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.Exemplar} Exemplar + */ + Exemplar.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.Exemplar) + return object; + var message = new $root.google.api.Distribution.Exemplar(); + if (object.value != null) + message.value = Number(object.value); + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".google.api.Distribution.Exemplar.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + if (object.attachments) { + if (!Array.isArray(object.attachments)) + throw TypeError(".google.api.Distribution.Exemplar.attachments: array expected"); + message.attachments = []; + for (var i = 0; i < object.attachments.length; ++i) { + if (typeof object.attachments[i] !== "object") + throw TypeError(".google.api.Distribution.Exemplar.attachments: object expected"); + message.attachments[i] = $root.google.protobuf.Any.fromObject(object.attachments[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an Exemplar message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.Exemplar + * @static + * @param {google.api.Distribution.Exemplar} message Exemplar + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Exemplar.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.attachments = []; + if (options.defaults) { + object.value = 0; + object.timestamp = null; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + if (message.attachments && message.attachments.length) { + object.attachments = []; + for (var j = 0; j < message.attachments.length; ++j) + object.attachments[j] = $root.google.protobuf.Any.toObject(message.attachments[j], options); + } + return object; + }; + + /** + * Converts this Exemplar to JSON. + * @function toJSON + * @memberof google.api.Distribution.Exemplar + * @instance + * @returns {Object.} JSON object + */ + Exemplar.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Exemplar + * @function getTypeUrl + * @memberof google.api.Distribution.Exemplar + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Exemplar.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.Exemplar"; + }; + + return Exemplar; + })(); + + return Distribution; + })(); + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Http + * @function getTypeUrl + * @memberof google.api.Http + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Http"; + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string|null|undefined} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = null; + + /** + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = null; + + /** + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = null; + + /** + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = null; + + /** + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = null; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HttpRule + * @function getTypeUrl + * @memberof google.api.HttpRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpRule"; + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CustomHttpPattern"; + }; + + return CustomHttpPattern; + })(); + + api.MonitoredResourceDescriptor = (function() { + + /** + * Properties of a MonitoredResourceDescriptor. + * @memberof google.api + * @interface IMonitoredResourceDescriptor + * @property {string|null} [name] MonitoredResourceDescriptor name + * @property {string|null} [type] MonitoredResourceDescriptor type + * @property {string|null} [displayName] MonitoredResourceDescriptor displayName + * @property {string|null} [description] MonitoredResourceDescriptor description + * @property {Array.|null} [labels] MonitoredResourceDescriptor labels + * @property {google.api.LaunchStage|null} [launchStage] MonitoredResourceDescriptor launchStage + */ + + /** + * Constructs a new MonitoredResourceDescriptor. + * @memberof google.api + * @classdesc Represents a MonitoredResourceDescriptor. + * @implements IMonitoredResourceDescriptor + * @constructor + * @param {google.api.IMonitoredResourceDescriptor=} [properties] Properties to set + */ + function MonitoredResourceDescriptor(properties) { + this.labels = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MonitoredResourceDescriptor name. + * @member {string} name + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.name = ""; + + /** + * MonitoredResourceDescriptor type. + * @member {string} type + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.type = ""; + + /** + * MonitoredResourceDescriptor displayName. + * @member {string} displayName + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.displayName = ""; + + /** + * MonitoredResourceDescriptor description. + * @member {string} description + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.description = ""; + + /** + * MonitoredResourceDescriptor labels. + * @member {Array.} labels + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.labels = $util.emptyArray; + + /** + * MonitoredResourceDescriptor launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.launchStage = 0; + + /** + * Creates a new MonitoredResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {google.api.IMonitoredResourceDescriptor=} [properties] Properties to set + * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor instance + */ + MonitoredResourceDescriptor.create = function create(properties) { + return new MonitoredResourceDescriptor(properties); + }; + + /** + * Encodes the specified MonitoredResourceDescriptor message. Does not implicitly {@link google.api.MonitoredResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {google.api.IMonitoredResourceDescriptor} message MonitoredResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.labels != null && message.labels.length) + for (var i = 0; i < message.labels.length; ++i) + $root.google.api.LabelDescriptor.encode(message.labels[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.launchStage); + return writer; + }; + + /** + * Encodes the specified MonitoredResourceDescriptor message, length delimited. Does not implicitly {@link google.api.MonitoredResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {google.api.IMonitoredResourceDescriptor} message MonitoredResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MonitoredResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResourceDescriptor.decode = function 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.MonitoredResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.name = reader.string(); + break; + } + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + if (!(message.labels && message.labels.length)) + message.labels = []; + message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + break; + } + case 7: { + message.launchStage = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MonitoredResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MonitoredResourceDescriptor message. + * @function verify + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MonitoredResourceDescriptor.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.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) { + var error = $root.google.api.LabelDescriptor.verify(message.labels[i]); + if (error) + return "labels." + error; + } + } + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a MonitoredResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor + */ + MonitoredResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MonitoredResourceDescriptor) + return object; + var message = new $root.google.api.MonitoredResourceDescriptor(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.api.MonitoredResourceDescriptor.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) { + if (typeof object.labels[i] !== "object") + throw TypeError(".google.api.MonitoredResourceDescriptor.labels: object expected"); + message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i]); + } + } + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from a MonitoredResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {google.api.MonitoredResourceDescriptor} message MonitoredResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MonitoredResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.labels = []; + if (options.defaults) { + object.type = ""; + object.displayName = ""; + object.description = ""; + object.name = ""; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = $root.google.api.LabelDescriptor.toObject(message.labels[j], options); + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + return object; + }; + + /** + * Converts this MonitoredResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.MonitoredResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + MonitoredResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MonitoredResourceDescriptor + * @function getTypeUrl + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MonitoredResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MonitoredResourceDescriptor"; + }; + + return MonitoredResourceDescriptor; + })(); + + api.MonitoredResource = (function() { + + /** + * Properties of a MonitoredResource. + * @memberof google.api + * @interface IMonitoredResource + * @property {string|null} [type] MonitoredResource type + * @property {Object.|null} [labels] MonitoredResource labels + */ + + /** + * Constructs a new MonitoredResource. + * @memberof google.api + * @classdesc Represents a MonitoredResource. + * @implements IMonitoredResource + * @constructor + * @param {google.api.IMonitoredResource=} [properties] Properties to set + */ + function MonitoredResource(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MonitoredResource type. + * @member {string} type + * @memberof google.api.MonitoredResource + * @instance + */ + MonitoredResource.prototype.type = ""; + + /** + * MonitoredResource labels. + * @member {Object.} labels + * @memberof google.api.MonitoredResource + * @instance + */ + MonitoredResource.prototype.labels = $util.emptyObject; + + /** + * Creates a new MonitoredResource instance using the specified properties. + * @function create + * @memberof google.api.MonitoredResource + * @static + * @param {google.api.IMonitoredResource=} [properties] Properties to set + * @returns {google.api.MonitoredResource} MonitoredResource instance + */ + MonitoredResource.create = function create(properties) { + return new MonitoredResource(properties); + }; + + /** + * Encodes the specified MonitoredResource message. Does not implicitly {@link google.api.MonitoredResource.verify|verify} messages. + * @function encode + * @memberof google.api.MonitoredResource + * @static + * @param {google.api.IMonitoredResource} message MonitoredResource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified MonitoredResource message, length delimited. Does not implicitly {@link google.api.MonitoredResource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MonitoredResource + * @static + * @param {google.api.IMonitoredResource} message MonitoredResource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MonitoredResource message from the specified reader or buffer. + * @function decode + * @memberof google.api.MonitoredResource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MonitoredResource} MonitoredResource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResource.decode = function 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.MonitoredResource(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MonitoredResource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MonitoredResource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MonitoredResource} MonitoredResource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MonitoredResource message. + * @function verify + * @memberof google.api.MonitoredResource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MonitoredResource.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.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a MonitoredResource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MonitoredResource + * @static + * @param {Object.} object Plain object + * @returns {google.api.MonitoredResource} MonitoredResource + */ + MonitoredResource.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MonitoredResource) + return object; + var message = new $root.google.api.MonitoredResource(); + if (object.type != null) + message.type = String(object.type); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.api.MonitoredResource.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a MonitoredResource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MonitoredResource + * @static + * @param {google.api.MonitoredResource} message MonitoredResource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MonitoredResource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this MonitoredResource to JSON. + * @function toJSON + * @memberof google.api.MonitoredResource + * @instance + * @returns {Object.} JSON object + */ + MonitoredResource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MonitoredResource + * @function getTypeUrl + * @memberof google.api.MonitoredResource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MonitoredResource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MonitoredResource"; + }; + + return MonitoredResource; + })(); + + api.MonitoredResourceMetadata = (function() { + + /** + * Properties of a MonitoredResourceMetadata. + * @memberof google.api + * @interface IMonitoredResourceMetadata + * @property {google.protobuf.IStruct|null} [systemLabels] MonitoredResourceMetadata systemLabels + * @property {Object.|null} [userLabels] MonitoredResourceMetadata userLabels + */ + + /** + * Constructs a new MonitoredResourceMetadata. + * @memberof google.api + * @classdesc Represents a MonitoredResourceMetadata. + * @implements IMonitoredResourceMetadata + * @constructor + * @param {google.api.IMonitoredResourceMetadata=} [properties] Properties to set + */ + function MonitoredResourceMetadata(properties) { + this.userLabels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MonitoredResourceMetadata systemLabels. + * @member {google.protobuf.IStruct|null|undefined} systemLabels + * @memberof google.api.MonitoredResourceMetadata + * @instance + */ + MonitoredResourceMetadata.prototype.systemLabels = null; + + /** + * MonitoredResourceMetadata userLabels. + * @member {Object.} userLabels + * @memberof google.api.MonitoredResourceMetadata + * @instance + */ + MonitoredResourceMetadata.prototype.userLabels = $util.emptyObject; + + /** + * Creates a new MonitoredResourceMetadata instance using the specified properties. + * @function create + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {google.api.IMonitoredResourceMetadata=} [properties] Properties to set + * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata instance + */ + MonitoredResourceMetadata.create = function create(properties) { + return new MonitoredResourceMetadata(properties); + }; + + /** + * Encodes the specified MonitoredResourceMetadata message. Does not implicitly {@link google.api.MonitoredResourceMetadata.verify|verify} messages. + * @function encode + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {google.api.IMonitoredResourceMetadata} message MonitoredResourceMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResourceMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.systemLabels != null && Object.hasOwnProperty.call(message, "systemLabels")) + $root.google.protobuf.Struct.encode(message.systemLabels, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.userLabels != null && Object.hasOwnProperty.call(message, "userLabels")) + for (var keys = Object.keys(message.userLabels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userLabels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified MonitoredResourceMetadata message, length delimited. Does not implicitly {@link google.api.MonitoredResourceMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {google.api.IMonitoredResourceMetadata} message MonitoredResourceMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResourceMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MonitoredResourceMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResourceMetadata.decode = function 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.MonitoredResourceMetadata(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.systemLabels = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 2: { + if (message.userLabels === $util.emptyObject) + message.userLabels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.userLabels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MonitoredResourceMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResourceMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MonitoredResourceMetadata message. + * @function verify + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MonitoredResourceMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.systemLabels != null && message.hasOwnProperty("systemLabels")) { + var error = $root.google.protobuf.Struct.verify(message.systemLabels); + if (error) + return "systemLabels." + error; + } + if (message.userLabels != null && message.hasOwnProperty("userLabels")) { + if (!$util.isObject(message.userLabels)) + return "userLabels: object expected"; + var key = Object.keys(message.userLabels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.userLabels[key[i]])) + return "userLabels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a MonitoredResourceMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata + */ + MonitoredResourceMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MonitoredResourceMetadata) + return object; + var message = new $root.google.api.MonitoredResourceMetadata(); + if (object.systemLabels != null) { + if (typeof object.systemLabels !== "object") + throw TypeError(".google.api.MonitoredResourceMetadata.systemLabels: object expected"); + message.systemLabels = $root.google.protobuf.Struct.fromObject(object.systemLabels); + } + if (object.userLabels) { + if (typeof object.userLabels !== "object") + throw TypeError(".google.api.MonitoredResourceMetadata.userLabels: object expected"); + message.userLabels = {}; + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a MonitoredResourceMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {google.api.MonitoredResourceMetadata} message MonitoredResourceMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MonitoredResourceMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.userLabels = {}; + if (options.defaults) + object.systemLabels = null; + if (message.systemLabels != null && message.hasOwnProperty("systemLabels")) + object.systemLabels = $root.google.protobuf.Struct.toObject(message.systemLabels, options); + var keys2; + if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { + object.userLabels = {}; + for (var j = 0; j < keys2.length; ++j) + object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } + return object; + }; + + /** + * Converts this MonitoredResourceMetadata to JSON. + * @function toJSON + * @memberof google.api.MonitoredResourceMetadata + * @instance + * @returns {Object.} JSON object + */ + MonitoredResourceMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MonitoredResourceMetadata + * @function getTypeUrl + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MonitoredResourceMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MonitoredResourceMetadata"; + }; + + return MonitoredResourceMetadata; + })(); + + api.LabelDescriptor = (function() { + + /** + * Properties of a LabelDescriptor. + * @memberof google.api + * @interface ILabelDescriptor + * @property {string|null} [key] LabelDescriptor key + * @property {google.api.LabelDescriptor.ValueType|null} [valueType] LabelDescriptor valueType + * @property {string|null} [description] LabelDescriptor description + */ + + /** + * Constructs a new LabelDescriptor. + * @memberof google.api + * @classdesc Represents a LabelDescriptor. + * @implements ILabelDescriptor + * @constructor + * @param {google.api.ILabelDescriptor=} [properties] Properties to set + */ + function LabelDescriptor(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]]; + } + + /** + * LabelDescriptor key. + * @member {string} key + * @memberof google.api.LabelDescriptor + * @instance + */ + LabelDescriptor.prototype.key = ""; + + /** + * LabelDescriptor valueType. + * @member {google.api.LabelDescriptor.ValueType} valueType + * @memberof google.api.LabelDescriptor + * @instance + */ + LabelDescriptor.prototype.valueType = 0; + + /** + * LabelDescriptor description. + * @member {string} description + * @memberof google.api.LabelDescriptor + * @instance + */ + LabelDescriptor.prototype.description = ""; + + /** + * Creates a new LabelDescriptor instance using the specified properties. + * @function create + * @memberof google.api.LabelDescriptor + * @static + * @param {google.api.ILabelDescriptor=} [properties] Properties to set + * @returns {google.api.LabelDescriptor} LabelDescriptor instance + */ + LabelDescriptor.create = function create(properties) { + return new LabelDescriptor(properties); + }; + + /** + * Encodes the specified LabelDescriptor message. Does not implicitly {@link google.api.LabelDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.LabelDescriptor + * @static + * @param {google.api.ILabelDescriptor} message LabelDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.valueType); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + return writer; + }; + + /** + * Encodes the specified LabelDescriptor message, length delimited. Does not implicitly {@link google.api.LabelDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.LabelDescriptor + * @static + * @param {google.api.ILabelDescriptor} message LabelDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LabelDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.LabelDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.LabelDescriptor} LabelDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelDescriptor.decode = function 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.LabelDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.valueType = reader.int32(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LabelDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.LabelDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.LabelDescriptor} LabelDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LabelDescriptor message. + * @function verify + * @memberof google.api.LabelDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LabelDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.valueType != null && message.hasOwnProperty("valueType")) + switch (message.valueType) { + default: + return "valueType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + return null; + }; + + /** + * Creates a LabelDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.LabelDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.LabelDescriptor} LabelDescriptor + */ + LabelDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.LabelDescriptor) + return object; + var message = new $root.google.api.LabelDescriptor(); + if (object.key != null) + message.key = String(object.key); + switch (object.valueType) { + default: + if (typeof object.valueType === "number") { + message.valueType = object.valueType; + break; + } + break; + case "STRING": + case 0: + message.valueType = 0; + break; + case "BOOL": + case 1: + message.valueType = 1; + break; + case "INT64": + case 2: + message.valueType = 2; + break; + } + if (object.description != null) + message.description = String(object.description); + return message; + }; + + /** + * Creates a plain object from a LabelDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.LabelDescriptor + * @static + * @param {google.api.LabelDescriptor} message LabelDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LabelDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = ""; + object.valueType = options.enums === String ? "STRING" : 0; + object.description = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = options.enums === String ? $root.google.api.LabelDescriptor.ValueType[message.valueType] === undefined ? message.valueType : $root.google.api.LabelDescriptor.ValueType[message.valueType] : message.valueType; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + return object; + }; + + /** + * Converts this LabelDescriptor to JSON. + * @function toJSON + * @memberof google.api.LabelDescriptor + * @instance + * @returns {Object.} JSON object + */ + LabelDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LabelDescriptor + * @function getTypeUrl + * @memberof google.api.LabelDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LabelDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.LabelDescriptor"; + }; + + /** + * ValueType enum. + * @name google.api.LabelDescriptor.ValueType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} BOOL=1 BOOL value + * @property {number} INT64=2 INT64 value + */ + LabelDescriptor.ValueType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "BOOL"] = 1; + values[valuesById[2] = "INT64"] = 2; + return values; + })(); + + return LabelDescriptor; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; + })(); + + api.MetricDescriptor = (function() { + + /** + * Properties of a MetricDescriptor. + * @memberof google.api + * @interface IMetricDescriptor + * @property {string|null} [name] MetricDescriptor name + * @property {string|null} [type] MetricDescriptor type + * @property {Array.|null} [labels] MetricDescriptor labels + * @property {google.api.MetricDescriptor.MetricKind|null} [metricKind] MetricDescriptor metricKind + * @property {google.api.MetricDescriptor.ValueType|null} [valueType] MetricDescriptor valueType + * @property {string|null} [unit] MetricDescriptor unit + * @property {string|null} [description] MetricDescriptor description + * @property {string|null} [displayName] MetricDescriptor displayName + * @property {google.api.MetricDescriptor.IMetricDescriptorMetadata|null} [metadata] MetricDescriptor metadata + * @property {google.api.LaunchStage|null} [launchStage] MetricDescriptor launchStage + * @property {Array.|null} [monitoredResourceTypes] MetricDescriptor monitoredResourceTypes + */ + + /** + * Constructs a new MetricDescriptor. + * @memberof google.api + * @classdesc Represents a MetricDescriptor. + * @implements IMetricDescriptor + * @constructor + * @param {google.api.IMetricDescriptor=} [properties] Properties to set + */ + function MetricDescriptor(properties) { + this.labels = []; + this.monitoredResourceTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MetricDescriptor name. + * @member {string} name + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.name = ""; + + /** + * MetricDescriptor type. + * @member {string} type + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.type = ""; + + /** + * MetricDescriptor labels. + * @member {Array.} labels + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.labels = $util.emptyArray; + + /** + * MetricDescriptor metricKind. + * @member {google.api.MetricDescriptor.MetricKind} metricKind + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.metricKind = 0; + + /** + * MetricDescriptor valueType. + * @member {google.api.MetricDescriptor.ValueType} valueType + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.valueType = 0; + + /** + * MetricDescriptor unit. + * @member {string} unit + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.unit = ""; + + /** + * MetricDescriptor description. + * @member {string} description + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.description = ""; + + /** + * MetricDescriptor displayName. + * @member {string} displayName + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.displayName = ""; + + /** + * MetricDescriptor metadata. + * @member {google.api.MetricDescriptor.IMetricDescriptorMetadata|null|undefined} metadata + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.metadata = null; + + /** + * MetricDescriptor launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.launchStage = 0; + + /** + * MetricDescriptor monitoredResourceTypes. + * @member {Array.} monitoredResourceTypes + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.monitoredResourceTypes = $util.emptyArray; + + /** + * Creates a new MetricDescriptor instance using the specified properties. + * @function create + * @memberof google.api.MetricDescriptor + * @static + * @param {google.api.IMetricDescriptor=} [properties] Properties to set + * @returns {google.api.MetricDescriptor} MetricDescriptor instance + */ + MetricDescriptor.create = function create(properties) { + return new MetricDescriptor(properties); + }; + + /** + * Encodes the specified MetricDescriptor message. Does not implicitly {@link google.api.MetricDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.MetricDescriptor + * @static + * @param {google.api.IMetricDescriptor} message MetricDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.labels != null && message.labels.length) + for (var i = 0; i < message.labels.length; ++i) + $root.google.api.LabelDescriptor.encode(message.labels[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metricKind != null && Object.hasOwnProperty.call(message, "metricKind")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.metricKind); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.valueType); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.unit); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.description); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.displayName); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.type); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.api.MetricDescriptor.MetricDescriptorMetadata.encode(message.metadata, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.launchStage); + if (message.monitoredResourceTypes != null && message.monitoredResourceTypes.length) + for (var i = 0; i < message.monitoredResourceTypes.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.monitoredResourceTypes[i]); + return writer; + }; + + /** + * Encodes the specified MetricDescriptor message, length delimited. Does not implicitly {@link google.api.MetricDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MetricDescriptor + * @static + * @param {google.api.IMetricDescriptor} message MetricDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MetricDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.MetricDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MetricDescriptor} MetricDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricDescriptor.decode = function 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.MetricDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 8: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.labels && message.labels.length)) + message.labels = []; + message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + break; + } + case 3: { + message.metricKind = reader.int32(); + break; + } + case 4: { + message.valueType = reader.int32(); + break; + } + case 5: { + message.unit = reader.string(); + break; + } + case 6: { + message.description = reader.string(); + break; + } + case 7: { + message.displayName = reader.string(); + break; + } + case 10: { + message.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.decode(reader, reader.uint32()); + break; + } + case 12: { + message.launchStage = reader.int32(); + break; + } + case 13: { + if (!(message.monitoredResourceTypes && message.monitoredResourceTypes.length)) + message.monitoredResourceTypes = []; + message.monitoredResourceTypes.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MetricDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MetricDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MetricDescriptor} MetricDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MetricDescriptor message. + * @function verify + * @memberof google.api.MetricDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MetricDescriptor.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.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) { + var error = $root.google.api.LabelDescriptor.verify(message.labels[i]); + if (error) + return "labels." + error; + } + } + if (message.metricKind != null && message.hasOwnProperty("metricKind")) + switch (message.metricKind) { + default: + return "metricKind: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + switch (message.valueType) { + default: + return "valueType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.monitoredResourceTypes != null && message.hasOwnProperty("monitoredResourceTypes")) { + if (!Array.isArray(message.monitoredResourceTypes)) + return "monitoredResourceTypes: array expected"; + for (var i = 0; i < message.monitoredResourceTypes.length; ++i) + if (!$util.isString(message.monitoredResourceTypes[i])) + return "monitoredResourceTypes: string[] expected"; + } + return null; + }; + + /** + * Creates a MetricDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MetricDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.MetricDescriptor} MetricDescriptor + */ + MetricDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MetricDescriptor) + return object; + var message = new $root.google.api.MetricDescriptor(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.api.MetricDescriptor.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) { + if (typeof object.labels[i] !== "object") + throw TypeError(".google.api.MetricDescriptor.labels: object expected"); + message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i]); + } + } + switch (object.metricKind) { + default: + if (typeof object.metricKind === "number") { + message.metricKind = object.metricKind; + break; + } + break; + case "METRIC_KIND_UNSPECIFIED": + case 0: + message.metricKind = 0; + break; + case "GAUGE": + case 1: + message.metricKind = 1; + break; + case "DELTA": + case 2: + message.metricKind = 2; + break; + case "CUMULATIVE": + case 3: + message.metricKind = 3; + break; + } + switch (object.valueType) { + default: + if (typeof object.valueType === "number") { + message.valueType = object.valueType; + break; + } + break; + case "VALUE_TYPE_UNSPECIFIED": + case 0: + message.valueType = 0; + break; + case "BOOL": + case 1: + message.valueType = 1; + break; + case "INT64": + case 2: + message.valueType = 2; + break; + case "DOUBLE": + case 3: + message.valueType = 3; + break; + case "STRING": + case 4: + message.valueType = 4; + break; + case "DISTRIBUTION": + case 5: + message.valueType = 5; + break; + case "MONEY": + case 6: + message.valueType = 6; + break; + } + if (object.unit != null) + message.unit = String(object.unit); + if (object.description != null) + message.description = String(object.description); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.api.MetricDescriptor.metadata: object expected"); + message.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.fromObject(object.metadata); + } + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + if (object.monitoredResourceTypes) { + if (!Array.isArray(object.monitoredResourceTypes)) + throw TypeError(".google.api.MetricDescriptor.monitoredResourceTypes: array expected"); + message.monitoredResourceTypes = []; + for (var i = 0; i < object.monitoredResourceTypes.length; ++i) + message.monitoredResourceTypes[i] = String(object.monitoredResourceTypes[i]); + } + return message; + }; + + /** + * Creates a plain object from a MetricDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MetricDescriptor + * @static + * @param {google.api.MetricDescriptor} message MetricDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MetricDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.labels = []; + object.monitoredResourceTypes = []; + } + if (options.defaults) { + object.name = ""; + object.metricKind = options.enums === String ? "METRIC_KIND_UNSPECIFIED" : 0; + object.valueType = options.enums === String ? "VALUE_TYPE_UNSPECIFIED" : 0; + object.unit = ""; + object.description = ""; + object.displayName = ""; + object.type = ""; + object.metadata = null; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = $root.google.api.LabelDescriptor.toObject(message.labels[j], options); + } + if (message.metricKind != null && message.hasOwnProperty("metricKind")) + object.metricKind = options.enums === String ? $root.google.api.MetricDescriptor.MetricKind[message.metricKind] === undefined ? message.metricKind : $root.google.api.MetricDescriptor.MetricKind[message.metricKind] : message.metricKind; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = options.enums === String ? $root.google.api.MetricDescriptor.ValueType[message.valueType] === undefined ? message.valueType : $root.google.api.MetricDescriptor.ValueType[message.valueType] : message.valueType; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.toObject(message.metadata, options); + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + if (message.monitoredResourceTypes && message.monitoredResourceTypes.length) { + object.monitoredResourceTypes = []; + for (var j = 0; j < message.monitoredResourceTypes.length; ++j) + object.monitoredResourceTypes[j] = message.monitoredResourceTypes[j]; + } + return object; + }; + + /** + * Converts this MetricDescriptor to JSON. + * @function toJSON + * @memberof google.api.MetricDescriptor + * @instance + * @returns {Object.} JSON object + */ + MetricDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MetricDescriptor + * @function getTypeUrl + * @memberof google.api.MetricDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MetricDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MetricDescriptor"; + }; + + MetricDescriptor.MetricDescriptorMetadata = (function() { + + /** + * Properties of a MetricDescriptorMetadata. + * @memberof google.api.MetricDescriptor + * @interface IMetricDescriptorMetadata + * @property {google.api.LaunchStage|null} [launchStage] MetricDescriptorMetadata launchStage + * @property {google.protobuf.IDuration|null} [samplePeriod] MetricDescriptorMetadata samplePeriod + * @property {google.protobuf.IDuration|null} [ingestDelay] MetricDescriptorMetadata ingestDelay + */ + + /** + * Constructs a new MetricDescriptorMetadata. + * @memberof google.api.MetricDescriptor + * @classdesc Represents a MetricDescriptorMetadata. + * @implements IMetricDescriptorMetadata + * @constructor + * @param {google.api.MetricDescriptor.IMetricDescriptorMetadata=} [properties] Properties to set + */ + function MetricDescriptorMetadata(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]]; + } + + /** + * MetricDescriptorMetadata launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @instance + */ + MetricDescriptorMetadata.prototype.launchStage = 0; + + /** + * MetricDescriptorMetadata samplePeriod. + * @member {google.protobuf.IDuration|null|undefined} samplePeriod + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @instance + */ + MetricDescriptorMetadata.prototype.samplePeriod = null; + + /** + * MetricDescriptorMetadata ingestDelay. + * @member {google.protobuf.IDuration|null|undefined} ingestDelay + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @instance + */ + MetricDescriptorMetadata.prototype.ingestDelay = null; + + /** + * Creates a new MetricDescriptorMetadata instance using the specified properties. + * @function create + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {google.api.MetricDescriptor.IMetricDescriptorMetadata=} [properties] Properties to set + * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata instance + */ + MetricDescriptorMetadata.create = function create(properties) { + return new MetricDescriptorMetadata(properties); + }; + + /** + * Encodes the specified MetricDescriptorMetadata message. Does not implicitly {@link google.api.MetricDescriptor.MetricDescriptorMetadata.verify|verify} messages. + * @function encode + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {google.api.MetricDescriptor.IMetricDescriptorMetadata} message MetricDescriptorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricDescriptorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.launchStage); + if (message.samplePeriod != null && Object.hasOwnProperty.call(message, "samplePeriod")) + $root.google.protobuf.Duration.encode(message.samplePeriod, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.ingestDelay != null && Object.hasOwnProperty.call(message, "ingestDelay")) + $root.google.protobuf.Duration.encode(message.ingestDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MetricDescriptorMetadata message, length delimited. Does not implicitly {@link google.api.MetricDescriptor.MetricDescriptorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {google.api.MetricDescriptor.IMetricDescriptorMetadata} message MetricDescriptorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricDescriptorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MetricDescriptorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricDescriptorMetadata.decode = function 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.MetricDescriptor.MetricDescriptorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.launchStage = reader.int32(); + break; + } + case 2: { + message.samplePeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 3: { + message.ingestDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MetricDescriptorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricDescriptorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MetricDescriptorMetadata message. + * @function verify + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MetricDescriptorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.samplePeriod != null && message.hasOwnProperty("samplePeriod")) { + var error = $root.google.protobuf.Duration.verify(message.samplePeriod); + if (error) + return "samplePeriod." + error; + } + if (message.ingestDelay != null && message.hasOwnProperty("ingestDelay")) { + var error = $root.google.protobuf.Duration.verify(message.ingestDelay); + if (error) + return "ingestDelay." + error; + } + return null; + }; + + /** + * Creates a MetricDescriptorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata + */ + MetricDescriptorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MetricDescriptor.MetricDescriptorMetadata) + return object; + var message = new $root.google.api.MetricDescriptor.MetricDescriptorMetadata(); + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + if (object.samplePeriod != null) { + if (typeof object.samplePeriod !== "object") + throw TypeError(".google.api.MetricDescriptor.MetricDescriptorMetadata.samplePeriod: object expected"); + message.samplePeriod = $root.google.protobuf.Duration.fromObject(object.samplePeriod); + } + if (object.ingestDelay != null) { + if (typeof object.ingestDelay !== "object") + throw TypeError(".google.api.MetricDescriptor.MetricDescriptorMetadata.ingestDelay: object expected"); + message.ingestDelay = $root.google.protobuf.Duration.fromObject(object.ingestDelay); + } + return message; + }; + + /** + * Creates a plain object from a MetricDescriptorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {google.api.MetricDescriptor.MetricDescriptorMetadata} message MetricDescriptorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MetricDescriptorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + object.samplePeriod = null; + object.ingestDelay = null; + } + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + if (message.samplePeriod != null && message.hasOwnProperty("samplePeriod")) + object.samplePeriod = $root.google.protobuf.Duration.toObject(message.samplePeriod, options); + if (message.ingestDelay != null && message.hasOwnProperty("ingestDelay")) + object.ingestDelay = $root.google.protobuf.Duration.toObject(message.ingestDelay, options); + return object; + }; + + /** + * Converts this MetricDescriptorMetadata to JSON. + * @function toJSON + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @instance + * @returns {Object.} JSON object + */ + MetricDescriptorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MetricDescriptorMetadata + * @function getTypeUrl + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MetricDescriptorMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MetricDescriptor.MetricDescriptorMetadata"; + }; + + return MetricDescriptorMetadata; + })(); + + /** + * MetricKind enum. + * @name google.api.MetricDescriptor.MetricKind + * @enum {number} + * @property {number} METRIC_KIND_UNSPECIFIED=0 METRIC_KIND_UNSPECIFIED value + * @property {number} GAUGE=1 GAUGE value + * @property {number} DELTA=2 DELTA value + * @property {number} CUMULATIVE=3 CUMULATIVE value + */ + MetricDescriptor.MetricKind = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "METRIC_KIND_UNSPECIFIED"] = 0; + values[valuesById[1] = "GAUGE"] = 1; + values[valuesById[2] = "DELTA"] = 2; + values[valuesById[3] = "CUMULATIVE"] = 3; + return values; + })(); + + /** + * ValueType enum. + * @name google.api.MetricDescriptor.ValueType + * @enum {number} + * @property {number} VALUE_TYPE_UNSPECIFIED=0 VALUE_TYPE_UNSPECIFIED value + * @property {number} BOOL=1 BOOL value + * @property {number} INT64=2 INT64 value + * @property {number} DOUBLE=3 DOUBLE value + * @property {number} STRING=4 STRING value + * @property {number} DISTRIBUTION=5 DISTRIBUTION value + * @property {number} MONEY=6 MONEY value + */ + MetricDescriptor.ValueType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VALUE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "BOOL"] = 1; + values[valuesById[2] = "INT64"] = 2; + values[valuesById[3] = "DOUBLE"] = 3; + values[valuesById[4] = "STRING"] = 4; + values[valuesById[5] = "DISTRIBUTION"] = 5; + values[valuesById[6] = "MONEY"] = 6; + return values; + })(); + + return MetricDescriptor; + })(); + + api.Metric = (function() { + + /** + * Properties of a Metric. + * @memberof google.api + * @interface IMetric + * @property {string|null} [type] Metric type + * @property {Object.|null} [labels] Metric labels + */ + + /** + * Constructs a new Metric. + * @memberof google.api + * @classdesc Represents a Metric. + * @implements IMetric + * @constructor + * @param {google.api.IMetric=} [properties] Properties to set + */ + function Metric(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metric type. + * @member {string} type + * @memberof google.api.Metric + * @instance + */ + Metric.prototype.type = ""; + + /** + * Metric labels. + * @member {Object.} labels + * @memberof google.api.Metric + * @instance + */ + Metric.prototype.labels = $util.emptyObject; + + /** + * Creates a new Metric instance using the specified properties. + * @function create + * @memberof google.api.Metric + * @static + * @param {google.api.IMetric=} [properties] Properties to set + * @returns {google.api.Metric} Metric instance + */ + Metric.create = function create(properties) { + return new Metric(properties); + }; + + /** + * Encodes the specified Metric message. Does not implicitly {@link google.api.Metric.verify|verify} messages. + * @function encode + * @memberof google.api.Metric + * @static + * @param {google.api.IMetric} message Metric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metric.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.type); + return writer; + }; + + /** + * Encodes the specified Metric message, length delimited. Does not implicitly {@link google.api.Metric.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Metric + * @static + * @param {google.api.IMetric} message Metric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metric.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metric message from the specified reader or buffer. + * @function decode + * @memberof google.api.Metric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Metric} Metric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metric.decode = function 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.Metric(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.type = reader.string(); + break; + } + case 2: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metric message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Metric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Metric} Metric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metric.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metric message. + * @function verify + * @memberof google.api.Metric + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metric.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.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a Metric message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Metric + * @static + * @param {Object.} object Plain object + * @returns {google.api.Metric} Metric + */ + Metric.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Metric) + return object; + var message = new $root.google.api.Metric(); + if (object.type != null) + message.type = String(object.type); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.api.Metric.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a Metric message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Metric + * @static + * @param {google.api.Metric} message Metric + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metric.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) + object.type = ""; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + return object; + }; + + /** + * Converts this Metric to JSON. + * @function toJSON + * @memberof google.api.Metric + * @instance + * @returns {Object.} JSON object + */ + Metric.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Metric + * @function getTypeUrl + * @memberof google.api.Metric + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metric.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Metric"; + }; + + return Metric; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + + return FileDescriptorSet; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {string|null} [edition] FileDescriptorProto edition + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * FileDescriptorProto edition. + * @member {string} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = ""; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 13: { + message.edition = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + if (!$util.isString(message.edition)) + return "edition: string expected"; + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + if (object.edition != null) + message.edition = String(object.edition); + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + object.edition = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = message.edition; + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [phpGenericServices] FileOptions phpGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions phpGenericServices. + * @member {boolean} phpGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) + writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 42: { + message.phpGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + if (typeof message.phpGenericServices !== "boolean") + return "phpGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.phpGenericServices != null) + message.phpGenericServices = Boolean(object.phpGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = true; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpGenericServices = false; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + object.phpGenericServices = message.phpGenericServices; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) { + writer.uint32(/* id 1052, wireType 2 =*/8418).fork(); + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.int32(message[".google.api.fieldBehavior"][i]); + writer.ldelim(); + } + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 15: { + message.unverifiedLazy = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 10: { + message.weak = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1052: { + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; + } + } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object.unverifiedLazy = false; + object[".google.api.resourceReference"] = null; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldOptions + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions"; + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumOptions"; + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceOptions + * @function getTypeUrl + * @memberof google.protobuf.ServiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + */ + + /** + * 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 && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 34: { + message.idempotencyLevel = reader.int32(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 72295728: { + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + } + case 1051: { + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + } + 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) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; + case "IDEMPOTENCY_UNKNOWN": + case 0: + message.idempotencyLevel = 0; + break; + case "NO_SIDE_EFFECTS": + case 1: + message.idempotencyLevel = 1; + break; + case "IDEMPOTENT": + case 2: + message.idempotencyLevel = 2; + break; + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + if (object[".google.api.methodSignature"]) { + if (!Array.isArray(object[".google.api.methodSignature"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); + message[".google.api.methodSignature"] = []; + for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) + message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); + } + 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] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { + object[".google.api.methodSignature"] = []; + for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) + object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodOptions + * @function getTypeUrl + * @memberof google.protobuf.MethodOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodOptions"; + }; + + /** + * IdempotencyLevel enum. + * @name google.protobuf.MethodOptions.IdempotencyLevel + * @enum {number} + * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value + * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value + * @property {number} IDEMPOTENT=2 IDEMPOTENT value + */ + MethodOptions.IdempotencyLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; + values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; + values[valuesById[2] = "IDEMPOTENT"] = 2; + return values; + })(); + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number|null} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue + * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifierValue = ""; + + /** + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negativeIntValue. + * @member {number|Long} negativeIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption doubleValue. + * @member {number} doubleValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.doubleValue = 0; + + /** + * UninterpretedOption stringValue. + * @member {Uint8Array} stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + + /** + * UninterpretedOption aggregateValue. + * @member {string} aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + } + case 3: { + message.identifierValue = reader.string(); + break; + } + case 4: { + message.positiveIntValue = reader.uint64(); + break; + } + case 5: { + message.negativeIntValue = reader.int64(); + break; + } + case 6: { + message.doubleValue = reader.double(); + break; + } + case 7: { + message.stringValue = reader.bytes(); + break; + } + case 8: { + message.aggregateValue = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length >= 0) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : 0; + object.doubleValue = 0; + if (options.bytes === String) + object.stringValue = ""; + else { + object.stringValue = []; + if (options.bytes !== Array) + object.stringValue = $util.newBuffer(object.stringValue); + } + object.aggregateValue = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + object.aggregateValue = message.aggregateValue; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UninterpretedOption + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.namePart = reader.string(); + break; + } + case 2: { + message.isExtension = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!message.hasOwnProperty("isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NamePart + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + */ + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); + }; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SourceCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Location + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + */ + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); + }; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [sourceFile] Annotation sourceFile + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation sourceFile. + * @member {string} sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; + + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Annotation semantic. + * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.semantic = 0; + + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + message.sourceFile = reader.string(); + break; + } + case 3: { + message.begin = reader.int32(); + break; + } + case 4: { + message.end = reader.int32(); + break; + } + case 5: { + message.semantic = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.semantic != null && message.hasOwnProperty("semantic")) + switch (message.semantic) { + default: + return "semantic: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; + case "NONE": + case 0: + message.semantic = 0; + break; + case "SET": + case 1: + message.semantic = 1; + break; + case "ALIAS": + case 2: + message.semantic = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.semantic != null && message.hasOwnProperty("semantic")) + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Annotation + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; + }; + + /** + * Semantic enum. + * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} SET=1 SET value + * @property {number} ALIAS=2 ALIAS value + */ + Annotation.Semantic = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "SET"] = 1; + values[valuesById[2] = "ALIAS"] = 2; + return values; + })(); + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance + */ + Any.create = function create(properties) { + return new Any(properties); + }; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any + * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Any + * @function getTypeUrl + * @memberof google.protobuf.Any + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Any"; + }; + + return Any; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @implements ITimestamp + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. + * @function create + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance + */ + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Timestamp + * @function getTypeUrl + * @memberof google.protobuf.Timestamp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Timestamp"; + }; + + return Timestamp; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Duration + * @function getTypeUrl + * @memberof google.protobuf.Duration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Duration"; + }; + + return Duration; + })(); + + protobuf.DoubleValue = (function() { + + /** + * Properties of a DoubleValue. + * @memberof google.protobuf + * @interface IDoubleValue + * @property {number|null} [value] DoubleValue value + */ + + /** + * Constructs a new DoubleValue. + * @memberof google.protobuf + * @classdesc Represents a DoubleValue. + * @implements IDoubleValue + * @constructor + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + */ + function DoubleValue(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]]; + } + + /** + * DoubleValue value. + * @member {number} value + * @memberof google.protobuf.DoubleValue + * @instance + */ + DoubleValue.prototype.value = 0; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @function create + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + * @returns {google.protobuf.DoubleValue} DoubleValue instance + */ + DoubleValue.create = function create(properties) { + return new DoubleValue(properties); + }; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); + return writer; + }; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decode = function 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.DoubleValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DoubleValue message. + * @function verify + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoubleValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DoubleValue} DoubleValue + */ + DoubleValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DoubleValue) + return object; + var message = new $root.google.protobuf.DoubleValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.DoubleValue} message DoubleValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoubleValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this DoubleValue to JSON. + * @function toJSON + * @memberof google.protobuf.DoubleValue + * @instance + * @returns {Object.} JSON object + */ + DoubleValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DoubleValue + * @function getTypeUrl + * @memberof google.protobuf.DoubleValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DoubleValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DoubleValue"; + }; + + return DoubleValue; + })(); + + protobuf.FloatValue = (function() { + + /** + * Properties of a FloatValue. + * @memberof google.protobuf + * @interface IFloatValue + * @property {number|null} [value] FloatValue value + */ + + /** + * Constructs a new FloatValue. + * @memberof google.protobuf + * @classdesc Represents a FloatValue. + * @implements IFloatValue + * @constructor + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + */ + function FloatValue(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]]; + } + + /** + * FloatValue value. + * @member {number} value + * @memberof google.protobuf.FloatValue + * @instance + */ + FloatValue.prototype.value = 0; + + /** + * Creates a new FloatValue instance using the specified properties. + * @function create + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + * @returns {google.protobuf.FloatValue} FloatValue instance + */ + FloatValue.create = function create(properties) { + return new FloatValue(properties); + }; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); + return writer; + }; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decode = function 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.FloatValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FloatValue message. + * @function verify + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FloatValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FloatValue} FloatValue + */ + FloatValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FloatValue) + return object; + var message = new $root.google.protobuf.FloatValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.FloatValue} message FloatValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FloatValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this FloatValue to JSON. + * @function toJSON + * @memberof google.protobuf.FloatValue + * @instance + * @returns {Object.} JSON object + */ + FloatValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FloatValue + * @function getTypeUrl + * @memberof google.protobuf.FloatValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FloatValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FloatValue"; + }; + + return FloatValue; + })(); + + protobuf.Int64Value = (function() { + + /** + * Properties of an Int64Value. + * @memberof google.protobuf + * @interface IInt64Value + * @property {number|Long|null} [value] Int64Value value + */ + + /** + * Constructs a new Int64Value. + * @memberof google.protobuf + * @classdesc Represents an Int64Value. + * @implements IInt64Value + * @constructor + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + */ + function Int64Value(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]]; + } + + /** + * Int64Value value. + * @member {number|Long} value + * @memberof google.protobuf.Int64Value + * @instance + */ + Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Int64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + * @returns {google.protobuf.Int64Value} Int64Value instance + */ + Int64Value.create = function create(properties) { + return new Int64Value(properties); + }; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); + return writer; + }; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decode = function 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.Int64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int64Value message. + * @function verify + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int64Value} Int64Value + */ + Int64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int64Value) + return object; + var message = new $root.google.protobuf.Int64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = false; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.Int64Value} message Int64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int64Value.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.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; + return object; + }; + + /** + * Converts this Int64Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int64Value + * @instance + * @returns {Object.} JSON object + */ + Int64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Int64Value + * @function getTypeUrl + * @memberof google.protobuf.Int64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int64Value"; + }; + + return Int64Value; + })(); + + protobuf.UInt64Value = (function() { + + /** + * Properties of a UInt64Value. + * @memberof google.protobuf + * @interface IUInt64Value + * @property {number|Long|null} [value] UInt64Value value + */ + + /** + * Constructs a new UInt64Value. + * @memberof google.protobuf + * @classdesc Represents a UInt64Value. + * @implements IUInt64Value + * @constructor + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + */ + function UInt64Value(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]]; + } + + /** + * UInt64Value value. + * @member {number|Long} value + * @memberof google.protobuf.UInt64Value + * @instance + */ + UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new UInt64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + * @returns {google.protobuf.UInt64Value} UInt64Value instance + */ + UInt64Value.create = function create(properties) { + return new UInt64Value(properties); + }; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); + return writer; + }; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decode = function 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.UInt64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.uint64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt64Value message. + * @function verify + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt64Value} UInt64Value + */ + UInt64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt64Value) + return object; + var message = new $root.google.protobuf.UInt64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = true; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.UInt64Value} message UInt64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber(true) : message.value; + return object; + }; + + /** + * Converts this UInt64Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt64Value + * @instance + * @returns {Object.} JSON object + */ + UInt64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UInt64Value + * @function getTypeUrl + * @memberof google.protobuf.UInt64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt64Value"; + }; + + return UInt64Value; + })(); + + protobuf.Int32Value = (function() { + + /** + * Properties of an Int32Value. + * @memberof google.protobuf + * @interface IInt32Value + * @property {number|null} [value] Int32Value value + */ + + /** + * Constructs a new Int32Value. + * @memberof google.protobuf + * @classdesc Represents an Int32Value. + * @implements IInt32Value + * @constructor + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + */ + function Int32Value(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]]; + } + + /** + * Int32Value value. + * @member {number} value + * @memberof google.protobuf.Int32Value + * @instance + */ + Int32Value.prototype.value = 0; + + /** + * Creates a new Int32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + * @returns {google.protobuf.Int32Value} Int32Value instance + */ + Int32Value.create = function create(properties) { + return new Int32Value(properties); + }; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); + return writer; + }; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decode = function 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.Int32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int32Value message. + * @function verify + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int32Value} Int32Value + */ + Int32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int32Value) + return object; + var message = new $root.google.protobuf.Int32Value(); + if (object.value != null) + message.value = object.value | 0; + return message; + }; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.Int32Value} message Int32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this Int32Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int32Value + * @instance + * @returns {Object.} JSON object + */ + Int32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Int32Value + * @function getTypeUrl + * @memberof google.protobuf.Int32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int32Value"; + }; + + return Int32Value; + })(); + + protobuf.UInt32Value = (function() { + + /** + * Properties of a UInt32Value. + * @memberof google.protobuf + * @interface IUInt32Value + * @property {number|null} [value] UInt32Value value + */ + + /** + * Constructs a new UInt32Value. + * @memberof google.protobuf + * @classdesc Represents a UInt32Value. + * @implements IUInt32Value + * @constructor + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + */ + function UInt32Value(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]]; + } + + /** + * UInt32Value value. + * @member {number} value + * @memberof google.protobuf.UInt32Value + * @instance + */ + UInt32Value.prototype.value = 0; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + * @returns {google.protobuf.UInt32Value} UInt32Value instance + */ + UInt32Value.create = function create(properties) { + return new UInt32Value(properties); + }; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); + return writer; + }; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decode = function 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.UInt32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt32Value message. + * @function verify + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt32Value} UInt32Value + */ + UInt32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt32Value) + return object; + var message = new $root.google.protobuf.UInt32Value(); + if (object.value != null) + message.value = object.value >>> 0; + return message; + }; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.UInt32Value} message UInt32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this UInt32Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt32Value + * @instance + * @returns {Object.} JSON object + */ + UInt32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UInt32Value + * @function getTypeUrl + * @memberof google.protobuf.UInt32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt32Value"; + }; + + return UInt32Value; + })(); + + protobuf.BoolValue = (function() { + + /** + * Properties of a BoolValue. + * @memberof google.protobuf + * @interface IBoolValue + * @property {boolean|null} [value] BoolValue value + */ + + /** + * Constructs a new BoolValue. + * @memberof google.protobuf + * @classdesc Represents a BoolValue. + * @implements IBoolValue + * @constructor + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + */ + function BoolValue(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]]; + } + + /** + * BoolValue value. + * @member {boolean} value + * @memberof google.protobuf.BoolValue + * @instance + */ + BoolValue.prototype.value = false; + + /** + * Creates a new BoolValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + * @returns {google.protobuf.BoolValue} BoolValue instance + */ + BoolValue.create = function create(properties) { + return new BoolValue(properties); + }; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); + return writer; + }; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decode = function 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.BoolValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoolValue message. + * @function verify + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoolValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "boolean") + return "value: boolean expected"; + return null; + }; + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BoolValue} BoolValue + */ + BoolValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BoolValue) + return object; + var message = new $root.google.protobuf.BoolValue(); + if (object.value != null) + message.value = Boolean(object.value); + return message; + }; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.BoolValue} message BoolValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoolValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = false; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this BoolValue to JSON. + * @function toJSON + * @memberof google.protobuf.BoolValue + * @instance + * @returns {Object.} JSON object + */ + BoolValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BoolValue + * @function getTypeUrl + * @memberof google.protobuf.BoolValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoolValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BoolValue"; + }; + + return BoolValue; + })(); + + protobuf.StringValue = (function() { + + /** + * Properties of a StringValue. + * @memberof google.protobuf + * @interface IStringValue + * @property {string|null} [value] StringValue value + */ + + /** + * Constructs a new StringValue. + * @memberof google.protobuf + * @classdesc Represents a StringValue. + * @implements IStringValue + * @constructor + * @param {google.protobuf.IStringValue=} [properties] Properties to set + */ + function StringValue(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]]; + } + + /** + * StringValue value. + * @member {string} value + * @memberof google.protobuf.StringValue + * @instance + */ + StringValue.prototype.value = ""; + + /** + * Creates a new StringValue instance using the specified properties. + * @function create + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue=} [properties] Properties to set + * @returns {google.protobuf.StringValue} StringValue instance + */ + StringValue.create = function create(properties) { + return new StringValue(properties); + }; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + return writer; + }; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decode = function 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.StringValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StringValue message. + * @function verify + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StringValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.StringValue} StringValue + */ + StringValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.StringValue) + return object; + var message = new $root.google.protobuf.StringValue(); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.StringValue} message StringValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StringValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this StringValue to JSON. + * @function toJSON + * @memberof google.protobuf.StringValue + * @instance + * @returns {Object.} JSON object + */ + StringValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StringValue + * @function getTypeUrl + * @memberof google.protobuf.StringValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StringValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.StringValue"; + }; + + return StringValue; + })(); + + protobuf.BytesValue = (function() { + + /** + * Properties of a BytesValue. + * @memberof google.protobuf + * @interface IBytesValue + * @property {Uint8Array|null} [value] BytesValue value + */ + + /** + * Constructs a new BytesValue. + * @memberof google.protobuf + * @classdesc Represents a BytesValue. + * @implements IBytesValue + * @constructor + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + */ + function BytesValue(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]]; + } + + /** + * BytesValue value. + * @member {Uint8Array} value + * @memberof google.protobuf.BytesValue + * @instance + */ + BytesValue.prototype.value = $util.newBuffer([]); + + /** + * Creates a new BytesValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + * @returns {google.protobuf.BytesValue} BytesValue instance + */ + BytesValue.create = function create(properties) { + return new BytesValue(properties); + }; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decode = function 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.BytesValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BytesValue message. + * @function verify + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BytesValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BytesValue} BytesValue + */ + BytesValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BytesValue) + return object; + var message = new $root.google.protobuf.BytesValue(); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.BytesValue} message BytesValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BytesValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this BytesValue to JSON. + * @function toJSON + * @memberof google.protobuf.BytesValue + * @instance + * @returns {Object.} JSON object + */ + BytesValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BytesValue + * @function getTypeUrl + * @memberof google.protobuf.BytesValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BytesValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BytesValue"; + }; + + return BytesValue; + })(); + + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldMask + * @function getTypeUrl + * @memberof google.protobuf.FieldMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldMask"; + }; + + return FieldMask; + })(); + + protobuf.Struct = (function() { + + /** + * Properties of a Struct. + * @memberof google.protobuf + * @interface IStruct + * @property {Object.|null} [fields] Struct fields + */ + + /** + * Constructs a new Struct. + * @memberof google.protobuf + * @classdesc Represents a Struct. + * @implements IStruct + * @constructor + * @param {google.protobuf.IStruct=} [properties] Properties to set + */ + function Struct(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Struct fields. + * @member {Object.} fields + * @memberof google.protobuf.Struct + * @instance + */ + Struct.prototype.fields = $util.emptyObject; + + /** + * Creates a new Struct instance using the specified properties. + * @function create + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct=} [properties] Properties to set + * @returns {google.protobuf.Struct} Struct instance + */ + Struct.create = function create(properties) { + return new Struct(properties); + }; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decode = function 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.Struct(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.fields[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Struct message. + * @function verify + * @memberof google.protobuf.Struct + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Struct.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fields != null && message.hasOwnProperty("fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.fields[key[i]]); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Struct + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Struct} Struct + */ + Struct.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Struct) + return object; + var message = new $root.google.protobuf.Struct(); + if (object.fields) { + if (typeof object.fields !== "object") + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (typeof object.fields[keys[i]] !== "object") + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.Struct} message Struct + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Struct.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) + object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options); + } + return object; + }; + + /** + * Converts this Struct to JSON. + * @function toJSON + * @memberof google.protobuf.Struct + * @instance + * @returns {Object.} JSON object + */ + Struct.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Struct + * @function getTypeUrl + * @memberof google.protobuf.Struct + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Struct.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Struct"; + }; + + return Struct; + })(); + + protobuf.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.protobuf + * @interface IValue + * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue + * @property {number|null} [numberValue] Value numberValue + * @property {string|null} [stringValue] Value stringValue + * @property {boolean|null} [boolValue] Value boolValue + * @property {google.protobuf.IStruct|null} [structValue] Value structValue + * @property {google.protobuf.IListValue|null} [listValue] Value listValue + */ + + /** + * Constructs a new Value. + * @memberof google.protobuf + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.protobuf.IValue=} [properties] Properties to set + */ + function Value(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]]; + } + + /** + * Value nullValue. + * @member {google.protobuf.NullValue|null|undefined} nullValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.nullValue = null; + + /** + * Value numberValue. + * @member {number|null|undefined} numberValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.numberValue = null; + + /** + * Value stringValue. + * @member {string|null|undefined} stringValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.stringValue = null; + + /** + * Value boolValue. + * @member {boolean|null|undefined} boolValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.boolValue = null; + + /** + * Value structValue. + * @member {google.protobuf.IStruct|null|undefined} structValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.structValue = null; + + /** + * Value listValue. + * @member {google.protobuf.IListValue|null|undefined} listValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.listValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Value kind. + * @member {"nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"|undefined} kind + * @memberof google.protobuf.Value + * @instance + */ + Object.defineProperty(Value.prototype, "kind", { + get: $util.oneOfGetter($oneOfFields = ["nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue=} [properties] Properties to set + * @returns {google.protobuf.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nullValue); + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.numberValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.stringValue); + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.boolValue); + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) + $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) + $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function 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.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.nullValue = reader.int32(); + break; + } + case 2: { + message.numberValue = reader.double(); + break; + } + case 3: { + message.stringValue = reader.string(); + break; + } + case 4: { + message.boolValue = reader.bool(); + break; + } + case 5: { + message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 6: { + message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.protobuf.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + properties.kind = 1; + switch (message.nullValue) { + default: + return "nullValue: enum value expected"; + case 0: + break; + } + } + if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.numberValue !== "number") + return "numberValue: number expected"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.boolValue !== "boolean") + return "boolValue: boolean expected"; + } + if (message.structValue != null && message.hasOwnProperty("structValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.Struct.verify(message.structValue); + if (error) + return "structValue." + error; + } + } + if (message.listValue != null && message.hasOwnProperty("listValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.ListValue.verify(message.listValue); + if (error) + return "listValue." + error; + } + } + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Value} Value + */ + Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Value) + return object; + var message = new $root.google.protobuf.Value(); + switch (object.nullValue) { + default: + if (typeof object.nullValue === "number") { + message.nullValue = object.nullValue; + break; + } + break; + case "NULL_VALUE": + case 0: + message.nullValue = 0; + break; + } + if (object.numberValue != null) + message.numberValue = Number(object.numberValue); + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + if (object.boolValue != null) + message.boolValue = Boolean(object.boolValue); + if (object.structValue != null) { + if (typeof object.structValue !== "object") + throw TypeError(".google.protobuf.Value.structValue: object expected"); + message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue); + } + if (object.listValue != null) { + if (typeof object.listValue !== "object") + throw TypeError(".google.protobuf.Value.listValue: object expected"); + message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue); + } + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; + if (options.oneofs) + object.kind = "nullValue"; + } + if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + object.numberValue = options.json && !isFinite(message.numberValue) ? String(message.numberValue) : message.numberValue; + if (options.oneofs) + object.kind = "numberValue"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.kind = "stringValue"; + } + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + object.boolValue = message.boolValue; + if (options.oneofs) + object.kind = "boolValue"; + } + if (message.structValue != null && message.hasOwnProperty("structValue")) { + object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options); + if (options.oneofs) + object.kind = "structValue"; + } + if (message.listValue != null && message.hasOwnProperty("listValue")) { + object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options); + if (options.oneofs) + object.kind = "listValue"; + } + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.protobuf.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.protobuf.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Value"; + }; + + return Value; + })(); + + /** + * NullValue enum. + * @name google.protobuf.NullValue + * @enum {number} + * @property {number} NULL_VALUE=0 NULL_VALUE value + */ + protobuf.NullValue = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NULL_VALUE"] = 0; + return values; + })(); + + protobuf.ListValue = (function() { + + /** + * Properties of a ListValue. + * @memberof google.protobuf + * @interface IListValue + * @property {Array.|null} [values] ListValue values + */ + + /** + * Constructs a new ListValue. + * @memberof google.protobuf + * @classdesc Represents a ListValue. + * @implements IListValue + * @constructor + * @param {google.protobuf.IListValue=} [properties] Properties to set + */ + function ListValue(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListValue values. + * @member {Array.} values + * @memberof google.protobuf.ListValue + * @instance + */ + ListValue.prototype.values = $util.emptyArray; + + /** + * Creates a new ListValue instance using the specified properties. + * @function create + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue=} [properties] Properties to set + * @returns {google.protobuf.ListValue} ListValue instance + */ + ListValue.create = function create(properties) { + return new ListValue(properties); + }; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decode = function 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.ListValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListValue message. + * @function verify + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.values[i]); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ListValue} ListValue + */ + ListValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ListValue) + return object; + var message = new $root.google.protobuf.ListValue(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.protobuf.ListValue.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.protobuf.ListValue.values: object expected"); + message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.ListValue} message ListValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options); + } + return object; + }; + + /** + * Converts this ListValue to JSON. + * @function toJSON + * @memberof google.protobuf.ListValue + * @instance + * @returns {Object.} JSON object + */ + ListValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListValue + * @function getTypeUrl + * @memberof google.protobuf.ListValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ListValue"; + }; + + return ListValue; + })(); + + return protobuf; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { + + /** + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details + */ + + /** + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {google.rpc.IStatus=} [properties] Properties to set + */ + function Status(properties) { + this.details = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Status code. + * @member {number} code + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Status message. + * @member {string} message + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.message = ""; + + /** + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encode + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof google.rpc.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.rpc.Status + * @static + * @param {Object.} object Plain object + * @returns {google.rpc.Status} Status + */ + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) + return object; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof google.rpc.Status + * @static + * @param {google.rpc.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.details = []; + if (options.defaults) { + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); + } + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof google.rpc.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Status + * @function getTypeUrl + * @memberof google.rpc.Status + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.rpc.Status"; + }; + + return Status; + })(); + + return rpc; + })(); + + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + /** + * CalendarPeriod enum. + * @name google.type.CalendarPeriod + * @enum {number} + * @property {number} CALENDAR_PERIOD_UNSPECIFIED=0 CALENDAR_PERIOD_UNSPECIFIED value + * @property {number} DAY=1 DAY value + * @property {number} WEEK=2 WEEK value + * @property {number} FORTNIGHT=3 FORTNIGHT value + * @property {number} MONTH=4 MONTH value + * @property {number} QUARTER=5 QUARTER value + * @property {number} HALF=6 HALF value + * @property {number} YEAR=7 YEAR value + */ + type.CalendarPeriod = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CALENDAR_PERIOD_UNSPECIFIED"] = 0; + values[valuesById[1] = "DAY"] = 1; + values[valuesById[2] = "WEEK"] = 2; + values[valuesById[3] = "FORTNIGHT"] = 3; + values[valuesById[4] = "MONTH"] = 4; + values[valuesById[5] = "QUARTER"] = 5; + values[valuesById[6] = "HALF"] = 6; + values[valuesById[7] = "YEAR"] = 7; + return values; + })(); + + return type; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-monitoring/protos/protos.json b/packages/google-cloud-monitoring/protos/protos.json new file mode 100644 index 00000000000..091e2146d62 --- /dev/null +++ b/packages/google-cloud-monitoring/protos/protos.json @@ -0,0 +1,5157 @@ +{ + "nested": { + "google": { + "nested": { + "monitoring": { + "nested": { + "v3": { + "options": { + "csharp_namespace": "Google.Cloud.Monitoring.V3", + "go_package": "google.golang.org/genproto/googleapis/monitoring/v3;monitoring", + "java_multiple_files": true, + "java_outer_classname": "UptimeServiceProto", + "java_package": "com.google.monitoring.v3", + "php_namespace": "Google\\Cloud\\Monitoring\\V3", + "ruby_package": "Google::Cloud::Monitoring::V3", + "(google.api.resource_definition).type": "monitoring.googleapis.com/TimeSeries", + "(google.api.resource_definition).pattern": "folders/{folder}/timeSeries/{time_series}", + "(google.api.resource_definition).history": "ORIGINALLY_SINGLE_PATTERN" + }, + "nested": { + "AlertPolicy": { + "options": { + "(google.api.resource).type": "monitoring.googleapis.com/AlertPolicy", + "(google.api.resource).pattern": "*" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "documentation": { + "type": "Documentation", + "id": 13 + }, + "userLabels": { + "keyType": "string", + "type": "string", + "id": 16 + }, + "conditions": { + "rule": "repeated", + "type": "Condition", + "id": 12 + }, + "combiner": { + "type": "ConditionCombinerType", + "id": 6 + }, + "enabled": { + "type": "google.protobuf.BoolValue", + "id": 17 + }, + "validity": { + "type": "google.rpc.Status", + "id": 18 + }, + "notificationChannels": { + "rule": "repeated", + "type": "string", + "id": 14 + }, + "creationRecord": { + "type": "MutationRecord", + "id": 10 + }, + "mutationRecord": { + "type": "MutationRecord", + "id": 11 + } + }, + "nested": { + "Documentation": { + "fields": { + "content": { + "type": "string", + "id": 1 + }, + "mimeType": { + "type": "string", + "id": 2 + } + } + }, + "Condition": { + "options": { + "(google.api.resource).type": "monitoring.googleapis.com/AlertPolicyCondition", + "(google.api.resource).pattern": "*" + }, + "oneofs": { + "condition": { + "oneof": [ + "conditionThreshold", + "conditionAbsent", + "conditionMonitoringQueryLanguage" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 12 + }, + "displayName": { + "type": "string", + "id": 6 + }, + "conditionThreshold": { + "type": "MetricThreshold", + "id": 1 + }, + "conditionAbsent": { + "type": "MetricAbsence", + "id": 2 + }, + "conditionMonitoringQueryLanguage": { + "type": "MonitoringQueryLanguageCondition", + "id": 19 + } + }, + "nested": { + "Trigger": { + "oneofs": { + "type": { + "oneof": [ + "count", + "percent" + ] + } + }, + "fields": { + "count": { + "type": "int32", + "id": 1 + }, + "percent": { + "type": "double", + "id": 2 + } + } + }, + "MetricThreshold": { + "fields": { + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "aggregations": { + "rule": "repeated", + "type": "Aggregation", + "id": 8 + }, + "denominatorFilter": { + "type": "string", + "id": 9 + }, + "denominatorAggregations": { + "rule": "repeated", + "type": "Aggregation", + "id": 10 + }, + "comparison": { + "type": "ComparisonType", + "id": 4 + }, + "thresholdValue": { + "type": "double", + "id": 5 + }, + "duration": { + "type": "google.protobuf.Duration", + "id": 6 + }, + "trigger": { + "type": "Trigger", + "id": 7 + } + } + }, + "MetricAbsence": { + "fields": { + "filter": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "aggregations": { + "rule": "repeated", + "type": "Aggregation", + "id": 5 + }, + "duration": { + "type": "google.protobuf.Duration", + "id": 2 + }, + "trigger": { + "type": "Trigger", + "id": 3 + } + } + }, + "MonitoringQueryLanguageCondition": { + "fields": { + "query": { + "type": "string", + "id": 1 + }, + "duration": { + "type": "google.protobuf.Duration", + "id": 2 + }, + "trigger": { + "type": "Trigger", + "id": 3 + } + } + } + } + }, + "ConditionCombinerType": { + "values": { + "COMBINE_UNSPECIFIED": 0, + "AND": 1, + "OR": 2, + "AND_WITH_MATCHING_RESOURCE": 3 + } + } + } + }, + "TypedValue": { + "oneofs": { + "value": { + "oneof": [ + "boolValue", + "int64Value", + "doubleValue", + "stringValue", + "distributionValue" + ] + } + }, + "fields": { + "boolValue": { + "type": "bool", + "id": 1 + }, + "int64Value": { + "type": "int64", + "id": 2 + }, + "doubleValue": { + "type": "double", + "id": 3 + }, + "stringValue": { + "type": "string", + "id": 4 + }, + "distributionValue": { + "type": "google.api.Distribution", + "id": 5 + } + } + }, + "TimeInterval": { + "fields": { + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + } + } + }, + "Aggregation": { + "fields": { + "alignmentPeriod": { + "type": "google.protobuf.Duration", + "id": 1 + }, + "perSeriesAligner": { + "type": "Aligner", + "id": 2 + }, + "crossSeriesReducer": { + "type": "Reducer", + "id": 4 + }, + "groupByFields": { + "rule": "repeated", + "type": "string", + "id": 5 + } + }, + "nested": { + "Aligner": { + "values": { + "ALIGN_NONE": 0, + "ALIGN_DELTA": 1, + "ALIGN_RATE": 2, + "ALIGN_INTERPOLATE": 3, + "ALIGN_NEXT_OLDER": 4, + "ALIGN_MIN": 10, + "ALIGN_MAX": 11, + "ALIGN_MEAN": 12, + "ALIGN_COUNT": 13, + "ALIGN_SUM": 14, + "ALIGN_STDDEV": 15, + "ALIGN_COUNT_TRUE": 16, + "ALIGN_COUNT_FALSE": 24, + "ALIGN_FRACTION_TRUE": 17, + "ALIGN_PERCENTILE_99": 18, + "ALIGN_PERCENTILE_95": 19, + "ALIGN_PERCENTILE_50": 20, + "ALIGN_PERCENTILE_05": 21, + "ALIGN_PERCENT_CHANGE": 23 + } + }, + "Reducer": { + "values": { + "REDUCE_NONE": 0, + "REDUCE_MEAN": 1, + "REDUCE_MIN": 2, + "REDUCE_MAX": 3, + "REDUCE_SUM": 4, + "REDUCE_STDDEV": 5, + "REDUCE_COUNT": 6, + "REDUCE_COUNT_TRUE": 7, + "REDUCE_COUNT_FALSE": 15, + "REDUCE_FRACTION_TRUE": 8, + "REDUCE_PERCENTILE_99": 9, + "REDUCE_PERCENTILE_95": 10, + "REDUCE_PERCENTILE_50": 11, + "REDUCE_PERCENTILE_05": 12 + } + } + } + }, + "ComparisonType": { + "values": { + "COMPARISON_UNSPECIFIED": 0, + "COMPARISON_GT": 1, + "COMPARISON_GE": 2, + "COMPARISON_LT": 3, + "COMPARISON_LE": 4, + "COMPARISON_EQ": 5, + "COMPARISON_NE": 6 + } + }, + "ServiceTier": { + "options": { + "deprecated": true + }, + "values": { + "SERVICE_TIER_UNSPECIFIED": 0, + "SERVICE_TIER_BASIC": 1, + "SERVICE_TIER_PREMIUM": 2 + } + }, + "MutationRecord": { + "fields": { + "mutateTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "mutatedBy": { + "type": "string", + "id": 2 + } + } + }, + "AlertPolicyService": { + "options": { + "(google.api.default_host)": "monitoring.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read" + }, + "methods": { + "ListAlertPolicies": { + "requestType": "ListAlertPoliciesRequest", + "responseType": "ListAlertPoliciesResponse", + "options": { + "(google.api.http).get": "/v3/{name=projects/*}/alertPolicies", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*}/alertPolicies" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetAlertPolicy": { + "requestType": "GetAlertPolicyRequest", + "responseType": "AlertPolicy", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/alertPolicies/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/alertPolicies/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateAlertPolicy": { + "requestType": "CreateAlertPolicyRequest", + "responseType": "AlertPolicy", + "options": { + "(google.api.http).post": "/v3/{name=projects/*}/alertPolicies", + "(google.api.http).body": "alert_policy", + "(google.api.method_signature)": "name,alert_policy" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*}/alertPolicies", + "body": "alert_policy" + } + }, + { + "(google.api.method_signature)": "name,alert_policy" + } + ] + }, + "DeleteAlertPolicy": { + "requestType": "DeleteAlertPolicyRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3/{name=projects/*/alertPolicies/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=projects/*/alertPolicies/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateAlertPolicy": { + "requestType": "UpdateAlertPolicyRequest", + "responseType": "AlertPolicy", + "options": { + "(google.api.http).patch": "/v3/{alert_policy.name=projects/*/alertPolicies/*}", + "(google.api.http).body": "alert_policy", + "(google.api.method_signature)": "update_mask,alert_policy" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3/{alert_policy.name=projects/*/alertPolicies/*}", + "body": "alert_policy" + } + }, + { + "(google.api.method_signature)": "update_mask,alert_policy" + } + ] + } + } + }, + "CreateAlertPolicyRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/AlertPolicy" + } + }, + "alertPolicy": { + "type": "AlertPolicy", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetAlertPolicyRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/AlertPolicy" + } + } + } + }, + "ListAlertPoliciesRequest": { + "fields": { + "name": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/AlertPolicy" + } + }, + "filter": { + "type": "string", + "id": 5 + }, + "orderBy": { + "type": "string", + "id": 6 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListAlertPoliciesResponse": { + "fields": { + "alertPolicies": { + "rule": "repeated", + "type": "AlertPolicy", + "id": 3 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 4 + } + } + }, + "UpdateAlertPolicyRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "alertPolicy": { + "type": "AlertPolicy", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteAlertPolicyRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/AlertPolicy" + } + } + } + }, + "DroppedLabels": { + "fields": { + "label": { + "keyType": "string", + "type": "string", + "id": 1 + } + } + }, + "Group": { + "options": { + "(google.api.resource).type": "monitoring.googleapis.com/Group", + "(google.api.resource).pattern": "*" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "parentName": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 5 + }, + "isCluster": { + "type": "bool", + "id": 6 + } + } + }, + "GroupService": { + "options": { + "(google.api.default_host)": "monitoring.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read" + }, + "methods": { + "ListGroups": { + "requestType": "ListGroupsRequest", + "responseType": "ListGroupsResponse", + "options": { + "(google.api.http).get": "/v3/{name=projects/*}/groups", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*}/groups" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetGroup": { + "requestType": "GetGroupRequest", + "responseType": "Group", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/groups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/groups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateGroup": { + "requestType": "CreateGroupRequest", + "responseType": "Group", + "options": { + "(google.api.http).post": "/v3/{name=projects/*}/groups", + "(google.api.http).body": "group", + "(google.api.method_signature)": "name,group" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*}/groups", + "body": "group" + } + }, + { + "(google.api.method_signature)": "name,group" + } + ] + }, + "UpdateGroup": { + "requestType": "UpdateGroupRequest", + "responseType": "Group", + "options": { + "(google.api.http).put": "/v3/{group.name=projects/*/groups/*}", + "(google.api.http).body": "group", + "(google.api.method_signature)": "group" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "put": "/v3/{group.name=projects/*/groups/*}", + "body": "group" + } + }, + { + "(google.api.method_signature)": "group" + } + ] + }, + "DeleteGroup": { + "requestType": "DeleteGroupRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3/{name=projects/*/groups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=projects/*/groups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListGroupMembers": { + "requestType": "ListGroupMembersRequest", + "responseType": "ListGroupMembersResponse", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/groups/*}/members", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/groups/*}/members" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "ListGroupsRequest": { + "oneofs": { + "filter": { + "oneof": [ + "childrenOfGroup", + "ancestorsOfGroup", + "descendantsOfGroup" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/Group" + } + }, + "childrenOfGroup": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "monitoring.googleapis.com/Group" + } + }, + "ancestorsOfGroup": { + "type": "string", + "id": 3, + "options": { + "(google.api.resource_reference).type": "monitoring.googleapis.com/Group" + } + }, + "descendantsOfGroup": { + "type": "string", + "id": 4, + "options": { + "(google.api.resource_reference).type": "monitoring.googleapis.com/Group" + } + }, + "pageSize": { + "type": "int32", + "id": 5 + }, + "pageToken": { + "type": "string", + "id": 6 + } + } + }, + "ListGroupsResponse": { + "fields": { + "group": { + "rule": "repeated", + "type": "Group", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetGroupRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/Group" + } + } + } + }, + "CreateGroupRequest": { + "fields": { + "name": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/Group" + } + }, + "group": { + "type": "Group", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "validateOnly": { + "type": "bool", + "id": 3 + } + } + }, + "UpdateGroupRequest": { + "fields": { + "group": { + "type": "Group", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "validateOnly": { + "type": "bool", + "id": 3 + } + } + }, + "DeleteGroupRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/Group" + } + }, + "recursive": { + "type": "bool", + "id": 4 + } + } + }, + "ListGroupMembersRequest": { + "fields": { + "name": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/Group" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 5 + }, + "interval": { + "type": "TimeInterval", + "id": 6 + } + } + }, + "ListGroupMembersResponse": { + "fields": { + "members": { + "rule": "repeated", + "type": "google.api.MonitoredResource", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "Point": { + "fields": { + "interval": { + "type": "TimeInterval", + "id": 1 + }, + "value": { + "type": "TypedValue", + "id": 2 + } + } + }, + "TimeSeries": { + "fields": { + "metric": { + "type": "google.api.Metric", + "id": 1 + }, + "resource": { + "type": "google.api.MonitoredResource", + "id": 2 + }, + "metadata": { + "type": "google.api.MonitoredResourceMetadata", + "id": 7 + }, + "metricKind": { + "type": "google.api.MetricDescriptor.MetricKind", + "id": 3 + }, + "valueType": { + "type": "google.api.MetricDescriptor.ValueType", + "id": 4 + }, + "points": { + "rule": "repeated", + "type": "Point", + "id": 5 + }, + "unit": { + "type": "string", + "id": 8 + } + } + }, + "TimeSeriesDescriptor": { + "fields": { + "labelDescriptors": { + "rule": "repeated", + "type": "google.api.LabelDescriptor", + "id": 1 + }, + "pointDescriptors": { + "rule": "repeated", + "type": "ValueDescriptor", + "id": 5 + } + }, + "nested": { + "ValueDescriptor": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "valueType": { + "type": "google.api.MetricDescriptor.ValueType", + "id": 2 + }, + "metricKind": { + "type": "google.api.MetricDescriptor.MetricKind", + "id": 3 + }, + "unit": { + "type": "string", + "id": 4 + } + } + } + } + }, + "TimeSeriesData": { + "fields": { + "labelValues": { + "rule": "repeated", + "type": "LabelValue", + "id": 1 + }, + "pointData": { + "rule": "repeated", + "type": "PointData", + "id": 2 + } + }, + "nested": { + "PointData": { + "fields": { + "values": { + "rule": "repeated", + "type": "TypedValue", + "id": 1 + }, + "timeInterval": { + "type": "TimeInterval", + "id": 2 + } + } + } + } + }, + "LabelValue": { + "oneofs": { + "value": { + "oneof": [ + "boolValue", + "int64Value", + "stringValue" + ] + } + }, + "fields": { + "boolValue": { + "type": "bool", + "id": 1 + }, + "int64Value": { + "type": "int64", + "id": 2 + }, + "stringValue": { + "type": "string", + "id": 3 + } + } + }, + "QueryError": { + "fields": { + "locator": { + "type": "TextLocator", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + } + } + }, + "TextLocator": { + "fields": { + "source": { + "type": "string", + "id": 1 + }, + "startPosition": { + "type": "Position", + "id": 2 + }, + "endPosition": { + "type": "Position", + "id": 3 + }, + "nestedLocator": { + "type": "TextLocator", + "id": 4 + }, + "nestingReason": { + "type": "string", + "id": 5 + } + }, + "nested": { + "Position": { + "fields": { + "line": { + "type": "int32", + "id": 1 + }, + "column": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "MetricService": { + "options": { + "(google.api.default_host)": "monitoring.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read,https://www.googleapis.com/auth/monitoring.write" + }, + "methods": { + "ListMonitoredResourceDescriptors": { + "requestType": "ListMonitoredResourceDescriptorsRequest", + "responseType": "ListMonitoredResourceDescriptorsResponse", + "options": { + "(google.api.http).get": "/v3/{name=projects/*}/monitoredResourceDescriptors", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*}/monitoredResourceDescriptors" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetMonitoredResourceDescriptor": { + "requestType": "GetMonitoredResourceDescriptorRequest", + "responseType": "google.api.MonitoredResourceDescriptor", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/monitoredResourceDescriptors/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/monitoredResourceDescriptors/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListMetricDescriptors": { + "requestType": "ListMetricDescriptorsRequest", + "responseType": "ListMetricDescriptorsResponse", + "options": { + "(google.api.http).get": "/v3/{name=projects/*}/metricDescriptors", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*}/metricDescriptors" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetMetricDescriptor": { + "requestType": "GetMetricDescriptorRequest", + "responseType": "google.api.MetricDescriptor", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/metricDescriptors/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/metricDescriptors/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateMetricDescriptor": { + "requestType": "CreateMetricDescriptorRequest", + "responseType": "google.api.MetricDescriptor", + "options": { + "(google.api.http).post": "/v3/{name=projects/*}/metricDescriptors", + "(google.api.http).body": "metric_descriptor", + "(google.api.method_signature)": "name,metric_descriptor" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*}/metricDescriptors", + "body": "metric_descriptor" + } + }, + { + "(google.api.method_signature)": "name,metric_descriptor" + } + ] + }, + "DeleteMetricDescriptor": { + "requestType": "DeleteMetricDescriptorRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3/{name=projects/*/metricDescriptors/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=projects/*/metricDescriptors/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListTimeSeries": { + "requestType": "ListTimeSeriesRequest", + "responseType": "ListTimeSeriesResponse", + "options": { + "(google.api.http).get": "/v3/{name=projects/*}/timeSeries", + "(google.api.http).additional_bindings.get": "/v3/{name=folders/*}/timeSeries", + "(google.api.method_signature)": "name,filter,interval,view" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*}/timeSeries", + "additional_bindings": [ + { + "get": "/v3/{name=organizations/*}/timeSeries" + }, + { + "get": "/v3/{name=folders/*}/timeSeries" + } + ] + } + }, + { + "(google.api.method_signature)": "name,filter,interval,view" + } + ] + }, + "CreateTimeSeries": { + "requestType": "CreateTimeSeriesRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v3/{name=projects/*}/timeSeries", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,time_series" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*}/timeSeries", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,time_series" + } + ] + } + } + }, + "ListMonitoredResourceDescriptorsRequest": { + "fields": { + "name": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/MonitoredResourceDescriptor" + } + }, + "filter": { + "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListMonitoredResourceDescriptorsResponse": { + "fields": { + "resourceDescriptors": { + "rule": "repeated", + "type": "google.api.MonitoredResourceDescriptor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetMonitoredResourceDescriptorRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/MonitoredResourceDescriptor" + } + } + } + }, + "ListMetricDescriptorsRequest": { + "fields": { + "name": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/MetricDescriptor" + } + }, + "filter": { + "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListMetricDescriptorsResponse": { + "fields": { + "metricDescriptors": { + "rule": "repeated", + "type": "google.api.MetricDescriptor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetMetricDescriptorRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/MetricDescriptor" + } + } + } + }, + "CreateMetricDescriptorRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/MetricDescriptor" + } + }, + "metricDescriptor": { + "type": "google.api.MetricDescriptor", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteMetricDescriptorRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/MetricDescriptor" + } + } + } + }, + "ListTimeSeriesRequest": { + "fields": { + "name": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/TimeSeries" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "interval": { + "type": "TimeInterval", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "aggregation": { + "type": "Aggregation", + "id": 5 + }, + "secondaryAggregation": { + "type": "Aggregation", + "id": 11 + }, + "orderBy": { + "type": "string", + "id": 6 + }, + "view": { + "type": "TimeSeriesView", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 8 + }, + "pageToken": { + "type": "string", + "id": 9 + } + }, + "nested": { + "TimeSeriesView": { + "values": { + "FULL": 0, + "HEADERS": 1 + } + } + } + }, + "ListTimeSeriesResponse": { + "fields": { + "timeSeries": { + "rule": "repeated", + "type": "TimeSeries", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "executionErrors": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 3 + }, + "unit": { + "type": "string", + "id": 5 + } + } + }, + "CreateTimeSeriesRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "timeSeries": { + "rule": "repeated", + "type": "TimeSeries", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CreateTimeSeriesError": { + "fields": { + "timeSeries": { + "type": "TimeSeries", + "id": 1, + "options": { + "deprecated": true + } + }, + "status": { + "type": "google.rpc.Status", + "id": 2, + "options": { + "deprecated": true + } + } + } + }, + "CreateTimeSeriesSummary": { + "fields": { + "totalPointCount": { + "type": "int32", + "id": 1 + }, + "successPointCount": { + "type": "int32", + "id": 2 + }, + "errors": { + "rule": "repeated", + "type": "Error", + "id": 3 + } + }, + "nested": { + "Error": { + "fields": { + "status": { + "type": "google.rpc.Status", + "id": 1 + }, + "pointCount": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "QueryTimeSeriesRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "query": { + "type": "string", + "id": 7 + }, + "pageSize": { + "type": "int32", + "id": 9 + }, + "pageToken": { + "type": "string", + "id": 10 + } + } + }, + "QueryTimeSeriesResponse": { + "fields": { + "timeSeriesDescriptor": { + "type": "TimeSeriesDescriptor", + "id": 8 + }, + "timeSeriesData": { + "rule": "repeated", + "type": "TimeSeriesData", + "id": 9 + }, + "nextPageToken": { + "type": "string", + "id": 10 + }, + "partialErrors": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 11 + } + } + }, + "QueryErrorList": { + "fields": { + "errors": { + "rule": "repeated", + "type": "QueryError", + "id": 1 + }, + "errorSummary": { + "type": "string", + "id": 2 + } + } + }, + "NotificationChannelDescriptor": { + "options": { + "(google.api.resource).type": "monitoring.googleapis.com/NotificationChannelDescriptor", + "(google.api.resource).pattern": "*" + }, + "fields": { + "name": { + "type": "string", + "id": 6 + }, + "type": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + }, + "labels": { + "rule": "repeated", + "type": "google.api.LabelDescriptor", + "id": 4 + }, + "supportedTiers": { + "rule": "repeated", + "type": "ServiceTier", + "id": 5, + "options": { + "deprecated": true + } + }, + "launchStage": { + "type": "google.api.LaunchStage", + "id": 7 + } + } + }, + "NotificationChannel": { + "options": { + "(google.api.resource).type": "monitoring.googleapis.com/NotificationChannel", + "(google.api.resource).pattern": "*" + }, + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "name": { + "type": "string", + "id": 6 + }, + "displayName": { + "type": "string", + "id": 3 + }, + "description": { + "type": "string", + "id": 4 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "userLabels": { + "keyType": "string", + "type": "string", + "id": 8 + }, + "verificationStatus": { + "type": "VerificationStatus", + "id": 9 + }, + "enabled": { + "type": "google.protobuf.BoolValue", + "id": 11 + }, + "creationRecord": { + "type": "MutationRecord", + "id": 12 + }, + "mutationRecords": { + "rule": "repeated", + "type": "MutationRecord", + "id": 13 + } + }, + "nested": { + "VerificationStatus": { + "values": { + "VERIFICATION_STATUS_UNSPECIFIED": 0, + "UNVERIFIED": 1, + "VERIFIED": 2 + } + } + } + }, + "NotificationChannelService": { + "options": { + "(google.api.default_host)": "monitoring.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read" + }, + "methods": { + "ListNotificationChannelDescriptors": { + "requestType": "ListNotificationChannelDescriptorsRequest", + "responseType": "ListNotificationChannelDescriptorsResponse", + "options": { + "(google.api.http).get": "/v3/{name=projects/*}/notificationChannelDescriptors", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*}/notificationChannelDescriptors" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetNotificationChannelDescriptor": { + "requestType": "GetNotificationChannelDescriptorRequest", + "responseType": "NotificationChannelDescriptor", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/notificationChannelDescriptors/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/notificationChannelDescriptors/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListNotificationChannels": { + "requestType": "ListNotificationChannelsRequest", + "responseType": "ListNotificationChannelsResponse", + "options": { + "(google.api.http).get": "/v3/{name=projects/*}/notificationChannels", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*}/notificationChannels" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetNotificationChannel": { + "requestType": "GetNotificationChannelRequest", + "responseType": "NotificationChannel", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/notificationChannels/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/notificationChannels/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateNotificationChannel": { + "requestType": "CreateNotificationChannelRequest", + "responseType": "NotificationChannel", + "options": { + "(google.api.http).post": "/v3/{name=projects/*}/notificationChannels", + "(google.api.http).body": "notification_channel", + "(google.api.method_signature)": "name,notification_channel" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*}/notificationChannels", + "body": "notification_channel" + } + }, + { + "(google.api.method_signature)": "name,notification_channel" + } + ] + }, + "UpdateNotificationChannel": { + "requestType": "UpdateNotificationChannelRequest", + "responseType": "NotificationChannel", + "options": { + "(google.api.http).patch": "/v3/{notification_channel.name=projects/*/notificationChannels/*}", + "(google.api.http).body": "notification_channel", + "(google.api.method_signature)": "update_mask,notification_channel" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3/{notification_channel.name=projects/*/notificationChannels/*}", + "body": "notification_channel" + } + }, + { + "(google.api.method_signature)": "update_mask,notification_channel" + } + ] + }, + "DeleteNotificationChannel": { + "requestType": "DeleteNotificationChannelRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3/{name=projects/*/notificationChannels/*}", + "(google.api.method_signature)": "name,force" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=projects/*/notificationChannels/*}" + } + }, + { + "(google.api.method_signature)": "name,force" + } + ] + }, + "SendNotificationChannelVerificationCode": { + "requestType": "SendNotificationChannelVerificationCodeRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetNotificationChannelVerificationCode": { + "requestType": "GetNotificationChannelVerificationCodeRequest", + "responseType": "GetNotificationChannelVerificationCodeResponse", + "options": { + "(google.api.http).post": "/v3/{name=projects/*/notificationChannels/*}:getVerificationCode", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*/notificationChannels/*}:getVerificationCode", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "VerifyNotificationChannel": { + "requestType": "VerifyNotificationChannelRequest", + "responseType": "NotificationChannel", + "options": { + "(google.api.http).post": "/v3/{name=projects/*/notificationChannels/*}:verify", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*/notificationChannels/*}:verify", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,code" + } + ] + } + } + }, + "ListNotificationChannelDescriptorsRequest": { + "fields": { + "name": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/NotificationChannelDescriptor" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListNotificationChannelDescriptorsResponse": { + "fields": { + "channelDescriptors": { + "rule": "repeated", + "type": "NotificationChannelDescriptor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetNotificationChannelDescriptorRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/NotificationChannelDescriptor" + } + } + } + }, + "CreateNotificationChannelRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/NotificationChannel" + } + }, + "notificationChannel": { + "type": "NotificationChannel", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListNotificationChannelsRequest": { + "fields": { + "name": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/NotificationChannel" + } + }, + "filter": { + "type": "string", + "id": 6 + }, + "orderBy": { + "type": "string", + "id": 7 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListNotificationChannelsResponse": { + "fields": { + "notificationChannels": { + "rule": "repeated", + "type": "NotificationChannel", + "id": 3 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 4 + } + } + }, + "GetNotificationChannelRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/NotificationChannel" + } + } + } + }, + "UpdateNotificationChannelRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "notificationChannel": { + "type": "NotificationChannel", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteNotificationChannelRequest": { + "fields": { + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/NotificationChannel" + } + }, + "force": { + "type": "bool", + "id": 5 + } + } + }, + "SendNotificationChannelVerificationCodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/NotificationChannel" + } + } + } + }, + "GetNotificationChannelVerificationCodeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/NotificationChannel" + } + }, + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "GetNotificationChannelVerificationCodeResponse": { + "fields": { + "code": { + "type": "string", + "id": 1 + }, + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "VerifyNotificationChannelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/NotificationChannel" + } + }, + "code": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "QueryService": { + "options": { + "(google.api.default_host)": "monitoring.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read" + }, + "methods": { + "QueryTimeSeries": { + "requestType": "QueryTimeSeriesRequest", + "responseType": "QueryTimeSeriesResponse", + "options": { + "(google.api.http).post": "/v3/{name=projects/*}/timeSeries:query", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{name=projects/*}/timeSeries:query", + "body": "*" + } + } + ] + } + } + }, + "Service": { + "options": { + "(google.api.resource).type": "monitoring.googleapis.com/Service", + "(google.api.resource).pattern": "*" + }, + "oneofs": { + "identifier": { + "oneof": [ + "custom", + "appEngine", + "cloudEndpoints", + "clusterIstio", + "meshIstio", + "istioCanonicalService" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "custom": { + "type": "Custom", + "id": 6 + }, + "appEngine": { + "type": "AppEngine", + "id": 7 + }, + "cloudEndpoints": { + "type": "CloudEndpoints", + "id": 8 + }, + "clusterIstio": { + "type": "ClusterIstio", + "id": 9 + }, + "meshIstio": { + "type": "MeshIstio", + "id": 10 + }, + "istioCanonicalService": { + "type": "IstioCanonicalService", + "id": 11 + }, + "telemetry": { + "type": "Telemetry", + "id": 13 + } + }, + "nested": { + "Custom": { + "fields": {} + }, + "AppEngine": { + "fields": { + "moduleId": { + "type": "string", + "id": 1 + } + } + }, + "CloudEndpoints": { + "fields": { + "service": { + "type": "string", + "id": 1 + } + } + }, + "ClusterIstio": { + "fields": { + "location": { + "type": "string", + "id": 1 + }, + "clusterName": { + "type": "string", + "id": 2 + }, + "serviceNamespace": { + "type": "string", + "id": 3 + }, + "serviceName": { + "type": "string", + "id": 4 + } + } + }, + "MeshIstio": { + "fields": { + "meshUid": { + "type": "string", + "id": 1 + }, + "serviceNamespace": { + "type": "string", + "id": 3 + }, + "serviceName": { + "type": "string", + "id": 4 + } + } + }, + "IstioCanonicalService": { + "fields": { + "meshUid": { + "type": "string", + "id": 1 + }, + "canonicalServiceNamespace": { + "type": "string", + "id": 3 + }, + "canonicalService": { + "type": "string", + "id": 4 + } + } + }, + "Telemetry": { + "fields": { + "resourceName": { + "type": "string", + "id": 1 + } + } + } + } + }, + "ServiceLevelObjective": { + "options": { + "(google.api.resource).type": "monitoring.googleapis.com/ServiceLevelObjective", + "(google.api.resource).pattern": "*", + "(google.api.resource).history": "ORIGINALLY_SINGLE_PATTERN" + }, + "oneofs": { + "period": { + "oneof": [ + "rollingPeriod", + "calendarPeriod" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 11 + }, + "serviceLevelIndicator": { + "type": "ServiceLevelIndicator", + "id": 3 + }, + "goal": { + "type": "double", + "id": 4 + }, + "rollingPeriod": { + "type": "google.protobuf.Duration", + "id": 5 + }, + "calendarPeriod": { + "type": "google.type.CalendarPeriod", + "id": 6 + } + }, + "nested": { + "View": { + "values": { + "VIEW_UNSPECIFIED": 0, + "FULL": 2, + "EXPLICIT": 1 + } + } + } + }, + "ServiceLevelIndicator": { + "oneofs": { + "type": { + "oneof": [ + "basicSli", + "requestBased", + "windowsBased" + ] + } + }, + "fields": { + "basicSli": { + "type": "BasicSli", + "id": 4 + }, + "requestBased": { + "type": "RequestBasedSli", + "id": 1 + }, + "windowsBased": { + "type": "WindowsBasedSli", + "id": 2 + } + } + }, + "BasicSli": { + "oneofs": { + "sliCriteria": { + "oneof": [ + "availability", + "latency" + ] + } + }, + "fields": { + "method": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "location": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "version": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "availability": { + "type": "AvailabilityCriteria", + "id": 2 + }, + "latency": { + "type": "LatencyCriteria", + "id": 3 + } + }, + "nested": { + "AvailabilityCriteria": { + "fields": {} + }, + "LatencyCriteria": { + "fields": { + "threshold": { + "type": "google.protobuf.Duration", + "id": 3 + } + } + } + } + }, + "Range": { + "fields": { + "min": { + "type": "double", + "id": 1 + }, + "max": { + "type": "double", + "id": 2 + } + } + }, + "RequestBasedSli": { + "oneofs": { + "method": { + "oneof": [ + "goodTotalRatio", + "distributionCut" + ] + } + }, + "fields": { + "goodTotalRatio": { + "type": "TimeSeriesRatio", + "id": 1 + }, + "distributionCut": { + "type": "DistributionCut", + "id": 3 + } + } + }, + "TimeSeriesRatio": { + "fields": { + "goodServiceFilter": { + "type": "string", + "id": 4 + }, + "badServiceFilter": { + "type": "string", + "id": 5 + }, + "totalServiceFilter": { + "type": "string", + "id": 6 + } + } + }, + "DistributionCut": { + "fields": { + "distributionFilter": { + "type": "string", + "id": 4 + }, + "range": { + "type": "Range", + "id": 5 + } + } + }, + "WindowsBasedSli": { + "oneofs": { + "windowCriterion": { + "oneof": [ + "goodBadMetricFilter", + "goodTotalRatioThreshold", + "metricMeanInRange", + "metricSumInRange" + ] + } + }, + "fields": { + "goodBadMetricFilter": { + "type": "string", + "id": 5 + }, + "goodTotalRatioThreshold": { + "type": "PerformanceThreshold", + "id": 2 + }, + "metricMeanInRange": { + "type": "MetricRange", + "id": 6 + }, + "metricSumInRange": { + "type": "MetricRange", + "id": 7 + }, + "windowPeriod": { + "type": "google.protobuf.Duration", + "id": 4 + } + }, + "nested": { + "PerformanceThreshold": { + "oneofs": { + "type": { + "oneof": [ + "performance", + "basicSliPerformance" + ] + } + }, + "fields": { + "performance": { + "type": "RequestBasedSli", + "id": 1 + }, + "basicSliPerformance": { + "type": "BasicSli", + "id": 3 + }, + "threshold": { + "type": "double", + "id": 2 + } + } + }, + "MetricRange": { + "fields": { + "timeSeries": { + "type": "string", + "id": 1 + }, + "range": { + "type": "Range", + "id": 4 + } + } + } + } + }, + "ServiceMonitoringService": { + "options": { + "(google.api.default_host)": "monitoring.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read" + }, + "methods": { + "CreateService": { + "requestType": "CreateServiceRequest", + "responseType": "Service", + "options": { + "(google.api.http).post": "/v3/{parent=*/*}/services", + "(google.api.http).body": "service", + "(google.api.method_signature)": "parent,service" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=*/*}/services", + "body": "service" + } + }, + { + "(google.api.method_signature)": "parent,service" + } + ] + }, + "GetService": { + "requestType": "GetServiceRequest", + "responseType": "Service", + "options": { + "(google.api.http).get": "/v3/{name=*/*/services/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=*/*/services/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListServices": { + "requestType": "ListServicesRequest", + "responseType": "ListServicesResponse", + "options": { + "(google.api.http).get": "/v3/{parent=*/*}/services", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{parent=*/*}/services" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateService": { + "requestType": "UpdateServiceRequest", + "responseType": "Service", + "options": { + "(google.api.http).patch": "/v3/{service.name=*/*/services/*}", + "(google.api.http).body": "service", + "(google.api.method_signature)": "service" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3/{service.name=*/*/services/*}", + "body": "service" + } + }, + { + "(google.api.method_signature)": "service" + } + ] + }, + "DeleteService": { + "requestType": "DeleteServiceRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3/{name=*/*/services/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=*/*/services/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateServiceLevelObjective": { + "requestType": "CreateServiceLevelObjectiveRequest", + "responseType": "ServiceLevelObjective", + "options": { + "(google.api.http).post": "/v3/{parent=*/*/services/*}/serviceLevelObjectives", + "(google.api.http).body": "service_level_objective", + "(google.api.method_signature)": "parent,service_level_objective" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=*/*/services/*}/serviceLevelObjectives", + "body": "service_level_objective" + } + }, + { + "(google.api.method_signature)": "parent,service_level_objective" + } + ] + }, + "GetServiceLevelObjective": { + "requestType": "GetServiceLevelObjectiveRequest", + "responseType": "ServiceLevelObjective", + "options": { + "(google.api.http).get": "/v3/{name=*/*/services/*/serviceLevelObjectives/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=*/*/services/*/serviceLevelObjectives/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListServiceLevelObjectives": { + "requestType": "ListServiceLevelObjectivesRequest", + "responseType": "ListServiceLevelObjectivesResponse", + "options": { + "(google.api.http).get": "/v3/{parent=*/*/services/*}/serviceLevelObjectives", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{parent=*/*/services/*}/serviceLevelObjectives" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateServiceLevelObjective": { + "requestType": "UpdateServiceLevelObjectiveRequest", + "responseType": "ServiceLevelObjective", + "options": { + "(google.api.http).patch": "/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}", + "(google.api.http).body": "service_level_objective", + "(google.api.method_signature)": "service_level_objective" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}", + "body": "service_level_objective" + } + }, + { + "(google.api.method_signature)": "service_level_objective" + } + ] + }, + "DeleteServiceLevelObjective": { + "requestType": "DeleteServiceLevelObjectiveRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3/{name=*/*/services/*/serviceLevelObjectives/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=*/*/services/*/serviceLevelObjectives/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "CreateServiceRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/Service" + } + }, + "serviceId": { + "type": "string", + "id": 3 + }, + "service": { + "type": "Service", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetServiceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/Service" + } + } + } + }, + "ListServicesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/Service" + } + }, + "filter": { + "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListServicesResponse": { + "fields": { + "services": { + "rule": "repeated", + "type": "Service", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateServiceRequest": { + "fields": { + "service": { + "type": "Service", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteServiceRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/Service" + } + } + } + }, + "CreateServiceLevelObjectiveRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/Service" + } + }, + "serviceLevelObjectiveId": { + "type": "string", + "id": 3 + }, + "serviceLevelObjective": { + "type": "ServiceLevelObjective", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetServiceLevelObjectiveRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/ServiceLevelObjective" + } + }, + "view": { + "type": "ServiceLevelObjective.View", + "id": 2 + } + } + }, + "ListServiceLevelObjectivesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/Service" + } + }, + "filter": { + "type": "string", + "id": 2 + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + }, + "view": { + "type": "ServiceLevelObjective.View", + "id": 5 + } + } + }, + "ListServiceLevelObjectivesResponse": { + "fields": { + "serviceLevelObjectives": { + "rule": "repeated", + "type": "ServiceLevelObjective", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateServiceLevelObjectiveRequest": { + "fields": { + "serviceLevelObjective": { + "type": "ServiceLevelObjective", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteServiceLevelObjectiveRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/ServiceLevelObjective" + } + } + } + }, + "SpanContext": { + "fields": { + "spanName": { + "type": "string", + "id": 1 + } + } + }, + "UptimeCheckRegion": { + "values": { + "REGION_UNSPECIFIED": 0, + "USA": 1, + "EUROPE": 2, + "SOUTH_AMERICA": 3, + "ASIA_PACIFIC": 4 + } + }, + "InternalChecker": { + "options": { + "deprecated": true + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "network": { + "type": "string", + "id": 3 + }, + "gcpZone": { + "type": "string", + "id": 4 + }, + "peerProjectId": { + "type": "string", + "id": 6 + }, + "state": { + "type": "State", + "id": 7 + } + }, + "nested": { + "State": { + "values": { + "UNSPECIFIED": 0, + "CREATING": 1, + "RUNNING": 2 + } + } + } + }, + "UptimeCheckConfig": { + "options": { + "(google.api.resource).type": "monitoring.googleapis.com/UptimeCheckConfig", + "(google.api.resource).pattern": "*" + }, + "oneofs": { + "resource": { + "oneof": [ + "monitoredResource", + "resourceGroup" + ] + }, + "checkRequestType": { + "oneof": [ + "httpCheck", + "tcpCheck" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "monitoredResource": { + "type": "google.api.MonitoredResource", + "id": 3 + }, + "resourceGroup": { + "type": "ResourceGroup", + "id": 4 + }, + "httpCheck": { + "type": "HttpCheck", + "id": 5 + }, + "tcpCheck": { + "type": "TcpCheck", + "id": 6 + }, + "period": { + "type": "google.protobuf.Duration", + "id": 7 + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 8 + }, + "contentMatchers": { + "rule": "repeated", + "type": "ContentMatcher", + "id": 9 + }, + "selectedRegions": { + "rule": "repeated", + "type": "UptimeCheckRegion", + "id": 10 + }, + "isInternal": { + "type": "bool", + "id": 15, + "options": { + "deprecated": true + } + }, + "internalCheckers": { + "rule": "repeated", + "type": "InternalChecker", + "id": 14, + "options": { + "deprecated": true + } + } + }, + "nested": { + "ResourceGroup": { + "fields": { + "groupId": { + "type": "string", + "id": 1 + }, + "resourceType": { + "type": "GroupResourceType", + "id": 2 + } + } + }, + "HttpCheck": { + "fields": { + "requestMethod": { + "type": "RequestMethod", + "id": 8 + }, + "useSsl": { + "type": "bool", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + }, + "port": { + "type": "int32", + "id": 3 + }, + "authInfo": { + "type": "BasicAuthentication", + "id": 4 + }, + "maskHeaders": { + "type": "bool", + "id": 5 + }, + "headers": { + "keyType": "string", + "type": "string", + "id": 6 + }, + "contentType": { + "type": "ContentType", + "id": 9 + }, + "validateSsl": { + "type": "bool", + "id": 7 + }, + "body": { + "type": "bytes", + "id": 10 + } + }, + "nested": { + "BasicAuthentication": { + "fields": { + "username": { + "type": "string", + "id": 1 + }, + "password": { + "type": "string", + "id": 2 + } + } + }, + "RequestMethod": { + "values": { + "METHOD_UNSPECIFIED": 0, + "GET": 1, + "POST": 2 + } + }, + "ContentType": { + "values": { + "TYPE_UNSPECIFIED": 0, + "URL_ENCODED": 1 + } + } + } + }, + "TcpCheck": { + "fields": { + "port": { + "type": "int32", + "id": 1 + } + } + }, + "ContentMatcher": { + "fields": { + "content": { + "type": "string", + "id": 1 + }, + "matcher": { + "type": "ContentMatcherOption", + "id": 2 + } + }, + "nested": { + "ContentMatcherOption": { + "values": { + "CONTENT_MATCHER_OPTION_UNSPECIFIED": 0, + "CONTAINS_STRING": 1, + "NOT_CONTAINS_STRING": 2, + "MATCHES_REGEX": 3, + "NOT_MATCHES_REGEX": 4 + } + } + } + } + } + }, + "UptimeCheckIp": { + "fields": { + "region": { + "type": "UptimeCheckRegion", + "id": 1 + }, + "location": { + "type": "string", + "id": 2 + }, + "ipAddress": { + "type": "string", + "id": 3 + } + } + }, + "GroupResourceType": { + "values": { + "RESOURCE_TYPE_UNSPECIFIED": 0, + "INSTANCE": 1, + "AWS_ELB_LOAD_BALANCER": 2 + } + }, + "UptimeCheckService": { + "options": { + "(google.api.default_host)": "monitoring.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/monitoring,https://www.googleapis.com/auth/monitoring.read" + }, + "methods": { + "ListUptimeCheckConfigs": { + "requestType": "ListUptimeCheckConfigsRequest", + "responseType": "ListUptimeCheckConfigsResponse", + "options": { + "(google.api.http).get": "/v3/{parent=projects/*}/uptimeCheckConfigs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{parent=projects/*}/uptimeCheckConfigs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetUptimeCheckConfig": { + "requestType": "GetUptimeCheckConfigRequest", + "responseType": "UptimeCheckConfig", + "options": { + "(google.api.http).get": "/v3/{name=projects/*/uptimeCheckConfigs/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/{name=projects/*/uptimeCheckConfigs/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateUptimeCheckConfig": { + "requestType": "CreateUptimeCheckConfigRequest", + "responseType": "UptimeCheckConfig", + "options": { + "(google.api.http).post": "/v3/{parent=projects/*}/uptimeCheckConfigs", + "(google.api.http).body": "uptime_check_config", + "(google.api.method_signature)": "parent,uptime_check_config" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v3/{parent=projects/*}/uptimeCheckConfigs", + "body": "uptime_check_config" + } + }, + { + "(google.api.method_signature)": "parent,uptime_check_config" + } + ] + }, + "UpdateUptimeCheckConfig": { + "requestType": "UpdateUptimeCheckConfigRequest", + "responseType": "UptimeCheckConfig", + "options": { + "(google.api.http).patch": "/v3/{uptime_check_config.name=projects/*/uptimeCheckConfigs/*}", + "(google.api.http).body": "uptime_check_config", + "(google.api.method_signature)": "uptime_check_config" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v3/{uptime_check_config.name=projects/*/uptimeCheckConfigs/*}", + "body": "uptime_check_config" + } + }, + { + "(google.api.method_signature)": "uptime_check_config" + } + ] + }, + "DeleteUptimeCheckConfig": { + "requestType": "DeleteUptimeCheckConfigRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v3/{name=projects/*/uptimeCheckConfigs/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v3/{name=projects/*/uptimeCheckConfigs/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListUptimeCheckIps": { + "requestType": "ListUptimeCheckIpsRequest", + "responseType": "ListUptimeCheckIpsResponse", + "options": { + "(google.api.http).get": "/v3/uptimeCheckIps" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v3/uptimeCheckIps" + } + } + ] + } + } + }, + "ListUptimeCheckConfigsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/UptimeCheckConfig" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListUptimeCheckConfigsResponse": { + "fields": { + "uptimeCheckConfigs": { + "rule": "repeated", + "type": "UptimeCheckConfig", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "GetUptimeCheckConfigRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/UptimeCheckConfig" + } + } + } + }, + "CreateUptimeCheckConfigRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "monitoring.googleapis.com/UptimeCheckConfig" + } + }, + "uptimeCheckConfig": { + "type": "UptimeCheckConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateUptimeCheckConfigRequest": { + "fields": { + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + }, + "uptimeCheckConfig": { + "type": "UptimeCheckConfig", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteUptimeCheckConfigRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "monitoring.googleapis.com/UptimeCheckConfig" + } + } + } + }, + "ListUptimeCheckIpsRequest": { + "fields": { + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListUptimeCheckIpsResponse": { + "fields": { + "uptimeCheckIps": { + "rule": "repeated", + "type": "UptimeCheckIp", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/metric;metric", + "java_multiple_files": true, + "java_outer_classname": "MetricProto", + "java_package": "com.google.api", + "objc_class_prefix": "GAPI", + "cc_enable_arenas": true + }, + "nested": { + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions" + }, + "FieldBehavior": { + "values": { + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 + } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + }, + "Distribution": { + "fields": { + "count": { + "type": "int64", + "id": 1 + }, + "mean": { + "type": "double", + "id": 2 + }, + "sumOfSquaredDeviation": { + "type": "double", + "id": 3 + }, + "range": { + "type": "Range", + "id": 4 + }, + "bucketOptions": { + "type": "BucketOptions", + "id": 6 + }, + "bucketCounts": { + "rule": "repeated", + "type": "int64", + "id": 7 + }, + "exemplars": { + "rule": "repeated", + "type": "Exemplar", + "id": 10 + } + }, + "nested": { + "Range": { + "fields": { + "min": { + "type": "double", + "id": 1 + }, + "max": { + "type": "double", + "id": 2 + } + } + }, + "BucketOptions": { + "oneofs": { + "options": { + "oneof": [ + "linearBuckets", + "exponentialBuckets", + "explicitBuckets" + ] + } + }, + "fields": { + "linearBuckets": { + "type": "Linear", + "id": 1 + }, + "exponentialBuckets": { + "type": "Exponential", + "id": 2 + }, + "explicitBuckets": { + "type": "Explicit", + "id": 3 + } + }, + "nested": { + "Linear": { + "fields": { + "numFiniteBuckets": { + "type": "int32", + "id": 1 + }, + "width": { + "type": "double", + "id": 2 + }, + "offset": { + "type": "double", + "id": 3 + } + } + }, + "Exponential": { + "fields": { + "numFiniteBuckets": { + "type": "int32", + "id": 1 + }, + "growthFactor": { + "type": "double", + "id": 2 + }, + "scale": { + "type": "double", + "id": 3 + } + } + }, + "Explicit": { + "fields": { + "bounds": { + "rule": "repeated", + "type": "double", + "id": 1 + } + } + } + } + }, + "Exemplar": { + "fields": { + "value": { + "type": "double", + "id": 1 + }, + "timestamp": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "attachments": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } + }, + "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" + }, + "MonitoredResourceDescriptor": { + "fields": { + "name": { + "type": "string", + "id": 5 + }, + "type": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + }, + "labels": { + "rule": "repeated", + "type": "LabelDescriptor", + "id": 4 + }, + "launchStage": { + "type": "LaunchStage", + "id": 7 + } + } + }, + "MonitoredResource": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 2 + } + } + }, + "MonitoredResourceMetadata": { + "fields": { + "systemLabels": { + "type": "google.protobuf.Struct", + "id": 1 + }, + "userLabels": { + "keyType": "string", + "type": "string", + "id": 2 + } + } + }, + "LabelDescriptor": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "valueType": { + "type": "ValueType", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + } + }, + "nested": { + "ValueType": { + "values": { + "STRING": 0, + "BOOL": 1, + "INT64": 2 + } + } + } + }, + "LaunchStage": { + "values": { + "LAUNCH_STAGE_UNSPECIFIED": 0, + "UNIMPLEMENTED": 6, + "PRELAUNCH": 7, + "EARLY_ACCESS": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5 + } + }, + "MetricDescriptor": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "string", + "id": 8 + }, + "labels": { + "rule": "repeated", + "type": "LabelDescriptor", + "id": 2 + }, + "metricKind": { + "type": "MetricKind", + "id": 3 + }, + "valueType": { + "type": "ValueType", + "id": 4 + }, + "unit": { + "type": "string", + "id": 5 + }, + "description": { + "type": "string", + "id": 6 + }, + "displayName": { + "type": "string", + "id": 7 + }, + "metadata": { + "type": "MetricDescriptorMetadata", + "id": 10 + }, + "launchStage": { + "type": "LaunchStage", + "id": 12 + }, + "monitoredResourceTypes": { + "rule": "repeated", + "type": "string", + "id": 13 + } + }, + "nested": { + "MetricDescriptorMetadata": { + "fields": { + "launchStage": { + "type": "LaunchStage", + "id": 1, + "options": { + "deprecated": true + } + }, + "samplePeriod": { + "type": "google.protobuf.Duration", + "id": 2 + }, + "ingestDelay": { + "type": "google.protobuf.Duration", + "id": 3 + } + } + }, + "MetricKind": { + "values": { + "METRIC_KIND_UNSPECIFIED": 0, + "GAUGE": 1, + "DELTA": 2, + "CUMULATIVE": 3 + } + }, + "ValueType": { + "values": { + "VALUE_TYPE_UNSPECIFIED": 0, + "BOOL": 1, + "INT64": 2, + "DOUBLE": 3, + "STRING": 4, + "DISTRIBUTION": 5, + "MONEY": 6 + } + } + } + }, + "Metric": { + "fields": { + "type": { + "type": "string", + "id": 3 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 2 + } + } + } + } + }, + "protobuf": { + "options": { + "go_package": "google.golang.org/protobuf/types/descriptorpb", + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "csharp_namespace": "Google.Protobuf.Reflection", + "objc_class_prefix": "GPB", + "cc_enable_arenas": true, + "optimize_for": "SPEED" + }, + "nested": { + "FileDescriptorSet": { + "fields": { + "file": { + "rule": "repeated", + "type": "FileDescriptorProto", + "id": 1 + } + } + }, + "FileDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "package": { + "type": "string", + "id": 2 + }, + "dependency": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "publicDependency": { + "rule": "repeated", + "type": "int32", + "id": 10, + "options": { + "packed": false + } + }, + "weakDependency": { + "rule": "repeated", + "type": "int32", + "id": 11, + "options": { + "packed": false + } + }, + "messageType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 4 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 5 + }, + "service": { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "id": 6 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 7 + }, + "options": { + "type": "FileOptions", + "id": 8 + }, + "sourceCodeInfo": { + "type": "SourceCodeInfo", + "id": 9 + }, + "syntax": { + "type": "string", + "id": 12 + }, + "edition": { + "type": "string", + "id": 13 + } + } + }, + "DescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "field": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 2 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 6 + }, + "nestedType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 3 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 4 + }, + "extensionRange": { + "rule": "repeated", + "type": "ExtensionRange", + "id": 5 + }, + "oneofDecl": { + "rule": "repeated", + "type": "OneofDescriptorProto", + "id": 8 + }, + "options": { + "type": "MessageOptions", + "id": 7 + }, + "reservedRange": { + "rule": "repeated", + "type": "ReservedRange", + "id": 9 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 10 + } + }, + "nested": { + "ExtensionRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "ExtensionRangeOptions", + "id": 3 + } + } + }, + "ReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "ExtensionRangeOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "FieldDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 3 + }, + "label": { + "type": "Label", + "id": 4 + }, + "type": { + "type": "Type", + "id": 5 + }, + "typeName": { + "type": "string", + "id": 6 + }, + "extendee": { + "type": "string", + "id": 2 + }, + "defaultValue": { + "type": "string", + "id": 7 + }, + "oneofIndex": { + "type": "int32", + "id": 9 + }, + "jsonName": { + "type": "string", + "id": 10 + }, + "options": { + "type": "FieldOptions", + "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18 + } + }, + "Label": { + "values": { + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3 + } + } + } + }, + "OneofDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "options": { + "type": "OneofOptions", + "id": 2 + } + } + }, + "EnumDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "id": 2 + }, + "options": { + "type": "EnumOptions", + "id": 3 + }, + "reservedRange": { + "rule": "repeated", + "type": "EnumReservedRange", + "id": 4 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 5 + } + }, + "nested": { + "EnumReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "EnumValueDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "EnumValueOptions", + "id": 3 + } + } + }, + "ServiceDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "method": { + "rule": "repeated", + "type": "MethodDescriptorProto", + "id": 2 + }, + "options": { + "type": "ServiceOptions", + "id": 3 + } + } + }, + "MethodDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "inputType": { + "type": "string", + "id": 2 + }, + "outputType": { + "type": "string", + "id": 3 + }, + "options": { + "type": "MethodOptions", + "id": 4 + }, + "clientStreaming": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "serverStreaming": { + "type": "bool", + "id": 6, + "options": { + "default": false + } + } + } + }, + "FileOptions": { + "fields": { + "javaPackage": { + "type": "string", + "id": 1 + }, + "javaOuterClassname": { + "type": "string", + "id": 8 + }, + "javaMultipleFiles": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "javaGenerateEqualsAndHash": { + "type": "bool", + "id": 20, + "options": { + "deprecated": true + } + }, + "javaStringCheckUtf8": { + "type": "bool", + "id": 27, + "options": { + "default": false + } + }, + "optimizeFor": { + "type": "OptimizeMode", + "id": 9, + "options": { + "default": "SPEED" + } + }, + "goPackage": { + "type": "string", + "id": 11 + }, + "ccGenericServices": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "javaGenericServices": { + "type": "bool", + "id": 17, + "options": { + "default": false + } + }, + "pyGenericServices": { + "type": "bool", + "id": 18, + "options": { + "default": false + } + }, + "phpGenericServices": { + "type": "bool", + "id": 42, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 23, + "options": { + "default": false + } + }, + "ccEnableArenas": { + "type": "bool", + "id": 31, + "options": { + "default": true + } + }, + "objcClassPrefix": { + "type": "string", + "id": 36 + }, + "csharpNamespace": { + "type": "string", + "id": 37 + }, + "swiftPrefix": { + "type": "string", + "id": 39 + }, + "phpClassPrefix": { + "type": "string", + "id": 40 + }, + "phpNamespace": { + "type": "string", + "id": 41 + }, + "phpMetadataNamespace": { + "type": "string", + "id": 44 + }, + "rubyPackage": { + "type": "string", + "id": 45 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 38, + 38 + ] + ], + "nested": { + "OptimizeMode": { + "values": { + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3 + } + } + } + }, + "MessageOptions": { + "fields": { + "messageSetWireFormat": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "noStandardDescriptorAccessor": { + "type": "bool", + "id": 2, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "mapEntry": { + "type": "bool", + "id": 7 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], + [ + 8, + 8 + ], + [ + 9, + 9 + ] + ] + }, + "FieldOptions": { + "fields": { + "ctype": { + "type": "CType", + "id": 1, + "options": { + "default": "STRING" + } + }, + "packed": { + "type": "bool", + "id": 2 + }, + "jstype": { + "type": "JSType", + "id": 6, + "options": { + "default": "JS_NORMAL" + } + }, + "lazy": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "weak": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ] + ], + "nested": { + "CType": { + "values": { + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2 + } + }, + "JSType": { + "values": { + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2 + } + } + } + }, + "OneofOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "EnumOptions": { + "fields": { + "allowAlias": { + "type": "bool", + "id": 2 + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 5, + 5 + ] + ] + }, + "EnumValueOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "ServiceOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "MethodOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "idempotencyLevel": { + "type": "IdempotencyLevel", + "id": 34, + "options": { + "default": "IDEMPOTENCY_UNKNOWN" + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "IdempotencyLevel": { + "values": { + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2 + } + } + } + }, + "UninterpretedOption": { + "fields": { + "name": { + "rule": "repeated", + "type": "NamePart", + "id": 2 + }, + "identifierValue": { + "type": "string", + "id": 3 + }, + "positiveIntValue": { + "type": "uint64", + "id": 4 + }, + "negativeIntValue": { + "type": "int64", + "id": 5 + }, + "doubleValue": { + "type": "double", + "id": 6 + }, + "stringValue": { + "type": "bytes", + "id": 7 + }, + "aggregateValue": { + "type": "string", + "id": 8 + } + }, + "nested": { + "NamePart": { + "fields": { + "namePart": { + "rule": "required", + "type": "string", + "id": 1 + }, + "isExtension": { + "rule": "required", + "type": "bool", + "id": 2 + } + } + } + } + }, + "SourceCodeInfo": { + "fields": { + "location": { + "rule": "repeated", + "type": "Location", + "id": 1 + } + }, + "nested": { + "Location": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "span": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "leadingComments": { + "type": "string", + "id": 3 + }, + "trailingComments": { + "type": "string", + "id": 4 + }, + "leadingDetachedComments": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + } + } + }, + "GeneratedCodeInfo": { + "fields": { + "annotation": { + "rule": "repeated", + "type": "Annotation", + "id": 1 + } + }, + "nested": { + "Annotation": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "sourceFile": { + "type": "string", + "id": 2 + }, + "begin": { + "type": "int32", + "id": 3 + }, + "end": { + "type": "int32", + "id": 4 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } + } + } + } + } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "DoubleValue": { + "fields": { + "value": { + "type": "double", + "id": 1 + } + } + }, + "FloatValue": { + "fields": { + "value": { + "type": "float", + "id": 1 + } + } + }, + "Int64Value": { + "fields": { + "value": { + "type": "int64", + "id": 1 + } + } + }, + "UInt64Value": { + "fields": { + "value": { + "type": "uint64", + "id": 1 + } + } + }, + "Int32Value": { + "fields": { + "value": { + "type": "int32", + "id": 1 + } + } + }, + "UInt32Value": { + "fields": { + "value": { + "type": "uint32", + "id": 1 + } + } + }, + "BoolValue": { + "fields": { + "value": { + "type": "bool", + "id": 1 + } + } + }, + "StringValue": { + "fields": { + "value": { + "type": "string", + "id": 1 + } + } + }, + "BytesValue": { + "fields": { + "value": { + "type": "bytes", + "id": 1 + } + } + }, + "Empty": { + "fields": {} + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Struct": { + "fields": { + "fields": { + "keyType": "string", + "type": "Value", + "id": 1 + } + } + }, + "Value": { + "oneofs": { + "kind": { + "oneof": [ + "nullValue", + "numberValue", + "stringValue", + "boolValue", + "structValue", + "listValue" + ] + } + }, + "fields": { + "nullValue": { + "type": "NullValue", + "id": 1 + }, + "numberValue": { + "type": "double", + "id": 2 + }, + "stringValue": { + "type": "string", + "id": 3 + }, + "boolValue": { + "type": "bool", + "id": 4 + }, + "structValue": { + "type": "Struct", + "id": 5 + }, + "listValue": { + "type": "ListValue", + "id": 6 + } + } + }, + "NullValue": { + "values": { + "NULL_VALUE": 0 + } + }, + "ListValue": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + } + } + } + } + }, + "rpc": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", + "java_multiple_files": true, + "java_outer_classname": "StatusProto", + "java_package": "com.google.rpc", + "objc_class_prefix": "RPC" + }, + "nested": { + "Status": { + "fields": { + "code": { + "type": "int32", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "details": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } + }, + "type": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/type/calendarperiod;calendarperiod", + "java_multiple_files": true, + "java_outer_classname": "CalendarPeriodProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP" + }, + "nested": { + "CalendarPeriod": { + "values": { + "CALENDAR_PERIOD_UNSPECIFIED": 0, + "DAY": 1, + "WEEK": 2, + "FORTNIGHT": 3, + "MONTH": 4, + "QUARTER": 5, + "HALF": 6, + "YEAR": 7 + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-monitoring/samples/.eslintrc.yml b/packages/google-cloud-monitoring/samples/.eslintrc.yml new file mode 100644 index 00000000000..282535f55f6 --- /dev/null +++ b/packages/google-cloud-monitoring/samples/.eslintrc.yml @@ -0,0 +1,3 @@ +--- +rules: + no-console: off diff --git a/packages/google-cloud-monitoring/samples/README.md b/packages/google-cloud-monitoring/samples/README.md new file mode 100644 index 00000000000..89c434774f6 --- /dev/null +++ b/packages/google-cloud-monitoring/samples/README.md @@ -0,0 +1,68 @@ +[//]: # "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 + +# [Stackdriver Monitoring: Node.js Samples](https://github.com/googleapis/google-cloud-node) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [Quickstart](#quickstart) + * [Quickstart.test](#quickstart.test) + +## Before you begin + +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/google-cloud-node#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### Quickstart + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/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-monitoring/samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-monitoring/samples/quickstart.js` + + +----- + + + + +### Quickstart.test + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-monitoring/samples/test/quickstart.test.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-monitoring/samples/test/quickstart.test.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-monitoring/samples/test/quickstart.test.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/google-cloud-node&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/monitoring/docs diff --git a/packages/google-cloud-monitoring/samples/package.json b/packages/google-cloud-monitoring/samples/package.json new file mode 100644 index 00000000000..42273019e8e --- /dev/null +++ b/packages/google-cloud-monitoring/samples/package.json @@ -0,0 +1,25 @@ +{ + "name": "nodejs-docs-samples-monitoring", + "private": true, + "license": "Apache-2.0", + "author": "Google Inc.", + "repository": "googleapis/nodejs-monitoring", + "files": [ + "*.js" + ], + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "test": "mocha --timeout 600000" + }, + "dependencies": { + "@google-cloud/monitoring": "^3.0.3", + "yargs": "^16.0.0" + }, + "devDependencies": { + "chai": "^4.2.0", + "mocha": "^8.0.0", + "uuid": "^9.0.0" + } +} \ No newline at end of file diff --git a/packages/google-cloud-monitoring/samples/quickstart.js b/packages/google-cloud-monitoring/samples/quickstart.js new file mode 100644 index 00000000000..bb5d33dcc87 --- /dev/null +++ b/packages/google-cloud-monitoring/samples/quickstart.js @@ -0,0 +1,77 @@ +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +async function main(projectId) { + // [START monitoring_quickstart] + // Imports the Google Cloud client library + const monitoring = require('@google-cloud/monitoring'); + + async function quickstart() { + // Creates a client + const client = new monitoring.MetricServiceClient(); + + // TODO(developer): Uncomment and set the following variables + // const projectId = "PROJECT_ID" + + // Prepares an individual data point + const dataPoint = { + interval: { + endTime: { + seconds: Date.now() / 1000, + }, + }, + value: { + // The amount of sales + doubleValue: 123.45, + }, + }; + + // Prepares the time series request + const request = { + name: client.projectPath(projectId), + timeSeries: [ + { + // Ties the data point to a custom metric + metric: { + type: 'custom.googleapis.com/stores/daily_sales', + labels: { + store_id: 'Pittsburgh', + }, + }, + resource: { + type: 'global', + labels: { + project_id: projectId, + }, + }, + points: [dataPoint], + }, + ], + }; + + // Writes time series data + const [result] = await client.createTimeSeries(request); + console.log('Done writing time series data.', result); + } + quickstart(); + // [END monitoring_quickstart] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-monitoring/samples/test/quickstart.test.js b/packages/google-cloud-monitoring/samples/test/quickstart.test.js new file mode 100644 index 00000000000..07ac58d9bb2 --- /dev/null +++ b/packages/google-cloud-monitoring/samples/test/quickstart.test.js @@ -0,0 +1,49 @@ +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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'; + +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const cp = require('child_process'); +const monitoring = require('@google-cloud/monitoring'); + +const client = new monitoring.AlertPolicyServiceClient(); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); +// Tests in this suite can trigger the upstream error, +// "points were written more frequently than the maximum +// sampling period configured for the metric": +const delay = async test => { + const retries = test.currentRetry(); + if (retries === 0) return; // no retry on the first failure. + // see: https://cloud.google.com/storage/docs/exponential-backoff: + const ms = Math.pow(2, retries) * 250 + Math.random() * 1000; + return new Promise(done => { + console.info(`retrying "${test.title}" in ${ms}ms`); + setTimeout(done, ms); + }); +}; +describe('quickstart', () => { + let projectId; + before(async () => { + projectId = await client.getProjectId(); + }); + it('should run the quickstart', async function () { + this.retries(8); + await delay(this.test); // delay the start of the test, if this is a retry. + const result = execSync(`node quickstart.js ${projectId}`); + assert.match(result, /Done writing time series data/); + }); +}); diff --git a/packages/google-cloud-monitoring/src/index.ts b/packages/google-cloud-monitoring/src/index.ts new file mode 100644 index 00000000000..5da2bb2ad1e --- /dev/null +++ b/packages/google-cloud-monitoring/src/index.ts @@ -0,0 +1,57 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v3 from './v3'; + +const AlertPolicyServiceClient = v3.AlertPolicyServiceClient; +type AlertPolicyServiceClient = v3.AlertPolicyServiceClient; +const GroupServiceClient = v3.GroupServiceClient; +type GroupServiceClient = v3.GroupServiceClient; +const MetricServiceClient = v3.MetricServiceClient; +type MetricServiceClient = v3.MetricServiceClient; +const NotificationChannelServiceClient = v3.NotificationChannelServiceClient; +type NotificationChannelServiceClient = v3.NotificationChannelServiceClient; +const QueryServiceClient = v3.QueryServiceClient; +type QueryServiceClient = v3.QueryServiceClient; +const ServiceMonitoringServiceClient = v3.ServiceMonitoringServiceClient; +type ServiceMonitoringServiceClient = v3.ServiceMonitoringServiceClient; +const UptimeCheckServiceClient = v3.UptimeCheckServiceClient; +type UptimeCheckServiceClient = v3.UptimeCheckServiceClient; + +export { + v3, + AlertPolicyServiceClient, + GroupServiceClient, + MetricServiceClient, + NotificationChannelServiceClient, + QueryServiceClient, + ServiceMonitoringServiceClient, + UptimeCheckServiceClient, +}; +export default { + v3, + AlertPolicyServiceClient, + GroupServiceClient, + MetricServiceClient, + NotificationChannelServiceClient, + QueryServiceClient, + ServiceMonitoringServiceClient, + UptimeCheckServiceClient, +}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-monitoring/src/v3/alert_policy_service_client.ts b/packages/google-cloud-monitoring/src/v3/alert_policy_service_client.ts new file mode 100644 index 00000000000..defdfa341e0 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/alert_policy_service_client.ts @@ -0,0 +1,2258 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3/alert_policy_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './alert_policy_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * The AlertPolicyService API is used to manage (list, create, delete, + * edit) alert policies in Stackdriver Monitoring. An alerting policy is + * a description of the conditions under which some aspect of your + * system is considered to be "unhealthy" and the ways to notify + * people or services about this state. In addition to using this API, alert + * policies can also be managed through + * [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), + * which can be reached by clicking the "Monitoring" tab in + * [Cloud Console](https://console.cloud.google.com/). + * @class + * @memberof v3 + */ +export class AlertPolicyServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + alertPolicyServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AlertPolicyServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AlertPolicyServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}' + ), + folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + ), + folderGroupPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/groups/{group}' + ), + folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannels/{notification_channel}' + ), + folderServicePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}' + ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + ), + organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}' + ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + ), + organizationGroupPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/groups/{group}' + ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}' + ), + organizationServicePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}' + ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}' + ), + projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + ), + projectGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/groups/{group}' + ), + projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannels/{notification_channel}' + ), + projectServicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}' + ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listAlertPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'alertPolicies' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.monitoring.v3.AlertPolicyService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.alertPolicyServiceStub) { + return this.alertPolicyServiceStub; + } + + // Put together the "service stub" for + // google.monitoring.v3.AlertPolicyService. + this.alertPolicyServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.AlertPolicyService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.monitoring.v3.AlertPolicyService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const alertPolicyServiceStubMethods = [ + 'listAlertPolicies', + 'getAlertPolicy', + 'createAlertPolicy', + 'deleteAlertPolicy', + 'updateAlertPolicy', + ]; + for (const methodName of alertPolicyServiceStubMethods) { + const callPromise = this.alertPolicyServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.alertPolicyServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'monitoring.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'monitoring.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getAlertPolicy( + request: protos.google.monitoring.v3.IGetAlertPolicyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | undefined, + {} | undefined + ] + >; + getAlertPolicy( + request: protos.google.monitoring.v3.IGetAlertPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + getAlertPolicy( + request: protos.google.monitoring.v3.IGetAlertPolicyRequest, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a single alerting policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The alerting policy to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AlertPolicy]{@link google.monitoring.v3.AlertPolicy}. + * 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.getAlertPolicy(request); + */ + getAlertPolicy( + request: protos.google.monitoring.v3.IGetAlertPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IGetAlertPolicyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAlertPolicy(request, options, callback); + } + createAlertPolicy( + request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | undefined, + {} | undefined + ] + >; + createAlertPolicy( + request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + createAlertPolicy( + request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a new alerting policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project in which to create the alerting policy. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policy will be written, not the name of the created policy. |name| must be + * a host project of a workspace, otherwise INVALID_ARGUMENT error will + * return. The alerting policy that is returned will have a name that contains + * a normalized representation of this name as a prefix but adds a suffix of + * the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the + * container. + * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy + * Required. The requested alerting policy. You should omit the `name` field in this + * policy. The name will be returned in the new policy, including + * a new `[ALERT_POLICY_ID]` value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AlertPolicy]{@link google.monitoring.v3.AlertPolicy}. + * 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.createAlertPolicy(request); + */ + createAlertPolicy( + request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IAlertPolicy, + | protos.google.monitoring.v3.ICreateAlertPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.ICreateAlertPolicyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.createAlertPolicy(request, options, callback); + } + deleteAlertPolicy( + request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | undefined, + {} | undefined + ] + >; + deleteAlertPolicy( + request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteAlertPolicy( + request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes an alerting policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The alerting policy to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] + * + * For more information, see {@link google.monitoring.v3.AlertPolicy|AlertPolicy}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.deleteAlertPolicy(request); + */ + deleteAlertPolicy( + request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteAlertPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteAlertPolicyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAlertPolicy(request, options, callback); + } + updateAlertPolicy( + request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | undefined, + {} | undefined + ] + >; + updateAlertPolicy( + request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + updateAlertPolicy( + request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, + callback: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates an alerting policy. You can either replace the entire policy with + * a new one or replace only certain fields in the current alerting policy by + * specifying the fields to be updated via `updateMask`. Returns the + * updated alerting policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. A list of alerting policy field names. If this field is not + * empty, each listed field in the existing alerting policy is set to the + * value of the corresponding field in the supplied policy (`alert_policy`), + * or to the field's default value if the field is not in the supplied + * alerting policy. Fields not listed retain their previous value. + * + * Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, + * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. + * + * If this field is empty, then the supplied alerting policy replaces the + * existing policy. It is the same as deleting the existing policy and + * adding the supplied policy, except for the following: + * + * + The new policy will have the same `[ALERT_POLICY_ID]` as the former + * policy. This gives you continuity with the former policy in your + * notifications and incidents. + * + Conditions in the new policy will keep their former `[CONDITION_ID]` if + * the supplied condition includes the `name` field with that + * `[CONDITION_ID]`. If the supplied condition omits the `name` field, + * then a new `[CONDITION_ID]` is created. + * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy + * Required. The updated alerting policy or the updated values for the + * fields listed in `update_mask`. + * If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AlertPolicy]{@link google.monitoring.v3.AlertPolicy}. + * 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.updateAlertPolicy(request); + */ + updateAlertPolicy( + request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IAlertPolicy, + | protos.google.monitoring.v3.IUpdateAlertPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy, + protos.google.monitoring.v3.IUpdateAlertPolicyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'alert_policy.name': request.alertPolicy!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateAlertPolicy(request, options, callback); + } + + listAlertPolicies( + request: protos.google.monitoring.v3.IListAlertPoliciesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy[], + protos.google.monitoring.v3.IListAlertPoliciesRequest | null, + protos.google.monitoring.v3.IListAlertPoliciesResponse + ] + >; + listAlertPolicies( + request: protos.google.monitoring.v3.IListAlertPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListAlertPoliciesRequest, + protos.google.monitoring.v3.IListAlertPoliciesResponse | null | undefined, + protos.google.monitoring.v3.IAlertPolicy + > + ): void; + listAlertPolicies( + request: protos.google.monitoring.v3.IListAlertPoliciesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListAlertPoliciesRequest, + protos.google.monitoring.v3.IListAlertPoliciesResponse | null | undefined, + protos.google.monitoring.v3.IAlertPolicy + > + ): void; + /** + * Lists the existing alerting policies for the workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project whose alert policies are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * {@link google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} + * operation, instead. + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * alert policies to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} request.orderBy + * A comma-separated list of fields by which to sort the result. Supports + * the same set of field references as the `filter` field. Entries can be + * prefixed with a minus sign to sort by the field in descending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [AlertPolicy]{@link google.monitoring.v3.AlertPolicy}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAlertPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAlertPolicies( + request: protos.google.monitoring.v3.IListAlertPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListAlertPoliciesRequest, + | protos.google.monitoring.v3.IListAlertPoliciesResponse + | null + | undefined, + protos.google.monitoring.v3.IAlertPolicy + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListAlertPoliciesRequest, + protos.google.monitoring.v3.IListAlertPoliciesResponse | null | undefined, + protos.google.monitoring.v3.IAlertPolicy + > + ): Promise< + [ + protos.google.monitoring.v3.IAlertPolicy[], + protos.google.monitoring.v3.IListAlertPoliciesRequest | null, + protos.google.monitoring.v3.IListAlertPoliciesResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listAlertPolicies(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project whose alert policies are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * {@link google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} + * operation, instead. + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * alert policies to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} request.orderBy + * A comma-separated list of fields by which to sort the result. Supports + * the same set of field references as the `filter` field. Entries can be + * prefixed with a minus sign to sort by the field in descending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [AlertPolicy]{@link google.monitoring.v3.AlertPolicy} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAlertPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAlertPoliciesStream( + request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAlertPolicies.createStream( + this.innerApiCalls.listAlertPolicies as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listAlertPolicies`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project whose alert policies are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this field names the parent container in which the alerting + * policies to be listed are stored. To retrieve a single alerting policy + * by name, use the + * {@link google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} + * operation, instead. + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * alert policies to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} request.orderBy + * A comma-separated list of fields by which to sort the result. Supports + * the same set of field references as the `filter` field. Entries can be + * prefixed with a minus sign to sort by the field in descending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [AlertPolicy]{@link google.monitoring.v3.AlertPolicy}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listAlertPoliciesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listAlertPoliciesAsync( + request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listAlertPolicies.asyncIterate( + this.innerApiCalls['listAlertPolicies'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAlertPolicy resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + folderAlertPolicyPath(folder: string, alertPolicy: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the folder from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified folderAlertPolicyCondition resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the folder from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified folderChannelDescriptor resource name string. + * + * @param {string} folder + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ + folder: folder, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the folder from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).folder; + } + + /** + * Parse the channel_descriptor from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified folderGroup resource name string. + * + * @param {string} folder + * @param {string} group + * @returns {string} Resource name string. + */ + folderGroupPath(folder: string, group: string) { + return this.pathTemplates.folderGroupPathTemplate.render({ + folder: folder, + group: group, + }); + } + + /** + * Parse the folder from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; + } + + /** + * Parse the group from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; + } + + /** + * Return a fully-qualified folderNotificationChannel resource name string. + * + * @param {string} folder + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + folderNotificationChannelPath(folder: string, notificationChannel: string) { + return this.pathTemplates.folderNotificationChannelPathTemplate.render({ + folder: folder, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the folder from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).folder; + } + + /** + * Parse the notification_channel from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified folderService resource name string. + * + * @param {string} folder + * @param {string} service + * @returns {string} Resource name string. + */ + folderServicePath(folder: string, service: string) { + return this.pathTemplates.folderServicePathTemplate.render({ + folder: folder, + service: service, + }); + } + + /** + * Parse the folder from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; + } + + /** + * Parse the service from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; + } + + /** + * Return a fully-qualified folderServiceServiceLevelObjective resource name string. + * + * @param {string} folder + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the folder from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).folder; + } + + /** + * Parse the service from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified folderUptimeCheckConfig resource name string. + * + * @param {string} folder + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ + folder: folder, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the folder from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).folder; + } + + /** + * Parse the uptime_check_config from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified organizationAlertPolicy resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + organizationAlertPolicyPath(organization: string, alertPolicy: string) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ + organization: organization, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the organization from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified organizationAlertPolicyCondition resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + } + ); + } + + /** + * Parse the organization from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified organizationChannelDescriptor resource name string. + * + * @param {string} organization + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ + organization: organization, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the organization from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).organization; + } + + /** + * Parse the channel_descriptor from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified organizationGroup resource name string. + * + * @param {string} organization + * @param {string} group + * @returns {string} Resource name string. + */ + organizationGroupPath(organization: string, group: string) { + return this.pathTemplates.organizationGroupPathTemplate.render({ + organization: organization, + group: group, + }); + } + + /** + * Parse the organization from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).organization; + } + + /** + * Parse the group from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).group; + } + + /** + * Return a fully-qualified organizationNotificationChannel resource name string. + * + * @param {string} organization + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + organizationNotificationChannelPath( + organization: string, + notificationChannel: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + } + ); + } + + /** + * Parse the organization from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).organization; + } + + /** + * Parse the notification_channel from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified organizationService resource name string. + * + * @param {string} organization + * @param {string} service + * @returns {string} Resource name string. + */ + organizationServicePath(organization: string, service: string) { + return this.pathTemplates.organizationServicePathTemplate.render({ + organization: organization, + service: service, + }); + } + + /** + * Parse the organization from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).organization; + } + + /** + * Parse the service from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceName(organizationServiceName: string) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).service; + } + + /** + * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. + * + * @param {string} organization + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the organization from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).organization; + } + + /** + * Parse the service from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified organizationUptimeCheckConfig resource name string. + * + * @param {string} organization + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ + organization: organization, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the organization from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).organization; + } + + /** + * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAlertPolicy resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + projectAlertPolicyPath(project: string, alertPolicy: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the project from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified projectAlertPolicyCondition resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the project from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified projectChannelDescriptor resource name string. + * + * @param {string} project + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + projectChannelDescriptorPath(project: string, channelDescriptor: string) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ + project: project, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the project from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).project; + } + + /** + * Parse the channel_descriptor from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified projectGroup resource name string. + * + * @param {string} project + * @param {string} group + * @returns {string} Resource name string. + */ + projectGroupPath(project: string, group: string) { + return this.pathTemplates.projectGroupPathTemplate.render({ + project: project, + group: group, + }); + } + + /** + * Parse the project from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; + } + + /** + * Parse the group from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; + } + + /** + * Return a fully-qualified projectNotificationChannel resource name string. + * + * @param {string} project + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + projectNotificationChannelPath(project: string, notificationChannel: string) { + return this.pathTemplates.projectNotificationChannelPathTemplate.render({ + project: project, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the project from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).project; + } + + /** + * Parse the notification_channel from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified projectService resource name string. + * + * @param {string} project + * @param {string} service + * @returns {string} Resource name string. + */ + projectServicePath(project: string, service: string) { + return this.pathTemplates.projectServicePathTemplate.render({ + project: project, + service: service, + }); + } + + /** + * Parse the project from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).project; + } + + /** + * Parse the service from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).service; + } + + /** + * Return a fully-qualified projectServiceServiceLevelObjective resource name string. + * + * @param {string} project + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the project from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).project; + } + + /** + * Parse the service from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified projectUptimeCheckConfig resource name string. + * + * @param {string} project + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ + project: project, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the project from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).project; + } + + /** + * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.alertPolicyServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-monitoring/src/v3/alert_policy_service_client_config.json b/packages/google-cloud-monitoring/src/v3/alert_policy_service_client_config.json new file mode 100644 index 00000000000..437f8cf2861 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/alert_policy_service_client_config.json @@ -0,0 +1,60 @@ +{ + "interfaces": { + "google.monitoring.v3.AlertPolicyService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListAlertPolicies": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "GetAlertPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "CreateAlertPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteAlertPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "UpdateAlertPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-monitoring/src/v3/alert_policy_service_proto_list.json b/packages/google-cloud-monitoring/src/v3/alert_policy_service_proto_list.json new file mode 100644 index 00000000000..e55f61d422f --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/alert_policy_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/monitoring/v3/alert.proto", + "../../protos/google/monitoring/v3/alert_service.proto", + "../../protos/google/monitoring/v3/common.proto", + "../../protos/google/monitoring/v3/dropped_labels.proto", + "../../protos/google/monitoring/v3/group.proto", + "../../protos/google/monitoring/v3/group_service.proto", + "../../protos/google/monitoring/v3/metric.proto", + "../../protos/google/monitoring/v3/metric_service.proto", + "../../protos/google/monitoring/v3/mutation_record.proto", + "../../protos/google/monitoring/v3/notification.proto", + "../../protos/google/monitoring/v3/notification_service.proto", + "../../protos/google/monitoring/v3/query_service.proto", + "../../protos/google/monitoring/v3/service.proto", + "../../protos/google/monitoring/v3/service_service.proto", + "../../protos/google/monitoring/v3/span_context.proto", + "../../protos/google/monitoring/v3/uptime.proto", + "../../protos/google/monitoring/v3/uptime_service.proto" +] diff --git a/packages/google-cloud-monitoring/src/v3/gapic_metadata.json b/packages/google-cloud-monitoring/src/v3/gapic_metadata.json new file mode 100644 index 00000000000..6312a12ae34 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/gapic_metadata.json @@ -0,0 +1,619 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.monitoring.v3", + "libraryPackage": "@google-cloud/monitoring", + "services": { + "AlertPolicyService": { + "clients": { + "grpc": { + "libraryClient": "AlertPolicyServiceClient", + "rpcs": { + "GetAlertPolicy": { + "methods": [ + "getAlertPolicy" + ] + }, + "CreateAlertPolicy": { + "methods": [ + "createAlertPolicy" + ] + }, + "DeleteAlertPolicy": { + "methods": [ + "deleteAlertPolicy" + ] + }, + "UpdateAlertPolicy": { + "methods": [ + "updateAlertPolicy" + ] + }, + "ListAlertPolicies": { + "methods": [ + "listAlertPolicies", + "listAlertPoliciesStream", + "listAlertPoliciesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AlertPolicyServiceClient", + "rpcs": { + "GetAlertPolicy": { + "methods": [ + "getAlertPolicy" + ] + }, + "CreateAlertPolicy": { + "methods": [ + "createAlertPolicy" + ] + }, + "DeleteAlertPolicy": { + "methods": [ + "deleteAlertPolicy" + ] + }, + "UpdateAlertPolicy": { + "methods": [ + "updateAlertPolicy" + ] + }, + "ListAlertPolicies": { + "methods": [ + "listAlertPolicies", + "listAlertPoliciesStream", + "listAlertPoliciesAsync" + ] + } + } + } + } + }, + "GroupService": { + "clients": { + "grpc": { + "libraryClient": "GroupServiceClient", + "rpcs": { + "GetGroup": { + "methods": [ + "getGroup" + ] + }, + "CreateGroup": { + "methods": [ + "createGroup" + ] + }, + "UpdateGroup": { + "methods": [ + "updateGroup" + ] + }, + "DeleteGroup": { + "methods": [ + "deleteGroup" + ] + }, + "ListGroups": { + "methods": [ + "listGroups", + "listGroupsStream", + "listGroupsAsync" + ] + }, + "ListGroupMembers": { + "methods": [ + "listGroupMembers", + "listGroupMembersStream", + "listGroupMembersAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "GroupServiceClient", + "rpcs": { + "GetGroup": { + "methods": [ + "getGroup" + ] + }, + "CreateGroup": { + "methods": [ + "createGroup" + ] + }, + "UpdateGroup": { + "methods": [ + "updateGroup" + ] + }, + "DeleteGroup": { + "methods": [ + "deleteGroup" + ] + }, + "ListGroups": { + "methods": [ + "listGroups", + "listGroupsStream", + "listGroupsAsync" + ] + }, + "ListGroupMembers": { + "methods": [ + "listGroupMembers", + "listGroupMembersStream", + "listGroupMembersAsync" + ] + } + } + } + } + }, + "MetricService": { + "clients": { + "grpc": { + "libraryClient": "MetricServiceClient", + "rpcs": { + "GetMonitoredResourceDescriptor": { + "methods": [ + "getMonitoredResourceDescriptor" + ] + }, + "GetMetricDescriptor": { + "methods": [ + "getMetricDescriptor" + ] + }, + "CreateMetricDescriptor": { + "methods": [ + "createMetricDescriptor" + ] + }, + "DeleteMetricDescriptor": { + "methods": [ + "deleteMetricDescriptor" + ] + }, + "CreateTimeSeries": { + "methods": [ + "createTimeSeries" + ] + }, + "ListMonitoredResourceDescriptors": { + "methods": [ + "listMonitoredResourceDescriptors", + "listMonitoredResourceDescriptorsStream", + "listMonitoredResourceDescriptorsAsync" + ] + }, + "ListMetricDescriptors": { + "methods": [ + "listMetricDescriptors", + "listMetricDescriptorsStream", + "listMetricDescriptorsAsync" + ] + }, + "ListTimeSeries": { + "methods": [ + "listTimeSeries", + "listTimeSeriesStream", + "listTimeSeriesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "MetricServiceClient", + "rpcs": { + "GetMonitoredResourceDescriptor": { + "methods": [ + "getMonitoredResourceDescriptor" + ] + }, + "GetMetricDescriptor": { + "methods": [ + "getMetricDescriptor" + ] + }, + "CreateMetricDescriptor": { + "methods": [ + "createMetricDescriptor" + ] + }, + "DeleteMetricDescriptor": { + "methods": [ + "deleteMetricDescriptor" + ] + }, + "CreateTimeSeries": { + "methods": [ + "createTimeSeries" + ] + }, + "ListMonitoredResourceDescriptors": { + "methods": [ + "listMonitoredResourceDescriptors", + "listMonitoredResourceDescriptorsStream", + "listMonitoredResourceDescriptorsAsync" + ] + }, + "ListMetricDescriptors": { + "methods": [ + "listMetricDescriptors", + "listMetricDescriptorsStream", + "listMetricDescriptorsAsync" + ] + }, + "ListTimeSeries": { + "methods": [ + "listTimeSeries", + "listTimeSeriesStream", + "listTimeSeriesAsync" + ] + } + } + } + } + }, + "NotificationChannelService": { + "clients": { + "grpc": { + "libraryClient": "NotificationChannelServiceClient", + "rpcs": { + "GetNotificationChannelDescriptor": { + "methods": [ + "getNotificationChannelDescriptor" + ] + }, + "GetNotificationChannel": { + "methods": [ + "getNotificationChannel" + ] + }, + "CreateNotificationChannel": { + "methods": [ + "createNotificationChannel" + ] + }, + "UpdateNotificationChannel": { + "methods": [ + "updateNotificationChannel" + ] + }, + "DeleteNotificationChannel": { + "methods": [ + "deleteNotificationChannel" + ] + }, + "SendNotificationChannelVerificationCode": { + "methods": [ + "sendNotificationChannelVerificationCode" + ] + }, + "GetNotificationChannelVerificationCode": { + "methods": [ + "getNotificationChannelVerificationCode" + ] + }, + "VerifyNotificationChannel": { + "methods": [ + "verifyNotificationChannel" + ] + }, + "ListNotificationChannelDescriptors": { + "methods": [ + "listNotificationChannelDescriptors", + "listNotificationChannelDescriptorsStream", + "listNotificationChannelDescriptorsAsync" + ] + }, + "ListNotificationChannels": { + "methods": [ + "listNotificationChannels", + "listNotificationChannelsStream", + "listNotificationChannelsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "NotificationChannelServiceClient", + "rpcs": { + "GetNotificationChannelDescriptor": { + "methods": [ + "getNotificationChannelDescriptor" + ] + }, + "GetNotificationChannel": { + "methods": [ + "getNotificationChannel" + ] + }, + "CreateNotificationChannel": { + "methods": [ + "createNotificationChannel" + ] + }, + "UpdateNotificationChannel": { + "methods": [ + "updateNotificationChannel" + ] + }, + "DeleteNotificationChannel": { + "methods": [ + "deleteNotificationChannel" + ] + }, + "SendNotificationChannelVerificationCode": { + "methods": [ + "sendNotificationChannelVerificationCode" + ] + }, + "GetNotificationChannelVerificationCode": { + "methods": [ + "getNotificationChannelVerificationCode" + ] + }, + "VerifyNotificationChannel": { + "methods": [ + "verifyNotificationChannel" + ] + }, + "ListNotificationChannelDescriptors": { + "methods": [ + "listNotificationChannelDescriptors", + "listNotificationChannelDescriptorsStream", + "listNotificationChannelDescriptorsAsync" + ] + }, + "ListNotificationChannels": { + "methods": [ + "listNotificationChannels", + "listNotificationChannelsStream", + "listNotificationChannelsAsync" + ] + } + } + } + } + }, + "QueryService": { + "clients": { + "grpc": { + "libraryClient": "QueryServiceClient", + "rpcs": { + "QueryTimeSeries": { + "methods": [ + "queryTimeSeries", + "queryTimeSeriesStream", + "queryTimeSeriesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "QueryServiceClient", + "rpcs": { + "QueryTimeSeries": { + "methods": [ + "queryTimeSeries", + "queryTimeSeriesStream", + "queryTimeSeriesAsync" + ] + } + } + } + } + }, + "ServiceMonitoringService": { + "clients": { + "grpc": { + "libraryClient": "ServiceMonitoringServiceClient", + "rpcs": { + "CreateService": { + "methods": [ + "createService" + ] + }, + "GetService": { + "methods": [ + "getService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateServiceLevelObjective": { + "methods": [ + "createServiceLevelObjective" + ] + }, + "GetServiceLevelObjective": { + "methods": [ + "getServiceLevelObjective" + ] + }, + "UpdateServiceLevelObjective": { + "methods": [ + "updateServiceLevelObjective" + ] + }, + "DeleteServiceLevelObjective": { + "methods": [ + "deleteServiceLevelObjective" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListServiceLevelObjectives": { + "methods": [ + "listServiceLevelObjectives", + "listServiceLevelObjectivesStream", + "listServiceLevelObjectivesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ServiceMonitoringServiceClient", + "rpcs": { + "CreateService": { + "methods": [ + "createService" + ] + }, + "GetService": { + "methods": [ + "getService" + ] + }, + "UpdateService": { + "methods": [ + "updateService" + ] + }, + "DeleteService": { + "methods": [ + "deleteService" + ] + }, + "CreateServiceLevelObjective": { + "methods": [ + "createServiceLevelObjective" + ] + }, + "GetServiceLevelObjective": { + "methods": [ + "getServiceLevelObjective" + ] + }, + "UpdateServiceLevelObjective": { + "methods": [ + "updateServiceLevelObjective" + ] + }, + "DeleteServiceLevelObjective": { + "methods": [ + "deleteServiceLevelObjective" + ] + }, + "ListServices": { + "methods": [ + "listServices", + "listServicesStream", + "listServicesAsync" + ] + }, + "ListServiceLevelObjectives": { + "methods": [ + "listServiceLevelObjectives", + "listServiceLevelObjectivesStream", + "listServiceLevelObjectivesAsync" + ] + } + } + } + } + }, + "UptimeCheckService": { + "clients": { + "grpc": { + "libraryClient": "UptimeCheckServiceClient", + "rpcs": { + "GetUptimeCheckConfig": { + "methods": [ + "getUptimeCheckConfig" + ] + }, + "CreateUptimeCheckConfig": { + "methods": [ + "createUptimeCheckConfig" + ] + }, + "UpdateUptimeCheckConfig": { + "methods": [ + "updateUptimeCheckConfig" + ] + }, + "DeleteUptimeCheckConfig": { + "methods": [ + "deleteUptimeCheckConfig" + ] + }, + "ListUptimeCheckConfigs": { + "methods": [ + "listUptimeCheckConfigs", + "listUptimeCheckConfigsStream", + "listUptimeCheckConfigsAsync" + ] + }, + "ListUptimeCheckIps": { + "methods": [ + "listUptimeCheckIps", + "listUptimeCheckIpsStream", + "listUptimeCheckIpsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "UptimeCheckServiceClient", + "rpcs": { + "GetUptimeCheckConfig": { + "methods": [ + "getUptimeCheckConfig" + ] + }, + "CreateUptimeCheckConfig": { + "methods": [ + "createUptimeCheckConfig" + ] + }, + "UpdateUptimeCheckConfig": { + "methods": [ + "updateUptimeCheckConfig" + ] + }, + "DeleteUptimeCheckConfig": { + "methods": [ + "deleteUptimeCheckConfig" + ] + }, + "ListUptimeCheckConfigs": { + "methods": [ + "listUptimeCheckConfigs", + "listUptimeCheckConfigsStream", + "listUptimeCheckConfigsAsync" + ] + }, + "ListUptimeCheckIps": { + "methods": [ + "listUptimeCheckIps", + "listUptimeCheckIpsStream", + "listUptimeCheckIpsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-monitoring/src/v3/group_service_client.ts b/packages/google-cloud-monitoring/src/v3/group_service_client.ts new file mode 100644 index 00000000000..f38d2ac4a31 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/group_service_client.ts @@ -0,0 +1,2484 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3/group_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './group_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * The Group API lets you inspect and manage your + * [groups](#google.monitoring.v3.Group). + * + * A group is a named filter that is used to identify + * a collection of monitored resources. Groups are typically used to + * mirror the physical and/or logical topology of the environment. + * Because group membership is computed dynamically, monitored + * resources that are started in the future are automatically placed + * in matching groups. By using a group to name monitored resources in, + * for example, an alert policy, the target of that alert policy is + * updated automatically as monitored resources are added and removed + * from the infrastructure. + * @class + * @memberof v3 + */ +export class GroupServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + groupServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of GroupServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof GroupServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}' + ), + folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + ), + folderGroupPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/groups/{group}' + ), + folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannels/{notification_channel}' + ), + folderServicePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}' + ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + ), + organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}' + ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + ), + organizationGroupPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/groups/{group}' + ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}' + ), + organizationServicePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}' + ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}' + ), + projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + ), + projectGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/groups/{group}' + ), + projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannels/{notification_channel}' + ), + projectServicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}' + ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'group' + ), + listGroupMembers: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'members' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.monitoring.v3.GroupService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.groupServiceStub) { + return this.groupServiceStub; + } + + // Put together the "service stub" for + // google.monitoring.v3.GroupService. + this.groupServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.GroupService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.monitoring.v3.GroupService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const groupServiceStubMethods = [ + 'listGroups', + 'getGroup', + 'createGroup', + 'updateGroup', + 'deleteGroup', + 'listGroupMembers', + ]; + for (const methodName of groupServiceStubMethods) { + const callPromise = this.groupServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.groupServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'monitoring.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'monitoring.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getGroup( + request: protos.google.monitoring.v3.IGetGroupRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | undefined, + {} | undefined + ] + >; + getGroup( + request: protos.google.monitoring.v3.IGetGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + > + ): void; + getGroup( + request: protos.google.monitoring.v3.IGetGroupRequest, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a single group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Group]{@link google.monitoring.v3.Group}. + * 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.getGroup(request); + */ + getGroup( + request: protos.google.monitoring.v3.IGetGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IGetGroupRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getGroup(request, options, callback); + } + createGroup( + request: protos.google.monitoring.v3.ICreateGroupRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | undefined, + {} | undefined + ] + >; + createGroup( + request: protos.google.monitoring.v3.ICreateGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + > + ): void; + createGroup( + request: protos.google.monitoring.v3.ICreateGroupRequest, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a new group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project in which to create the group. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {google.monitoring.v3.Group} request.group + * Required. A group definition. It is an error to define the `name` field because + * the system assigns the name. + * @param {boolean} request.validateOnly + * If true, validate this request but do not create the group. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Group]{@link google.monitoring.v3.Group}. + * 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.createGroup(request); + */ + createGroup( + request: protos.google.monitoring.v3.ICreateGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.ICreateGroupRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.createGroup(request, options, callback); + } + updateGroup( + request: protos.google.monitoring.v3.IUpdateGroupRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | undefined, + {} | undefined + ] + >; + updateGroup( + request: protos.google.monitoring.v3.IUpdateGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + > + ): void; + updateGroup( + request: protos.google.monitoring.v3.IUpdateGroupRequest, + callback: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Updates an existing group. + * You can change any group attributes except `name`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.monitoring.v3.Group} request.group + * Required. The new definition of the group. All fields of the existing group, + * excepting `name`, are replaced with the corresponding fields of this group. + * @param {boolean} request.validateOnly + * If true, validate this request but do not update the existing group. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Group]{@link google.monitoring.v3.Group}. + * 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.updateGroup(request); + */ + updateGroup( + request: protos.google.monitoring.v3.IUpdateGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IGroup, + protos.google.monitoring.v3.IUpdateGroupRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'group.name': request.group!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateGroup(request, options, callback); + } + deleteGroup( + request: protos.google.monitoring.v3.IDeleteGroupRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | undefined, + {} | undefined + ] + >; + deleteGroup( + request: protos.google.monitoring.v3.IDeleteGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteGroup( + request: protos.google.monitoring.v3.IDeleteGroupRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes an existing group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {boolean} request.recursive + * If this field is true, then the request means to delete a group with all + * its descendants. Otherwise, the request means to delete a group only when + * it has no descendants. The default value is false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.deleteGroup(request); + */ + deleteGroup( + request: protos.google.monitoring.v3.IDeleteGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteGroupRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteGroup(request, options, callback); + } + + listGroups( + request: protos.google.monitoring.v3.IListGroupsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IGroup[], + protos.google.monitoring.v3.IListGroupsRequest | null, + protos.google.monitoring.v3.IListGroupsResponse + ] + >; + listGroups( + request: protos.google.monitoring.v3.IListGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListGroupsRequest, + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + > + ): void; + listGroups( + request: protos.google.monitoring.v3.IListGroupsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListGroupsRequest, + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + > + ): void; + /** + * Lists the existing groups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project whose groups are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.childrenOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * @param {string} request.ancestorsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * @param {string} request.descendantsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Group]{@link google.monitoring.v3.Group}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listGroups( + request: protos.google.monitoring.v3.IListGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListGroupsRequest, + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListGroupsRequest, + protos.google.monitoring.v3.IListGroupsResponse | null | undefined, + protos.google.monitoring.v3.IGroup + > + ): Promise< + [ + protos.google.monitoring.v3.IGroup[], + protos.google.monitoring.v3.IListGroupsRequest | null, + protos.google.monitoring.v3.IListGroupsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listGroups(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project whose groups are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.childrenOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * @param {string} request.ancestorsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * @param {string} request.descendantsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Group]{@link google.monitoring.v3.Group} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listGroupsStream( + request?: protos.google.monitoring.v3.IListGroupsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listGroups.createStream( + this.innerApiCalls.listGroups as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listGroups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project whose groups are to be listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.childrenOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups whose `parent_name` field contains the group + * name. If no groups have this parent, the results are empty. + * @param {string} request.ancestorsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns groups that are ancestors of the specified group. + * The groups are returned in order, starting with the immediate parent and + * ending with the most distant ancestor. If the specified group has no + * immediate parent, the results are empty. + * @param {string} request.descendantsOfGroup + * A group name. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * + * Returns the descendants of the specified group. This is a superset of + * the results returned by the `children_of_group` filter, and includes + * children-of-children, and so forth. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [Group]{@link google.monitoring.v3.Group}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listGroupsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listGroupsAsync( + request?: protos.google.monitoring.v3.IListGroupsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listGroups.asyncIterate( + this.innerApiCalls['listGroups'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listGroupMembers( + request: protos.google.monitoring.v3.IListGroupMembersRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IMonitoredResource[], + protos.google.monitoring.v3.IListGroupMembersRequest | null, + protos.google.monitoring.v3.IListGroupMembersResponse + ] + >; + listGroupMembers( + request: protos.google.monitoring.v3.IListGroupMembersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListGroupMembersRequest, + protos.google.monitoring.v3.IListGroupMembersResponse | null | undefined, + protos.google.api.IMonitoredResource + > + ): void; + listGroupMembers( + request: protos.google.monitoring.v3.IListGroupMembersRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListGroupMembersRequest, + protos.google.monitoring.v3.IListGroupMembersResponse | null | undefined, + protos.google.api.IMonitoredResource + > + ): void; + /** + * Lists the monitored resources that are members of a group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group whose members are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {string} request.filter + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * + * `resource.type = "gce_instance"` + * @param {google.monitoring.v3.TimeInterval} request.interval + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [MonitoredResource]{@link google.api.MonitoredResource}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listGroupMembersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listGroupMembers( + request: protos.google.monitoring.v3.IListGroupMembersRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListGroupMembersRequest, + | protos.google.monitoring.v3.IListGroupMembersResponse + | null + | undefined, + protos.google.api.IMonitoredResource + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListGroupMembersRequest, + protos.google.monitoring.v3.IListGroupMembersResponse | null | undefined, + protos.google.api.IMonitoredResource + > + ): Promise< + [ + protos.google.api.IMonitoredResource[], + protos.google.monitoring.v3.IListGroupMembersRequest | null, + protos.google.monitoring.v3.IListGroupMembersResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listGroupMembers(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group whose members are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {string} request.filter + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * + * `resource.type = "gce_instance"` + * @param {google.monitoring.v3.TimeInterval} request.interval + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [MonitoredResource]{@link google.api.MonitoredResource} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listGroupMembersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listGroupMembersStream( + request?: protos.google.monitoring.v3.IListGroupMembersRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listGroupMembers.createStream( + this.innerApiCalls.listGroupMembers as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listGroupMembers`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group whose members are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `next_page_token` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {string} request.filter + * An optional [list + * filter](https://cloud.google.com/monitoring/api/learn_more#filtering) + * describing the members to be returned. The filter may reference the type, + * labels, and metadata of monitored resources that comprise the group. For + * example, to return only resources representing Compute Engine VM instances, + * use this filter: + * + * `resource.type = "gce_instance"` + * @param {google.monitoring.v3.TimeInterval} request.interval + * An optional time interval for which results should be returned. Only + * members that were part of the group during the specified interval are + * included in the response. If no interval is provided then the group + * membership over the last minute is returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [MonitoredResource]{@link google.api.MonitoredResource}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listGroupMembersAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listGroupMembersAsync( + request?: protos.google.monitoring.v3.IListGroupMembersRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listGroupMembers.asyncIterate( + this.innerApiCalls['listGroupMembers'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAlertPolicy resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + folderAlertPolicyPath(folder: string, alertPolicy: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the folder from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified folderAlertPolicyCondition resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the folder from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified folderChannelDescriptor resource name string. + * + * @param {string} folder + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ + folder: folder, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the folder from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).folder; + } + + /** + * Parse the channel_descriptor from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified folderGroup resource name string. + * + * @param {string} folder + * @param {string} group + * @returns {string} Resource name string. + */ + folderGroupPath(folder: string, group: string) { + return this.pathTemplates.folderGroupPathTemplate.render({ + folder: folder, + group: group, + }); + } + + /** + * Parse the folder from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; + } + + /** + * Parse the group from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; + } + + /** + * Return a fully-qualified folderNotificationChannel resource name string. + * + * @param {string} folder + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + folderNotificationChannelPath(folder: string, notificationChannel: string) { + return this.pathTemplates.folderNotificationChannelPathTemplate.render({ + folder: folder, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the folder from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).folder; + } + + /** + * Parse the notification_channel from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified folderService resource name string. + * + * @param {string} folder + * @param {string} service + * @returns {string} Resource name string. + */ + folderServicePath(folder: string, service: string) { + return this.pathTemplates.folderServicePathTemplate.render({ + folder: folder, + service: service, + }); + } + + /** + * Parse the folder from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; + } + + /** + * Parse the service from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; + } + + /** + * Return a fully-qualified folderServiceServiceLevelObjective resource name string. + * + * @param {string} folder + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the folder from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).folder; + } + + /** + * Parse the service from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified folderUptimeCheckConfig resource name string. + * + * @param {string} folder + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ + folder: folder, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the folder from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).folder; + } + + /** + * Parse the uptime_check_config from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified organizationAlertPolicy resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + organizationAlertPolicyPath(organization: string, alertPolicy: string) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ + organization: organization, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the organization from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified organizationAlertPolicyCondition resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + } + ); + } + + /** + * Parse the organization from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified organizationChannelDescriptor resource name string. + * + * @param {string} organization + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ + organization: organization, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the organization from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).organization; + } + + /** + * Parse the channel_descriptor from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified organizationGroup resource name string. + * + * @param {string} organization + * @param {string} group + * @returns {string} Resource name string. + */ + organizationGroupPath(organization: string, group: string) { + return this.pathTemplates.organizationGroupPathTemplate.render({ + organization: organization, + group: group, + }); + } + + /** + * Parse the organization from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).organization; + } + + /** + * Parse the group from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).group; + } + + /** + * Return a fully-qualified organizationNotificationChannel resource name string. + * + * @param {string} organization + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + organizationNotificationChannelPath( + organization: string, + notificationChannel: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + } + ); + } + + /** + * Parse the organization from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).organization; + } + + /** + * Parse the notification_channel from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified organizationService resource name string. + * + * @param {string} organization + * @param {string} service + * @returns {string} Resource name string. + */ + organizationServicePath(organization: string, service: string) { + return this.pathTemplates.organizationServicePathTemplate.render({ + organization: organization, + service: service, + }); + } + + /** + * Parse the organization from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).organization; + } + + /** + * Parse the service from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceName(organizationServiceName: string) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).service; + } + + /** + * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. + * + * @param {string} organization + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the organization from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).organization; + } + + /** + * Parse the service from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified organizationUptimeCheckConfig resource name string. + * + * @param {string} organization + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ + organization: organization, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the organization from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).organization; + } + + /** + * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAlertPolicy resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + projectAlertPolicyPath(project: string, alertPolicy: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the project from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified projectAlertPolicyCondition resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the project from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified projectChannelDescriptor resource name string. + * + * @param {string} project + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + projectChannelDescriptorPath(project: string, channelDescriptor: string) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ + project: project, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the project from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).project; + } + + /** + * Parse the channel_descriptor from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified projectGroup resource name string. + * + * @param {string} project + * @param {string} group + * @returns {string} Resource name string. + */ + projectGroupPath(project: string, group: string) { + return this.pathTemplates.projectGroupPathTemplate.render({ + project: project, + group: group, + }); + } + + /** + * Parse the project from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; + } + + /** + * Parse the group from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; + } + + /** + * Return a fully-qualified projectNotificationChannel resource name string. + * + * @param {string} project + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + projectNotificationChannelPath(project: string, notificationChannel: string) { + return this.pathTemplates.projectNotificationChannelPathTemplate.render({ + project: project, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the project from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).project; + } + + /** + * Parse the notification_channel from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified projectService resource name string. + * + * @param {string} project + * @param {string} service + * @returns {string} Resource name string. + */ + projectServicePath(project: string, service: string) { + return this.pathTemplates.projectServicePathTemplate.render({ + project: project, + service: service, + }); + } + + /** + * Parse the project from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).project; + } + + /** + * Parse the service from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).service; + } + + /** + * Return a fully-qualified projectServiceServiceLevelObjective resource name string. + * + * @param {string} project + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the project from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).project; + } + + /** + * Parse the service from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified projectUptimeCheckConfig resource name string. + * + * @param {string} project + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ + project: project, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the project from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).project; + } + + /** + * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.groupServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-monitoring/src/v3/group_service_client_config.json b/packages/google-cloud-monitoring/src/v3/group_service_client_config.json new file mode 100644 index 00000000000..72f178cbdb4 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/group_service_client_config.json @@ -0,0 +1,65 @@ +{ + "interfaces": { + "google.monitoring.v3.GroupService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListGroups": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "GetGroup": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "CreateGroup": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateGroup": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "DeleteGroup": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "ListGroupMembers": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + } + } + } + } +} diff --git a/packages/google-cloud-monitoring/src/v3/group_service_proto_list.json b/packages/google-cloud-monitoring/src/v3/group_service_proto_list.json new file mode 100644 index 00000000000..e55f61d422f --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/group_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/monitoring/v3/alert.proto", + "../../protos/google/monitoring/v3/alert_service.proto", + "../../protos/google/monitoring/v3/common.proto", + "../../protos/google/monitoring/v3/dropped_labels.proto", + "../../protos/google/monitoring/v3/group.proto", + "../../protos/google/monitoring/v3/group_service.proto", + "../../protos/google/monitoring/v3/metric.proto", + "../../protos/google/monitoring/v3/metric_service.proto", + "../../protos/google/monitoring/v3/mutation_record.proto", + "../../protos/google/monitoring/v3/notification.proto", + "../../protos/google/monitoring/v3/notification_service.proto", + "../../protos/google/monitoring/v3/query_service.proto", + "../../protos/google/monitoring/v3/service.proto", + "../../protos/google/monitoring/v3/service_service.proto", + "../../protos/google/monitoring/v3/span_context.proto", + "../../protos/google/monitoring/v3/uptime.proto", + "../../protos/google/monitoring/v3/uptime_service.proto" +] diff --git a/packages/google-cloud-monitoring/src/v3/index.ts b/packages/google-cloud-monitoring/src/v3/index.ts new file mode 100644 index 00000000000..d3bade93ec7 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/index.ts @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {AlertPolicyServiceClient} from './alert_policy_service_client'; +export {GroupServiceClient} from './group_service_client'; +export {MetricServiceClient} from './metric_service_client'; +export {NotificationChannelServiceClient} from './notification_channel_service_client'; +export {QueryServiceClient} from './query_service_client'; +export {ServiceMonitoringServiceClient} from './service_monitoring_service_client'; +export {UptimeCheckServiceClient} from './uptime_check_service_client'; diff --git a/packages/google-cloud-monitoring/src/v3/metric_service_client.ts b/packages/google-cloud-monitoring/src/v3/metric_service_client.ts new file mode 100644 index 00000000000..db18a051203 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/metric_service_client.ts @@ -0,0 +1,3230 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3/metric_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './metric_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Manages metric descriptors, monitored resource descriptors, and + * time series data. + * @class + * @memberof v3 + */ +export class MetricServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + metricServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of MetricServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof MetricServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}' + ), + folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + ), + folderGroupPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/groups/{group}' + ), + folderMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/metricDescriptors/{metric_descriptor=**}' + ), + folderMonitoredResourceDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}' + ), + folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannels/{notification_channel}' + ), + folderServicePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}' + ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + ), + organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}' + ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + ), + organizationGroupPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/groups/{group}' + ), + organizationMetricDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/metricDescriptors/{metric_descriptor=**}' + ), + organizationMonitoredResourceDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}' + ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}' + ), + organizationServicePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}' + ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}' + ), + projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + ), + projectGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/groups/{group}' + ), + projectMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/metricDescriptors/{metric_descriptor=**}' + ), + projectMonitoredResourceDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}' + ), + projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannels/{notification_channel}' + ), + projectServicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}' + ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + projectTimeSeriesPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/timeSeries/{time_series}' + ), + projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listMonitoredResourceDescriptors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'resourceDescriptors' + ), + listMetricDescriptors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'metricDescriptors' + ), + listTimeSeries: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'timeSeries' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.monitoring.v3.MetricService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.metricServiceStub) { + return this.metricServiceStub; + } + + // Put together the "service stub" for + // google.monitoring.v3.MetricService. + this.metricServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.MetricService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.monitoring.v3.MetricService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const metricServiceStubMethods = [ + 'listMonitoredResourceDescriptors', + 'getMonitoredResourceDescriptor', + 'listMetricDescriptors', + 'getMetricDescriptor', + 'createMetricDescriptor', + 'deleteMetricDescriptor', + 'listTimeSeries', + 'createTimeSeries', + ]; + for (const methodName of metricServiceStubMethods) { + const callPromise = this.metricServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.metricServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'monitoring.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'monitoring.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + 'https://www.googleapis.com/auth/monitoring.write', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getMonitoredResourceDescriptor( + request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IMonitoredResourceDescriptor, + ( + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | undefined + ), + {} | undefined + ] + >; + getMonitoredResourceDescriptor( + request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IMonitoredResourceDescriptor, + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getMonitoredResourceDescriptor( + request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, + callback: Callback< + protos.google.api.IMonitoredResourceDescriptor, + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a single monitored resource descriptor. This method does not require a Workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The monitored resource descriptor to get. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/monitoredResourceDescriptors/[RESOURCE_TYPE] + * + * The `[RESOURCE_TYPE]` is a predefined type, such as + * `cloudsql_database`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [MonitoredResourceDescriptor]{@link google.api.MonitoredResourceDescriptor}. + * 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.getMonitoredResourceDescriptor(request); + */ + getMonitoredResourceDescriptor( + request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.IMonitoredResourceDescriptor, + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IMonitoredResourceDescriptor, + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.IMonitoredResourceDescriptor, + ( + | protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getMonitoredResourceDescriptor( + request, + options, + callback + ); + } + getMetricDescriptor( + request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.IGetMetricDescriptorRequest | undefined, + {} | undefined + ] + >; + getMetricDescriptor( + request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getMetricDescriptor( + request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, + callback: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a single metric descriptor. This method does not require a Workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The metric descriptor on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * + * An example value of `[METRIC_ID]` is + * `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [MetricDescriptor]{@link google.api.MetricDescriptor}. + * 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.getMetricDescriptor(request); + */ + getMetricDescriptor( + request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.IGetMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.IGetMetricDescriptorRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getMetricDescriptor(request, options, callback); + } + createMetricDescriptor( + request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.ICreateMetricDescriptorRequest | undefined, + {} | undefined + ] + >; + createMetricDescriptor( + request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createMetricDescriptor( + request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, + callback: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a new metric descriptor. + * User-created metric descriptors define + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {google.api.MetricDescriptor} request.metricDescriptor + * Required. The new [custom metric](https://cloud.google.com/monitoring/custom-metrics) + * descriptor. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [MetricDescriptor]{@link google.api.MetricDescriptor}. + * 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.createMetricDescriptor(request); + */ + createMetricDescriptor( + request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.api.IMetricDescriptor, + | protos.google.monitoring.v3.ICreateMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.api.IMetricDescriptor, + protos.google.monitoring.v3.ICreateMetricDescriptorRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.createMetricDescriptor( + request, + options, + callback + ); + } + deleteMetricDescriptor( + request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteMetricDescriptorRequest | undefined, + {} | undefined + ] + >; + deleteMetricDescriptor( + request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteMetricDescriptor( + request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes a metric descriptor. Only user-created + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics) can be + * deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The metric descriptor on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] + * + * An example of `[METRIC_ID]` is: + * `"custom.googleapis.com/my_test_metric"`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.deleteMetricDescriptor(request); + */ + deleteMetricDescriptor( + request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteMetricDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteMetricDescriptorRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteMetricDescriptor( + request, + options, + callback + ); + } + createTimeSeries( + request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | undefined, + {} | undefined + ] + >; + createTimeSeries( + request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + > + ): void; + createTimeSeries( + request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Creates or adds data to one or more time series. + * The response is empty if all time series in the request were written. + * If any time series could not be written, a corresponding failure message is + * included in the error response. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number[]} request.timeSeries + * Required. The new data to be added to a list of time series. + * Adds at most one data point to each of several time series. The new data + * point must be more recent than any other point in its time series. Each + * `TimeSeries` value must fully specify a unique time series by supplying + * all label values for the metric and the monitored resource. + * + * The maximum number of `TimeSeries` objects per `Create` request is 200. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.createTimeSeries(request); + */ + createTimeSeries( + request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ICreateTimeSeriesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.ICreateTimeSeriesRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.createTimeSeries(request, options, callback); + } + + listMonitoredResourceDescriptors( + request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest | null, + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + ] + >; + listMonitoredResourceDescriptors( + request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + | protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + > + ): void; + listMonitoredResourceDescriptors( + request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + | protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + > + ): void; + /** + * Lists monitored resource descriptors that match a filter. This method does not require a Workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * + * resource.type = starts_with("gce_") AND resource.label:id + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [MonitoredResourceDescriptor]{@link google.api.MonitoredResourceDescriptor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMonitoredResourceDescriptors( + request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + | protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + | protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + | null + | undefined, + protos.google.api.IMonitoredResourceDescriptor + > + ): Promise< + [ + protos.google.api.IMonitoredResourceDescriptor[], + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest | null, + protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listMonitoredResourceDescriptors( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * + * resource.type = starts_with("gce_") AND resource.label:id + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [MonitoredResourceDescriptor]{@link google.api.MonitoredResourceDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMonitoredResourceDescriptorsStream( + request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listMonitoredResourceDescriptors.createStream( + this.innerApiCalls.listMonitoredResourceDescriptors as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listMonitoredResourceDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * An optional [filter](https://cloud.google.com/monitoring/api/v3/filters) + * describing the descriptors to be returned. The filter can reference the + * descriptor's type and labels. For example, the following filter returns + * only Google Compute Engine descriptors that have an `id` label: + * + * resource.type = starts_with("gce_") AND resource.label:id + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [MonitoredResourceDescriptor]{@link google.api.MonitoredResourceDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listMonitoredResourceDescriptorsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listMonitoredResourceDescriptorsAsync( + request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( + this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listMetricDescriptors( + request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.api.IMetricDescriptor[], + protos.google.monitoring.v3.IListMetricDescriptorsRequest | null, + protos.google.monitoring.v3.IListMetricDescriptorsResponse + ] + >; + listMetricDescriptors( + request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListMetricDescriptorsRequest, + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + > + ): void; + listMetricDescriptors( + request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListMetricDescriptorsRequest, + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + > + ): void; + /** + * Lists metric descriptors that match a filter. This method does not require a Workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * + * metric.type = starts_with("custom.googleapis.com/") + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [MetricDescriptor]{@link google.api.MetricDescriptor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMetricDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMetricDescriptors( + request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListMetricDescriptorsRequest, + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListMetricDescriptorsRequest, + | protos.google.monitoring.v3.IListMetricDescriptorsResponse + | null + | undefined, + protos.google.api.IMetricDescriptor + > + ): Promise< + [ + protos.google.api.IMetricDescriptor[], + protos.google.monitoring.v3.IListMetricDescriptorsRequest | null, + protos.google.monitoring.v3.IListMetricDescriptorsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listMetricDescriptors(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * + * metric.type = starts_with("custom.googleapis.com/") + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [MetricDescriptor]{@link google.api.MetricDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMetricDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listMetricDescriptorsStream( + request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listMetricDescriptors.createStream( + this.innerApiCalls.listMetricDescriptors as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listMetricDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * If this field is empty, all custom and + * system-defined metric descriptors are returned. + * Otherwise, the [filter](https://cloud.google.com/monitoring/api/v3/filters) + * specifies which metric descriptors are to be + * returned. For example, the following filter matches all + * [custom metrics](https://cloud.google.com/monitoring/custom-metrics): + * + * metric.type = starts_with("custom.googleapis.com/") + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [MetricDescriptor]{@link google.api.MetricDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listMetricDescriptorsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listMetricDescriptorsAsync( + request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listMetricDescriptors.asyncIterate( + this.innerApiCalls['listMetricDescriptors'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listTimeSeries( + request: protos.google.monitoring.v3.IListTimeSeriesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.ITimeSeries[], + protos.google.monitoring.v3.IListTimeSeriesRequest | null, + protos.google.monitoring.v3.IListTimeSeriesResponse + ] + >; + listTimeSeries( + request: protos.google.monitoring.v3.IListTimeSeriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListTimeSeriesRequest, + protos.google.monitoring.v3.IListTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeries + > + ): void; + listTimeSeries( + request: protos.google.monitoring.v3.IListTimeSeriesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListTimeSeriesRequest, + protos.google.monitoring.v3.IListTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeries + > + ): void; + /** + * Lists time series that match a filter. This method does not require a Workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project, organization or folder on which to execute the request. The + * format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * @param {string} request.filter + * Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * that specifies which time series should be returned. The filter must + * specify a single metric type, and can additionally specify metric labels + * and other information. For example: + * + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param {google.monitoring.v3.TimeInterval} request.interval + * Required. The time interval for which results should be returned. Only time series + * that contain data points in the specified interval are included + * in the response. + * @param {google.monitoring.v3.Aggregation} request.aggregation + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * @param {string} request.orderBy + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view + * Required. Specifies which information is returned about the time series. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [TimeSeries]{@link google.monitoring.v3.TimeSeries}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listTimeSeriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTimeSeries( + request: protos.google.monitoring.v3.IListTimeSeriesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListTimeSeriesRequest, + | protos.google.monitoring.v3.IListTimeSeriesResponse + | null + | undefined, + protos.google.monitoring.v3.ITimeSeries + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListTimeSeriesRequest, + protos.google.monitoring.v3.IListTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeries + > + ): Promise< + [ + protos.google.monitoring.v3.ITimeSeries[], + protos.google.monitoring.v3.IListTimeSeriesRequest | null, + protos.google.monitoring.v3.IListTimeSeriesResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listTimeSeries(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project, organization or folder on which to execute the request. The + * format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * @param {string} request.filter + * Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * that specifies which time series should be returned. The filter must + * specify a single metric type, and can additionally specify metric labels + * and other information. For example: + * + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param {google.monitoring.v3.TimeInterval} request.interval + * Required. The time interval for which results should be returned. Only time series + * that contain data points in the specified interval are included + * in the response. + * @param {google.monitoring.v3.Aggregation} request.aggregation + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * @param {string} request.orderBy + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view + * Required. Specifies which information is returned about the time series. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [TimeSeries]{@link google.monitoring.v3.TimeSeries} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listTimeSeriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listTimeSeriesStream( + request?: protos.google.monitoring.v3.IListTimeSeriesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listTimeSeries.createStream( + this.innerApiCalls.listTimeSeries as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listTimeSeries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project, organization or folder on which to execute the request. The + * format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * organizations/[ORGANIZATION_ID] + * folders/[FOLDER_ID] + * @param {string} request.filter + * Required. A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) + * that specifies which time series should be returned. The filter must + * specify a single metric type, and can additionally specify metric labels + * and other information. For example: + * + * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param {google.monitoring.v3.TimeInterval} request.interval + * Required. The time interval for which results should be returned. Only time series + * that contain data points in the specified interval are included + * in the response. + * @param {google.monitoring.v3.Aggregation} request.aggregation + * Specifies the alignment of data points in individual time series as + * well as how to combine the retrieved time series across specified labels. + * + * By default (if no `aggregation` is explicitly specified), the raw time + * series data is returned. + * @param {google.monitoring.v3.Aggregation} request.secondaryAggregation + * Apply a second aggregation after `aggregation` is applied. May only be + * specified if `aggregation` is specified. + * @param {string} request.orderBy + * Unsupported: must be left blank. The points in each time series are + * currently returned in reverse time order (most recent to oldest). + * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view + * Required. Specifies which information is returned about the time series. + * @param {number} request.pageSize + * A positive number that is the maximum number of results to return. If + * `page_size` is empty or more than 100,000 results, the effective + * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the + * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is + * the maximum number of `TimeSeries` returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [TimeSeries]{@link google.monitoring.v3.TimeSeries}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listTimeSeriesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listTimeSeriesAsync( + request?: protos.google.monitoring.v3.IListTimeSeriesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listTimeSeries.asyncIterate( + this.innerApiCalls['listTimeSeries'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAlertPolicy resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + folderAlertPolicyPath(folder: string, alertPolicy: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the folder from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified folderAlertPolicyCondition resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the folder from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified folderChannelDescriptor resource name string. + * + * @param {string} folder + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ + folder: folder, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the folder from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).folder; + } + + /** + * Parse the channel_descriptor from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified folderGroup resource name string. + * + * @param {string} folder + * @param {string} group + * @returns {string} Resource name string. + */ + folderGroupPath(folder: string, group: string) { + return this.pathTemplates.folderGroupPathTemplate.render({ + folder: folder, + group: group, + }); + } + + /** + * Parse the folder from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; + } + + /** + * Parse the group from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; + } + + /** + * Return a fully-qualified folderMetricDescriptor resource name string. + * + * @param {string} folder + * @param {string} metric_descriptor + * @returns {string} Resource name string. + */ + folderMetricDescriptorPath(folder: string, metricDescriptor: string) { + return this.pathTemplates.folderMetricDescriptorPathTemplate.render({ + folder: folder, + metric_descriptor: metricDescriptor, + }); + } + + /** + * Parse the folder from FolderMetricDescriptor resource. + * + * @param {string} folderMetricDescriptorName + * A fully-qualified path representing folder_metric_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderMetricDescriptorName( + folderMetricDescriptorName: string + ) { + return this.pathTemplates.folderMetricDescriptorPathTemplate.match( + folderMetricDescriptorName + ).folder; + } + + /** + * Parse the metric_descriptor from FolderMetricDescriptor resource. + * + * @param {string} folderMetricDescriptorName + * A fully-qualified path representing folder_metric_descriptor resource. + * @returns {string} A string representing the metric_descriptor. + */ + matchMetricDescriptorFromFolderMetricDescriptorName( + folderMetricDescriptorName: string + ) { + return this.pathTemplates.folderMetricDescriptorPathTemplate.match( + folderMetricDescriptorName + ).metric_descriptor; + } + + /** + * Return a fully-qualified folderMonitoredResourceDescriptor resource name string. + * + * @param {string} folder + * @param {string} monitored_resource_descriptor + * @returns {string} Resource name string. + */ + folderMonitoredResourceDescriptorPath( + folder: string, + monitoredResourceDescriptor: string + ) { + return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render( + { + folder: folder, + monitored_resource_descriptor: monitoredResourceDescriptor, + } + ); + } + + /** + * Parse the folder from FolderMonitoredResourceDescriptor resource. + * + * @param {string} folderMonitoredResourceDescriptorName + * A fully-qualified path representing folder_monitored_resource_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderMonitoredResourceDescriptorName( + folderMonitoredResourceDescriptorName: string + ) { + return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match( + folderMonitoredResourceDescriptorName + ).folder; + } + + /** + * Parse the monitored_resource_descriptor from FolderMonitoredResourceDescriptor resource. + * + * @param {string} folderMonitoredResourceDescriptorName + * A fully-qualified path representing folder_monitored_resource_descriptor resource. + * @returns {string} A string representing the monitored_resource_descriptor. + */ + matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName( + folderMonitoredResourceDescriptorName: string + ) { + return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match( + folderMonitoredResourceDescriptorName + ).monitored_resource_descriptor; + } + + /** + * Return a fully-qualified folderNotificationChannel resource name string. + * + * @param {string} folder + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + folderNotificationChannelPath(folder: string, notificationChannel: string) { + return this.pathTemplates.folderNotificationChannelPathTemplate.render({ + folder: folder, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the folder from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).folder; + } + + /** + * Parse the notification_channel from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified folderService resource name string. + * + * @param {string} folder + * @param {string} service + * @returns {string} Resource name string. + */ + folderServicePath(folder: string, service: string) { + return this.pathTemplates.folderServicePathTemplate.render({ + folder: folder, + service: service, + }); + } + + /** + * Parse the folder from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; + } + + /** + * Parse the service from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; + } + + /** + * Return a fully-qualified folderServiceServiceLevelObjective resource name string. + * + * @param {string} folder + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the folder from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).folder; + } + + /** + * Parse the service from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified folderUptimeCheckConfig resource name string. + * + * @param {string} folder + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ + folder: folder, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the folder from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).folder; + } + + /** + * Parse the uptime_check_config from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified organizationAlertPolicy resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + organizationAlertPolicyPath(organization: string, alertPolicy: string) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ + organization: organization, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the organization from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified organizationAlertPolicyCondition resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + } + ); + } + + /** + * Parse the organization from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified organizationChannelDescriptor resource name string. + * + * @param {string} organization + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ + organization: organization, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the organization from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).organization; + } + + /** + * Parse the channel_descriptor from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified organizationGroup resource name string. + * + * @param {string} organization + * @param {string} group + * @returns {string} Resource name string. + */ + organizationGroupPath(organization: string, group: string) { + return this.pathTemplates.organizationGroupPathTemplate.render({ + organization: organization, + group: group, + }); + } + + /** + * Parse the organization from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).organization; + } + + /** + * Parse the group from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).group; + } + + /** + * Return a fully-qualified organizationMetricDescriptor resource name string. + * + * @param {string} organization + * @param {string} metric_descriptor + * @returns {string} Resource name string. + */ + organizationMetricDescriptorPath( + organization: string, + metricDescriptor: string + ) { + return this.pathTemplates.organizationMetricDescriptorPathTemplate.render({ + organization: organization, + metric_descriptor: metricDescriptor, + }); + } + + /** + * Parse the organization from OrganizationMetricDescriptor resource. + * + * @param {string} organizationMetricDescriptorName + * A fully-qualified path representing organization_metric_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationMetricDescriptorName( + organizationMetricDescriptorName: string + ) { + return this.pathTemplates.organizationMetricDescriptorPathTemplate.match( + organizationMetricDescriptorName + ).organization; + } + + /** + * Parse the metric_descriptor from OrganizationMetricDescriptor resource. + * + * @param {string} organizationMetricDescriptorName + * A fully-qualified path representing organization_metric_descriptor resource. + * @returns {string} A string representing the metric_descriptor. + */ + matchMetricDescriptorFromOrganizationMetricDescriptorName( + organizationMetricDescriptorName: string + ) { + return this.pathTemplates.organizationMetricDescriptorPathTemplate.match( + organizationMetricDescriptorName + ).metric_descriptor; + } + + /** + * Return a fully-qualified organizationMonitoredResourceDescriptor resource name string. + * + * @param {string} organization + * @param {string} monitored_resource_descriptor + * @returns {string} Resource name string. + */ + organizationMonitoredResourceDescriptorPath( + organization: string, + monitoredResourceDescriptor: string + ) { + return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render( + { + organization: organization, + monitored_resource_descriptor: monitoredResourceDescriptor, + } + ); + } + + /** + * Parse the organization from OrganizationMonitoredResourceDescriptor resource. + * + * @param {string} organizationMonitoredResourceDescriptorName + * A fully-qualified path representing organization_monitored_resource_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationMonitoredResourceDescriptorName( + organizationMonitoredResourceDescriptorName: string + ) { + return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match( + organizationMonitoredResourceDescriptorName + ).organization; + } + + /** + * Parse the monitored_resource_descriptor from OrganizationMonitoredResourceDescriptor resource. + * + * @param {string} organizationMonitoredResourceDescriptorName + * A fully-qualified path representing organization_monitored_resource_descriptor resource. + * @returns {string} A string representing the monitored_resource_descriptor. + */ + matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName( + organizationMonitoredResourceDescriptorName: string + ) { + return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match( + organizationMonitoredResourceDescriptorName + ).monitored_resource_descriptor; + } + + /** + * Return a fully-qualified organizationNotificationChannel resource name string. + * + * @param {string} organization + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + organizationNotificationChannelPath( + organization: string, + notificationChannel: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + } + ); + } + + /** + * Parse the organization from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).organization; + } + + /** + * Parse the notification_channel from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified organizationService resource name string. + * + * @param {string} organization + * @param {string} service + * @returns {string} Resource name string. + */ + organizationServicePath(organization: string, service: string) { + return this.pathTemplates.organizationServicePathTemplate.render({ + organization: organization, + service: service, + }); + } + + /** + * Parse the organization from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).organization; + } + + /** + * Parse the service from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceName(organizationServiceName: string) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).service; + } + + /** + * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. + * + * @param {string} organization + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the organization from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).organization; + } + + /** + * Parse the service from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified organizationUptimeCheckConfig resource name string. + * + * @param {string} organization + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ + organization: organization, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the organization from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).organization; + } + + /** + * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAlertPolicy resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + projectAlertPolicyPath(project: string, alertPolicy: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the project from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified projectAlertPolicyCondition resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the project from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified projectChannelDescriptor resource name string. + * + * @param {string} project + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + projectChannelDescriptorPath(project: string, channelDescriptor: string) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ + project: project, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the project from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).project; + } + + /** + * Parse the channel_descriptor from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified projectGroup resource name string. + * + * @param {string} project + * @param {string} group + * @returns {string} Resource name string. + */ + projectGroupPath(project: string, group: string) { + return this.pathTemplates.projectGroupPathTemplate.render({ + project: project, + group: group, + }); + } + + /** + * Parse the project from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; + } + + /** + * Parse the group from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; + } + + /** + * Return a fully-qualified projectMetricDescriptor resource name string. + * + * @param {string} project + * @param {string} metric_descriptor + * @returns {string} Resource name string. + */ + projectMetricDescriptorPath(project: string, metricDescriptor: string) { + return this.pathTemplates.projectMetricDescriptorPathTemplate.render({ + project: project, + metric_descriptor: metricDescriptor, + }); + } + + /** + * Parse the project from ProjectMetricDescriptor resource. + * + * @param {string} projectMetricDescriptorName + * A fully-qualified path representing project_metric_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectMetricDescriptorName( + projectMetricDescriptorName: string + ) { + return this.pathTemplates.projectMetricDescriptorPathTemplate.match( + projectMetricDescriptorName + ).project; + } + + /** + * Parse the metric_descriptor from ProjectMetricDescriptor resource. + * + * @param {string} projectMetricDescriptorName + * A fully-qualified path representing project_metric_descriptor resource. + * @returns {string} A string representing the metric_descriptor. + */ + matchMetricDescriptorFromProjectMetricDescriptorName( + projectMetricDescriptorName: string + ) { + return this.pathTemplates.projectMetricDescriptorPathTemplate.match( + projectMetricDescriptorName + ).metric_descriptor; + } + + /** + * Return a fully-qualified projectMonitoredResourceDescriptor resource name string. + * + * @param {string} project + * @param {string} monitored_resource_descriptor + * @returns {string} Resource name string. + */ + projectMonitoredResourceDescriptorPath( + project: string, + monitoredResourceDescriptor: string + ) { + return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render( + { + project: project, + monitored_resource_descriptor: monitoredResourceDescriptor, + } + ); + } + + /** + * Parse the project from ProjectMonitoredResourceDescriptor resource. + * + * @param {string} projectMonitoredResourceDescriptorName + * A fully-qualified path representing project_monitored_resource_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectMonitoredResourceDescriptorName( + projectMonitoredResourceDescriptorName: string + ) { + return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match( + projectMonitoredResourceDescriptorName + ).project; + } + + /** + * Parse the monitored_resource_descriptor from ProjectMonitoredResourceDescriptor resource. + * + * @param {string} projectMonitoredResourceDescriptorName + * A fully-qualified path representing project_monitored_resource_descriptor resource. + * @returns {string} A string representing the monitored_resource_descriptor. + */ + matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName( + projectMonitoredResourceDescriptorName: string + ) { + return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match( + projectMonitoredResourceDescriptorName + ).monitored_resource_descriptor; + } + + /** + * Return a fully-qualified projectNotificationChannel resource name string. + * + * @param {string} project + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + projectNotificationChannelPath(project: string, notificationChannel: string) { + return this.pathTemplates.projectNotificationChannelPathTemplate.render({ + project: project, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the project from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).project; + } + + /** + * Parse the notification_channel from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified projectService resource name string. + * + * @param {string} project + * @param {string} service + * @returns {string} Resource name string. + */ + projectServicePath(project: string, service: string) { + return this.pathTemplates.projectServicePathTemplate.render({ + project: project, + service: service, + }); + } + + /** + * Parse the project from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).project; + } + + /** + * Parse the service from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).service; + } + + /** + * Return a fully-qualified projectServiceServiceLevelObjective resource name string. + * + * @param {string} project + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the project from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).project; + } + + /** + * Parse the service from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified projectTimeSeries resource name string. + * + * @param {string} project + * @param {string} time_series + * @returns {string} Resource name string. + */ + projectTimeSeriesPath(project: string, timeSeries: string) { + return this.pathTemplates.projectTimeSeriesPathTemplate.render({ + project: project, + time_series: timeSeries, + }); + } + + /** + * Parse the project from ProjectTimeSeries resource. + * + * @param {string} projectTimeSeriesName + * A fully-qualified path representing project_time_series resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectTimeSeriesName(projectTimeSeriesName: string) { + return this.pathTemplates.projectTimeSeriesPathTemplate.match( + projectTimeSeriesName + ).project; + } + + /** + * Parse the time_series from ProjectTimeSeries resource. + * + * @param {string} projectTimeSeriesName + * A fully-qualified path representing project_time_series resource. + * @returns {string} A string representing the time_series. + */ + matchTimeSeriesFromProjectTimeSeriesName(projectTimeSeriesName: string) { + return this.pathTemplates.projectTimeSeriesPathTemplate.match( + projectTimeSeriesName + ).time_series; + } + + /** + * Return a fully-qualified projectUptimeCheckConfig resource name string. + * + * @param {string} project + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ + project: project, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the project from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).project; + } + + /** + * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.metricServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-monitoring/src/v3/metric_service_client_config.json b/packages/google-cloud-monitoring/src/v3/metric_service_client_config.json new file mode 100644 index 00000000000..1bb5d8d4e2c --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/metric_service_client_config.json @@ -0,0 +1,75 @@ +{ + "interfaces": { + "google.monitoring.v3.MetricService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListMonitoredResourceDescriptors": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "GetMonitoredResourceDescriptor": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "ListMetricDescriptors": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "GetMetricDescriptor": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "CreateMetricDescriptor": { + "timeout_millis": 12000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteMetricDescriptor": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "ListTimeSeries": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "CreateTimeSeries": { + "timeout_millis": 12000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-monitoring/src/v3/metric_service_proto_list.json b/packages/google-cloud-monitoring/src/v3/metric_service_proto_list.json new file mode 100644 index 00000000000..e55f61d422f --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/metric_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/monitoring/v3/alert.proto", + "../../protos/google/monitoring/v3/alert_service.proto", + "../../protos/google/monitoring/v3/common.proto", + "../../protos/google/monitoring/v3/dropped_labels.proto", + "../../protos/google/monitoring/v3/group.proto", + "../../protos/google/monitoring/v3/group_service.proto", + "../../protos/google/monitoring/v3/metric.proto", + "../../protos/google/monitoring/v3/metric_service.proto", + "../../protos/google/monitoring/v3/mutation_record.proto", + "../../protos/google/monitoring/v3/notification.proto", + "../../protos/google/monitoring/v3/notification_service.proto", + "../../protos/google/monitoring/v3/query_service.proto", + "../../protos/google/monitoring/v3/service.proto", + "../../protos/google/monitoring/v3/service_service.proto", + "../../protos/google/monitoring/v3/span_context.proto", + "../../protos/google/monitoring/v3/uptime.proto", + "../../protos/google/monitoring/v3/uptime_service.proto" +] diff --git a/packages/google-cloud-monitoring/src/v3/notification_channel_service_client.ts b/packages/google-cloud-monitoring/src/v3/notification_channel_service_client.ts new file mode 100644 index 00000000000..123f549e0cb --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/notification_channel_service_client.ts @@ -0,0 +1,2980 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3/notification_channel_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './notification_channel_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * The Notification Channel API provides access to configuration that + * controls how messages related to incidents are sent. + * @class + * @memberof v3 + */ +export class NotificationChannelServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + notificationChannelServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of NotificationChannelServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof NotificationChannelServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}' + ), + folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + ), + folderGroupPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/groups/{group}' + ), + folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannels/{notification_channel}' + ), + folderServicePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}' + ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + ), + organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}' + ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + ), + organizationGroupPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/groups/{group}' + ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}' + ), + organizationServicePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}' + ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}' + ), + projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + ), + projectGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/groups/{group}' + ), + projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannels/{notification_channel}' + ), + projectServicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}' + ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listNotificationChannelDescriptors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'channelDescriptors' + ), + listNotificationChannels: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'notificationChannels' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.monitoring.v3.NotificationChannelService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.notificationChannelServiceStub) { + return this.notificationChannelServiceStub; + } + + // Put together the "service stub" for + // google.monitoring.v3.NotificationChannelService. + this.notificationChannelServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.NotificationChannelService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.monitoring.v3.NotificationChannelService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const notificationChannelServiceStubMethods = [ + 'listNotificationChannelDescriptors', + 'getNotificationChannelDescriptor', + 'listNotificationChannels', + 'getNotificationChannel', + 'createNotificationChannel', + 'updateNotificationChannel', + 'deleteNotificationChannel', + 'sendNotificationChannelVerificationCode', + 'getNotificationChannelVerificationCode', + 'verifyNotificationChannel', + ]; + for (const methodName of notificationChannelServiceStubMethods) { + const callPromise = this.notificationChannelServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.notificationChannelServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'monitoring.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'monitoring.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getNotificationChannelDescriptor( + request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannelDescriptor, + ( + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | undefined + ), + {} | undefined + ] + >; + getNotificationChannelDescriptor( + request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannelDescriptor, + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getNotificationChannelDescriptor( + request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannelDescriptor, + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a single channel descriptor. The descriptor indicates which fields + * are expected / permitted for a notification channel of the given type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The channel type for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannelDescriptors/[CHANNEL_TYPE] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [NotificationChannelDescriptor]{@link google.monitoring.v3.NotificationChannelDescriptor}. + * 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.getNotificationChannelDescriptor(request); + */ + getNotificationChannelDescriptor( + request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.INotificationChannelDescriptor, + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannelDescriptor, + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannelDescriptor, + ( + | protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getNotificationChannelDescriptor( + request, + options, + callback + ); + } + getNotificationChannel( + request: protos.google.monitoring.v3.IGetNotificationChannelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IGetNotificationChannelRequest | undefined, + {} | undefined + ] + >; + getNotificationChannel( + request: protos.google.monitoring.v3.IGetNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getNotificationChannel( + request: protos.google.monitoring.v3.IGetNotificationChannelRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a single notification channel. The channel includes the relevant + * configuration details with which the channel was created. However, the + * response may truncate or omit passwords, API keys, or other private key + * matter and thus the response may not be 100% identical to the information + * that was supplied in the call to the create method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The channel for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [NotificationChannel]{@link google.monitoring.v3.NotificationChannel}. + * 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.getNotificationChannel(request); + */ + getNotificationChannel( + request: protos.google.monitoring.v3.IGetNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IGetNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IGetNotificationChannelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getNotificationChannel( + request, + options, + callback + ); + } + createNotificationChannel( + request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.ICreateNotificationChannelRequest | undefined, + {} | undefined + ] + >; + createNotificationChannel( + request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createNotificationChannel( + request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a new notification channel, representing a single notification + * endpoint such as an email address, SMS number, or PagerDuty service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container into which the channel will be + * written, this does not name the newly created channel. The resulting + * channel's name will have a normalized version of this field as a prefix, + * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. + * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel + * Required. The definition of the `NotificationChannel` to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [NotificationChannel]{@link google.monitoring.v3.NotificationChannel}. + * 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.createNotificationChannel(request); + */ + createNotificationChannel( + request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.ICreateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.ICreateNotificationChannelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.createNotificationChannel( + request, + options, + callback + ); + } + updateNotificationChannel( + request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IUpdateNotificationChannelRequest | undefined, + {} | undefined + ] + >; + updateNotificationChannel( + request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateNotificationChannel( + request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates a notification channel. Fields not specified in the field mask + * remain unchanged. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * The fields to update. + * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel + * Required. A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for + * fields to be updated; the names of these fields should also be + * included in the `update_mask`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [NotificationChannel]{@link google.monitoring.v3.NotificationChannel}. + * 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.updateNotificationChannel(request); + */ + updateNotificationChannel( + request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IUpdateNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IUpdateNotificationChannelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'notification_channel.name': request.notificationChannel!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateNotificationChannel( + request, + options, + callback + ); + } + deleteNotificationChannel( + request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteNotificationChannelRequest | undefined, + {} | undefined + ] + >; + deleteNotificationChannel( + request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteNotificationChannel( + request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes a notification channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The channel for which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] + * @param {boolean} request.force + * If true, the notification channel will be deleted regardless of its + * use in alert policies (the policies will be updated to remove the + * channel). If false, channels that are still referenced by an existing + * alerting policy will fail to be deleted in a delete operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.deleteNotificationChannel(request); + */ + deleteNotificationChannel( + request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteNotificationChannelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteNotificationChannel( + request, + options, + callback + ); + } + sendNotificationChannelVerificationCode( + request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined + ] + >; + sendNotificationChannelVerificationCode( + request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + sendNotificationChannelVerificationCode( + request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Causes a verification code to be delivered to the channel. The code + * can then be supplied in `VerifyNotificationChannel` to verify the channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The notification channel to which to send a verification code. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.sendNotificationChannelVerificationCode(request); + */ + sendNotificationChannelVerificationCode( + request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.sendNotificationChannelVerificationCode( + request, + options, + callback + ); + } + getNotificationChannelVerificationCode( + request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + ( + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined + ] + >; + getNotificationChannelVerificationCode( + request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getNotificationChannelVerificationCode( + request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, + callback: Callback< + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Requests a verification code for an already verified channel that can then + * be used in a call to VerifyNotificationChannel() on a different channel + * with an equivalent identity in the same or in a different project. This + * makes it possible to copy a channel between projects without requiring + * manual reverification of the channel. If the channel is not in the + * verified state, this method will fail (in other words, this may only be + * used if the SendNotificationChannelVerificationCode and + * VerifyNotificationChannel paths have already been used to put the given + * channel into the verified state). + * + * There is no guarantee that the verification codes returned by this method + * will be of a similar structure or form as the ones that are delivered + * to the channel via SendNotificationChannelVerificationCode; while + * VerifyNotificationChannel() will recognize both the codes delivered via + * SendNotificationChannelVerificationCode() and returned from + * GetNotificationChannelVerificationCode(), it is typically the case that + * the verification codes delivered via + * SendNotificationChannelVerificationCode() will be shorter and also + * have a shorter expiration (e.g. codes such as "G-123456") whereas + * GetVerificationCode() will typically return a much longer, websafe base + * 64 encoded string that has a longer expiration time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The notification channel for which a verification code is to be generated + * and retrieved. This must name a channel that is already verified; if + * the specified channel is not verified, the request will fail. + * @param {google.protobuf.Timestamp} request.expireTime + * The desired expiration time. If specified, the API will guarantee that + * the returned code will not be valid after the specified timestamp; + * however, the API cannot guarantee that the returned code will be + * valid for at least as long as the requested time (the API puts an upper + * bound on the amount of time for which a code may be valid). If omitted, + * a default expiration will be used, which may be less than the max + * permissible expiration (so specifying an expiration may extend the + * code's lifetime over omitting an expiration, even though the API does + * impose an upper limit on the maximum expiration that is permitted). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GetNotificationChannelVerificationCodeResponse]{@link google.monitoring.v3.GetNotificationChannelVerificationCodeResponse}. + * 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.getNotificationChannelVerificationCode(request); + */ + getNotificationChannelVerificationCode( + request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, + ( + | protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getNotificationChannelVerificationCode( + request, + options, + callback + ); + } + verifyNotificationChannel( + request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IVerifyNotificationChannelRequest | undefined, + {} | undefined + ] + >; + verifyNotificationChannel( + request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + verifyNotificationChannel( + request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, + callback: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Verifies a `NotificationChannel` by proving receipt of the code + * delivered to the channel as a result of calling + * `SendNotificationChannelVerificationCode`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The notification channel to verify. + * @param {string} request.code + * Required. The verification code that was delivered to the channel as + * a result of invoking the `SendNotificationChannelVerificationCode` API + * method or that was retrieved from a verified channel via + * `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only + * guaranteed that the code is valid UTF-8; one should not + * make any assumptions regarding the structure or format of the code). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [NotificationChannel]{@link google.monitoring.v3.NotificationChannel}. + * 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.verifyNotificationChannel(request); + */ + verifyNotificationChannel( + request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.INotificationChannel, + | protos.google.monitoring.v3.IVerifyNotificationChannelRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel, + protos.google.monitoring.v3.IVerifyNotificationChannelRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.verifyNotificationChannel( + request, + options, + callback + ); + } + + listNotificationChannelDescriptors( + request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannelDescriptor[], + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + ] + >; + listNotificationChannelDescriptors( + request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + > + ): void; + listNotificationChannelDescriptors( + request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + > + ): void; + /** + * Lists the descriptors for supported channel types. The use of descriptors + * makes it possible for new channel types to be dynamically added. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this names the parent container in which to look for the + * descriptors; to retrieve a single descriptor by name, use the + * {@link google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} + * operation, instead. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [NotificationChannelDescriptor]{@link google.monitoring.v3.NotificationChannelDescriptor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNotificationChannelDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listNotificationChannelDescriptors( + request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + | protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannelDescriptor + > + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannelDescriptor[], + protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listNotificationChannelDescriptors( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this names the parent container in which to look for the + * descriptors; to retrieve a single descriptor by name, use the + * {@link google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} + * operation, instead. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [NotificationChannelDescriptor]{@link google.monitoring.v3.NotificationChannelDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNotificationChannelDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listNotificationChannelDescriptorsStream( + request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listNotificationChannelDescriptors.createStream( + this.innerApiCalls.listNotificationChannelDescriptors as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listNotificationChannelDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The REST resource name of the parent from which to retrieve + * the notification channel descriptors. The expected syntax is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * Note that this names the parent container in which to look for the + * descriptors; to retrieve a single descriptor by name, use the + * {@link google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} + * operation, instead. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [NotificationChannelDescriptor]{@link google.monitoring.v3.NotificationChannelDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listNotificationChannelDescriptorsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listNotificationChannelDescriptorsAsync( + request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listNotificationChannelDescriptors.asyncIterate( + this.innerApiCalls['listNotificationChannelDescriptors'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listNotificationChannels( + request: protos.google.monitoring.v3.IListNotificationChannelsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel[], + protos.google.monitoring.v3.IListNotificationChannelsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelsResponse + ] + >; + listNotificationChannels( + request: protos.google.monitoring.v3.IListNotificationChannelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelsRequest, + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + > + ): void; + listNotificationChannels( + request: protos.google.monitoring.v3.IListNotificationChannelsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelsRequest, + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + > + ): void; + /** + * Lists the notification channels that have been created for the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * {@link google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} + * operation. + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * notification channels to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} request.orderBy + * A comma-separated list of fields by which to sort the result. Supports + * the same set of fields as in `filter`. Entries can be prefixed with + * a minus sign to sort in descending rather than ascending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [NotificationChannel]{@link google.monitoring.v3.NotificationChannel}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNotificationChannelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listNotificationChannels( + request: protos.google.monitoring.v3.IListNotificationChannelsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelsRequest, + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListNotificationChannelsRequest, + | protos.google.monitoring.v3.IListNotificationChannelsResponse + | null + | undefined, + protos.google.monitoring.v3.INotificationChannel + > + ): Promise< + [ + protos.google.monitoring.v3.INotificationChannel[], + protos.google.monitoring.v3.IListNotificationChannelsRequest | null, + protos.google.monitoring.v3.IListNotificationChannelsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listNotificationChannels( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * {@link google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} + * operation. + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * notification channels to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} request.orderBy + * A comma-separated list of fields by which to sort the result. Supports + * the same set of fields as in `filter`. Entries can be prefixed with + * a minus sign to sort in descending rather than ascending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [NotificationChannel]{@link google.monitoring.v3.NotificationChannel} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNotificationChannelsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listNotificationChannelsStream( + request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listNotificationChannels.createStream( + this.innerApiCalls.listNotificationChannels as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listNotificationChannels`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * + * This names the container + * in which to look for the notification channels; it does not name a + * specific channel. To query a specific channel by REST resource name, use + * the + * {@link google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} + * operation. + * @param {string} request.filter + * If provided, this field specifies the criteria that must be met by + * notification channels to be included in the response. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {string} request.orderBy + * A comma-separated list of fields by which to sort the result. Supports + * the same set of fields as in `filter`. Entries can be prefixed with + * a minus sign to sort in descending rather than ascending order. + * + * For more details, see [sorting and + * filtering](https://cloud.google.com/monitoring/api/v3/sorting-and-filtering). + * @param {number} request.pageSize + * The maximum number of results to return in a single response. If + * not set to a positive number, a reasonable value will be chosen by the + * service. + * @param {string} request.pageToken + * If non-empty, `page_token` must contain a value returned as the + * `next_page_token` in a previous response to request the next set + * of results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [NotificationChannel]{@link google.monitoring.v3.NotificationChannel}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listNotificationChannelsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listNotificationChannelsAsync( + request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listNotificationChannels.asyncIterate( + this.innerApiCalls['listNotificationChannels'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAlertPolicy resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + folderAlertPolicyPath(folder: string, alertPolicy: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the folder from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified folderAlertPolicyCondition resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the folder from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified folderChannelDescriptor resource name string. + * + * @param {string} folder + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ + folder: folder, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the folder from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).folder; + } + + /** + * Parse the channel_descriptor from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified folderGroup resource name string. + * + * @param {string} folder + * @param {string} group + * @returns {string} Resource name string. + */ + folderGroupPath(folder: string, group: string) { + return this.pathTemplates.folderGroupPathTemplate.render({ + folder: folder, + group: group, + }); + } + + /** + * Parse the folder from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; + } + + /** + * Parse the group from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; + } + + /** + * Return a fully-qualified folderNotificationChannel resource name string. + * + * @param {string} folder + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + folderNotificationChannelPath(folder: string, notificationChannel: string) { + return this.pathTemplates.folderNotificationChannelPathTemplate.render({ + folder: folder, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the folder from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).folder; + } + + /** + * Parse the notification_channel from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified folderService resource name string. + * + * @param {string} folder + * @param {string} service + * @returns {string} Resource name string. + */ + folderServicePath(folder: string, service: string) { + return this.pathTemplates.folderServicePathTemplate.render({ + folder: folder, + service: service, + }); + } + + /** + * Parse the folder from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; + } + + /** + * Parse the service from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; + } + + /** + * Return a fully-qualified folderServiceServiceLevelObjective resource name string. + * + * @param {string} folder + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the folder from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).folder; + } + + /** + * Parse the service from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified folderUptimeCheckConfig resource name string. + * + * @param {string} folder + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ + folder: folder, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the folder from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).folder; + } + + /** + * Parse the uptime_check_config from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified organizationAlertPolicy resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + organizationAlertPolicyPath(organization: string, alertPolicy: string) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ + organization: organization, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the organization from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified organizationAlertPolicyCondition resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + } + ); + } + + /** + * Parse the organization from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified organizationChannelDescriptor resource name string. + * + * @param {string} organization + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ + organization: organization, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the organization from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).organization; + } + + /** + * Parse the channel_descriptor from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified organizationGroup resource name string. + * + * @param {string} organization + * @param {string} group + * @returns {string} Resource name string. + */ + organizationGroupPath(organization: string, group: string) { + return this.pathTemplates.organizationGroupPathTemplate.render({ + organization: organization, + group: group, + }); + } + + /** + * Parse the organization from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).organization; + } + + /** + * Parse the group from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).group; + } + + /** + * Return a fully-qualified organizationNotificationChannel resource name string. + * + * @param {string} organization + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + organizationNotificationChannelPath( + organization: string, + notificationChannel: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + } + ); + } + + /** + * Parse the organization from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).organization; + } + + /** + * Parse the notification_channel from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified organizationService resource name string. + * + * @param {string} organization + * @param {string} service + * @returns {string} Resource name string. + */ + organizationServicePath(organization: string, service: string) { + return this.pathTemplates.organizationServicePathTemplate.render({ + organization: organization, + service: service, + }); + } + + /** + * Parse the organization from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).organization; + } + + /** + * Parse the service from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceName(organizationServiceName: string) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).service; + } + + /** + * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. + * + * @param {string} organization + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the organization from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).organization; + } + + /** + * Parse the service from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified organizationUptimeCheckConfig resource name string. + * + * @param {string} organization + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ + organization: organization, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the organization from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).organization; + } + + /** + * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAlertPolicy resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + projectAlertPolicyPath(project: string, alertPolicy: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the project from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified projectAlertPolicyCondition resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the project from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified projectChannelDescriptor resource name string. + * + * @param {string} project + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + projectChannelDescriptorPath(project: string, channelDescriptor: string) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ + project: project, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the project from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).project; + } + + /** + * Parse the channel_descriptor from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified projectGroup resource name string. + * + * @param {string} project + * @param {string} group + * @returns {string} Resource name string. + */ + projectGroupPath(project: string, group: string) { + return this.pathTemplates.projectGroupPathTemplate.render({ + project: project, + group: group, + }); + } + + /** + * Parse the project from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; + } + + /** + * Parse the group from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; + } + + /** + * Return a fully-qualified projectNotificationChannel resource name string. + * + * @param {string} project + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + projectNotificationChannelPath(project: string, notificationChannel: string) { + return this.pathTemplates.projectNotificationChannelPathTemplate.render({ + project: project, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the project from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).project; + } + + /** + * Parse the notification_channel from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified projectService resource name string. + * + * @param {string} project + * @param {string} service + * @returns {string} Resource name string. + */ + projectServicePath(project: string, service: string) { + return this.pathTemplates.projectServicePathTemplate.render({ + project: project, + service: service, + }); + } + + /** + * Parse the project from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).project; + } + + /** + * Parse the service from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).service; + } + + /** + * Return a fully-qualified projectServiceServiceLevelObjective resource name string. + * + * @param {string} project + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the project from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).project; + } + + /** + * Parse the service from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified projectUptimeCheckConfig resource name string. + * + * @param {string} project + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ + project: project, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the project from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).project; + } + + /** + * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.notificationChannelServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-monitoring/src/v3/notification_channel_service_client_config.json b/packages/google-cloud-monitoring/src/v3/notification_channel_service_client_config.json new file mode 100644 index 00000000000..58fb6cbe21e --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/notification_channel_service_client_config.json @@ -0,0 +1,85 @@ +{ + "interfaces": { + "google.monitoring.v3.NotificationChannelService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListNotificationChannelDescriptors": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "GetNotificationChannelDescriptor": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "ListNotificationChannels": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "GetNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "CreateNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "SendNotificationChannelVerificationCode": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetNotificationChannelVerificationCode": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "VerifyNotificationChannel": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + } + } + } + } +} diff --git a/packages/google-cloud-monitoring/src/v3/notification_channel_service_proto_list.json b/packages/google-cloud-monitoring/src/v3/notification_channel_service_proto_list.json new file mode 100644 index 00000000000..e55f61d422f --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/notification_channel_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/monitoring/v3/alert.proto", + "../../protos/google/monitoring/v3/alert_service.proto", + "../../protos/google/monitoring/v3/common.proto", + "../../protos/google/monitoring/v3/dropped_labels.proto", + "../../protos/google/monitoring/v3/group.proto", + "../../protos/google/monitoring/v3/group_service.proto", + "../../protos/google/monitoring/v3/metric.proto", + "../../protos/google/monitoring/v3/metric_service.proto", + "../../protos/google/monitoring/v3/mutation_record.proto", + "../../protos/google/monitoring/v3/notification.proto", + "../../protos/google/monitoring/v3/notification_service.proto", + "../../protos/google/monitoring/v3/query_service.proto", + "../../protos/google/monitoring/v3/service.proto", + "../../protos/google/monitoring/v3/service_service.proto", + "../../protos/google/monitoring/v3/span_context.proto", + "../../protos/google/monitoring/v3/uptime.proto", + "../../protos/google/monitoring/v3/uptime_service.proto" +] diff --git a/packages/google-cloud-monitoring/src/v3/query_service_client.ts b/packages/google-cloud-monitoring/src/v3/query_service_client.ts new file mode 100644 index 00000000000..38492e3d2bf --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/query_service_client.ts @@ -0,0 +1,1789 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3/query_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './query_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * The QueryService API is used to manage time series data in Stackdriver + * Monitoring. Time series data is a collection of data points that describes + * the time-varying values of a metric. + * @class + * @memberof v3 + */ +export class QueryServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + queryServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of QueryServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof QueryServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}' + ), + folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + ), + folderGroupPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/groups/{group}' + ), + folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannels/{notification_channel}' + ), + folderServicePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}' + ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + ), + organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}' + ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + ), + organizationGroupPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/groups/{group}' + ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}' + ), + organizationServicePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}' + ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + ), + projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}' + ), + projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + ), + projectGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/groups/{group}' + ), + projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannels/{notification_channel}' + ), + projectServicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}' + ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + queryTimeSeries: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'timeSeriesData' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.monitoring.v3.QueryService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.queryServiceStub) { + return this.queryServiceStub; + } + + // Put together the "service stub" for + // google.monitoring.v3.QueryService. + this.queryServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.QueryService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.monitoring.v3.QueryService, + 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 queryServiceStubMethods = ['queryTimeSeries']; + for (const methodName of queryServiceStubMethods) { + const callPromise = this.queryServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.queryServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'monitoring.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'monitoring.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + queryTimeSeries( + request: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.ITimeSeriesData[], + protos.google.monitoring.v3.IQueryTimeSeriesRequest | null, + protos.google.monitoring.v3.IQueryTimeSeriesResponse + ] + >; + queryTimeSeries( + request: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IQueryTimeSeriesRequest, + protos.google.monitoring.v3.IQueryTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeriesData + > + ): void; + queryTimeSeries( + request: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IQueryTimeSeriesRequest, + protos.google.monitoring.v3.IQueryTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeriesData + > + ): void; + /** + * Queries time series using Monitoring Query Language. This method does not require a Workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.query + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * @param {number} request.pageSize + * A positive number that is the maximum number of time_series_data to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [TimeSeriesData]{@link google.monitoring.v3.TimeSeriesData}. + * 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 `queryTimeSeriesAsync()` + * 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. + */ + queryTimeSeries( + request: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IQueryTimeSeriesRequest, + | protos.google.monitoring.v3.IQueryTimeSeriesResponse + | null + | undefined, + protos.google.monitoring.v3.ITimeSeriesData + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IQueryTimeSeriesRequest, + protos.google.monitoring.v3.IQueryTimeSeriesResponse | null | undefined, + protos.google.monitoring.v3.ITimeSeriesData + > + ): Promise< + [ + protos.google.monitoring.v3.ITimeSeriesData[], + protos.google.monitoring.v3.IQueryTimeSeriesRequest | null, + protos.google.monitoring.v3.IQueryTimeSeriesResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.queryTimeSeries(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.query + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * @param {number} request.pageSize + * A positive number that is the maximum number of time_series_data to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [TimeSeriesData]{@link google.monitoring.v3.TimeSeriesData} 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 `queryTimeSeriesAsync()` + * 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. + */ + queryTimeSeriesStream( + request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.queryTimeSeries.createStream( + this.innerApiCalls.queryTimeSeries as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `queryTimeSeries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The project on which to execute the request. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.query + * Required. The query in the [Monitoring Query + * Language](https://cloud.google.com/monitoring/mql/reference) format. + * The default time zone is in UTC. + * @param {number} request.pageSize + * A positive number that is the maximum number of time_series_data to return. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [TimeSeriesData]{@link google.monitoring.v3.TimeSeriesData}. 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.queryTimeSeriesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + queryTimeSeriesAsync( + request?: protos.google.monitoring.v3.IQueryTimeSeriesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.queryTimeSeries.asyncIterate( + this.innerApiCalls['queryTimeSeries'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAlertPolicy resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + folderAlertPolicyPath(folder: string, alertPolicy: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the folder from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified folderAlertPolicyCondition resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the folder from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified folderChannelDescriptor resource name string. + * + * @param {string} folder + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ + folder: folder, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the folder from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).folder; + } + + /** + * Parse the channel_descriptor from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified folderGroup resource name string. + * + * @param {string} folder + * @param {string} group + * @returns {string} Resource name string. + */ + folderGroupPath(folder: string, group: string) { + return this.pathTemplates.folderGroupPathTemplate.render({ + folder: folder, + group: group, + }); + } + + /** + * Parse the folder from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; + } + + /** + * Parse the group from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; + } + + /** + * Return a fully-qualified folderNotificationChannel resource name string. + * + * @param {string} folder + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + folderNotificationChannelPath(folder: string, notificationChannel: string) { + return this.pathTemplates.folderNotificationChannelPathTemplate.render({ + folder: folder, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the folder from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).folder; + } + + /** + * Parse the notification_channel from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified folderService resource name string. + * + * @param {string} folder + * @param {string} service + * @returns {string} Resource name string. + */ + folderServicePath(folder: string, service: string) { + return this.pathTemplates.folderServicePathTemplate.render({ + folder: folder, + service: service, + }); + } + + /** + * Parse the folder from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; + } + + /** + * Parse the service from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; + } + + /** + * Return a fully-qualified folderServiceServiceLevelObjective resource name string. + * + * @param {string} folder + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the folder from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).folder; + } + + /** + * Parse the service from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified folderUptimeCheckConfig resource name string. + * + * @param {string} folder + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ + folder: folder, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the folder from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).folder; + } + + /** + * Parse the uptime_check_config from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified organizationAlertPolicy resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + organizationAlertPolicyPath(organization: string, alertPolicy: string) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ + organization: organization, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the organization from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified organizationAlertPolicyCondition resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + } + ); + } + + /** + * Parse the organization from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified organizationChannelDescriptor resource name string. + * + * @param {string} organization + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ + organization: organization, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the organization from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).organization; + } + + /** + * Parse the channel_descriptor from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified organizationGroup resource name string. + * + * @param {string} organization + * @param {string} group + * @returns {string} Resource name string. + */ + organizationGroupPath(organization: string, group: string) { + return this.pathTemplates.organizationGroupPathTemplate.render({ + organization: organization, + group: group, + }); + } + + /** + * Parse the organization from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).organization; + } + + /** + * Parse the group from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).group; + } + + /** + * Return a fully-qualified organizationNotificationChannel resource name string. + * + * @param {string} organization + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + organizationNotificationChannelPath( + organization: string, + notificationChannel: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + } + ); + } + + /** + * Parse the organization from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).organization; + } + + /** + * Parse the notification_channel from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified organizationService resource name string. + * + * @param {string} organization + * @param {string} service + * @returns {string} Resource name string. + */ + organizationServicePath(organization: string, service: string) { + return this.pathTemplates.organizationServicePathTemplate.render({ + organization: organization, + service: service, + }); + } + + /** + * Parse the organization from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).organization; + } + + /** + * Parse the service from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceName(organizationServiceName: string) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).service; + } + + /** + * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. + * + * @param {string} organization + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the organization from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).organization; + } + + /** + * Parse the service from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified organizationUptimeCheckConfig resource name string. + * + * @param {string} organization + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ + organization: organization, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the organization from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).organization; + } + + /** + * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified projectAlertPolicy resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + projectAlertPolicyPath(project: string, alertPolicy: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the project from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified projectAlertPolicyCondition resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the project from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified projectChannelDescriptor resource name string. + * + * @param {string} project + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + projectChannelDescriptorPath(project: string, channelDescriptor: string) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ + project: project, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the project from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).project; + } + + /** + * Parse the channel_descriptor from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified projectGroup resource name string. + * + * @param {string} project + * @param {string} group + * @returns {string} Resource name string. + */ + projectGroupPath(project: string, group: string) { + return this.pathTemplates.projectGroupPathTemplate.render({ + project: project, + group: group, + }); + } + + /** + * Parse the project from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; + } + + /** + * Parse the group from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; + } + + /** + * Return a fully-qualified projectNotificationChannel resource name string. + * + * @param {string} project + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + projectNotificationChannelPath(project: string, notificationChannel: string) { + return this.pathTemplates.projectNotificationChannelPathTemplate.render({ + project: project, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the project from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).project; + } + + /** + * Parse the notification_channel from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified projectService resource name string. + * + * @param {string} project + * @param {string} service + * @returns {string} Resource name string. + */ + projectServicePath(project: string, service: string) { + return this.pathTemplates.projectServicePathTemplate.render({ + project: project, + service: service, + }); + } + + /** + * Parse the project from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).project; + } + + /** + * Parse the service from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).service; + } + + /** + * Return a fully-qualified projectServiceServiceLevelObjective resource name string. + * + * @param {string} project + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the project from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).project; + } + + /** + * Parse the service from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified projectUptimeCheckConfig resource name string. + * + * @param {string} project + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ + project: project, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the project from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).project; + } + + /** + * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.queryServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-monitoring/src/v3/query_service_client_config.json b/packages/google-cloud-monitoring/src/v3/query_service_client_config.json new file mode 100644 index 00000000000..dadb5411b85 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/query_service_client_config.json @@ -0,0 +1,30 @@ +{ + "interfaces": { + "google.monitoring.v3.QueryService": { + "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": { + "QueryTimeSeries": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-monitoring/src/v3/query_service_proto_list.json b/packages/google-cloud-monitoring/src/v3/query_service_proto_list.json new file mode 100644 index 00000000000..e55f61d422f --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/query_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/monitoring/v3/alert.proto", + "../../protos/google/monitoring/v3/alert_service.proto", + "../../protos/google/monitoring/v3/common.proto", + "../../protos/google/monitoring/v3/dropped_labels.proto", + "../../protos/google/monitoring/v3/group.proto", + "../../protos/google/monitoring/v3/group_service.proto", + "../../protos/google/monitoring/v3/metric.proto", + "../../protos/google/monitoring/v3/metric_service.proto", + "../../protos/google/monitoring/v3/mutation_record.proto", + "../../protos/google/monitoring/v3/notification.proto", + "../../protos/google/monitoring/v3/notification_service.proto", + "../../protos/google/monitoring/v3/query_service.proto", + "../../protos/google/monitoring/v3/service.proto", + "../../protos/google/monitoring/v3/service_service.proto", + "../../protos/google/monitoring/v3/span_context.proto", + "../../protos/google/monitoring/v3/uptime.proto", + "../../protos/google/monitoring/v3/uptime_service.proto" +] diff --git a/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client.ts b/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client.ts new file mode 100644 index 00000000000..b6157a78676 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client.ts @@ -0,0 +1,2892 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3/service_monitoring_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './service_monitoring_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * The Cloud Monitoring Service-Oriented Monitoring API has endpoints for + * managing and querying aspects of a workspace's services. These include the + * `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy + * of categorized Health Metrics. + * @class + * @memberof v3 + */ +export class ServiceMonitoringServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + serviceMonitoringServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ServiceMonitoringServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof ServiceMonitoringServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}' + ), + folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + ), + folderGroupPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/groups/{group}' + ), + folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannels/{notification_channel}' + ), + folderServicePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}' + ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + ), + organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}' + ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + ), + organizationGroupPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/groups/{group}' + ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}' + ), + organizationServicePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}' + ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}' + ), + projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + ), + projectGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/groups/{group}' + ), + projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannels/{notification_channel}' + ), + projectServicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}' + ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listServices: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'services' + ), + listServiceLevelObjectives: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'serviceLevelObjectives' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.monitoring.v3.ServiceMonitoringService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.serviceMonitoringServiceStub) { + return this.serviceMonitoringServiceStub; + } + + // Put together the "service stub" for + // google.monitoring.v3.ServiceMonitoringService. + this.serviceMonitoringServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.ServiceMonitoringService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.monitoring.v3.ServiceMonitoringService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const serviceMonitoringServiceStubMethods = [ + 'createService', + 'getService', + 'listServices', + 'updateService', + 'deleteService', + 'createServiceLevelObjective', + 'getServiceLevelObjective', + 'listServiceLevelObjectives', + 'updateServiceLevelObjective', + 'deleteServiceLevelObjective', + ]; + for (const methodName of serviceMonitoringServiceStubMethods) { + const callPromise = this.serviceMonitoringServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.serviceMonitoringServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'monitoring.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'monitoring.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createService( + request: protos.google.monitoring.v3.ICreateServiceRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | undefined, + {} | undefined + ] + >; + createService( + request: protos.google.monitoring.v3.ICreateServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + > + ): void; + createService( + request: protos.google.monitoring.v3.ICreateServiceRequest, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Create a `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent workspace. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {string} request.serviceId + * Optional. The Service id to use for this Service. If omitted, an id will be + * generated instead. Must match the pattern `[a-z0-9\-]+` + * @param {google.monitoring.v3.Service} request.service + * Required. The `Service` to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Service]{@link google.monitoring.v3.Service}. + * 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.createService(request); + */ + createService( + request: protos.google.monitoring.v3.ICreateServiceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.ICreateServiceRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createService(request, options, callback); + } + getService( + request: protos.google.monitoring.v3.IGetServiceRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | undefined, + {} | undefined + ] + >; + getService( + request: protos.google.monitoring.v3.IGetServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + > + ): void; + getService( + request: protos.google.monitoring.v3.IGetServiceRequest, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Get the named `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the `Service`. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Service]{@link google.monitoring.v3.Service}. + * 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.getService(request); + */ + getService( + request: protos.google.monitoring.v3.IGetServiceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IGetServiceRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getService(request, options, callback); + } + updateService( + request: protos.google.monitoring.v3.IUpdateServiceRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | undefined, + {} | undefined + ] + >; + updateService( + request: protos.google.monitoring.v3.IUpdateServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + > + ): void; + updateService( + request: protos.google.monitoring.v3.IUpdateServiceRequest, + callback: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Update this `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.monitoring.v3.Service} request.service + * Required. The `Service` to draw updates from. + * The given `name` specifies the resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * A set of field paths defining which fields to use for the update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Service]{@link google.monitoring.v3.Service}. + * 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.updateService(request); + */ + updateService( + request: protos.google.monitoring.v3.IUpdateServiceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IService, + protos.google.monitoring.v3.IUpdateServiceRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'service.name': request.service!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateService(request, options, callback); + } + deleteService( + request: protos.google.monitoring.v3.IDeleteServiceRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | undefined, + {} | undefined + ] + >; + deleteService( + request: protos.google.monitoring.v3.IDeleteServiceRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteService( + request: protos.google.monitoring.v3.IDeleteServiceRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + > + ): void; + /** + * Soft delete this `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the `Service` to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.deleteService(request); + */ + deleteService( + request: protos.google.monitoring.v3.IDeleteServiceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteServiceRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteService(request, options, callback); + } + createServiceLevelObjective( + request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined + ] + >; + createServiceLevelObjective( + request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createServiceLevelObjective( + request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Create a `ServiceLevelObjective` for the given `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent `Service`. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * @param {string} request.serviceLevelObjectiveId + * Optional. The ServiceLevelObjective id to use for this + * ServiceLevelObjective. If omitted, an id will be generated instead. Must + * match the pattern `[a-z0-9\-]+` + * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective + * Required. The `ServiceLevelObjective` to create. + * The provided `name` will be respected if no `ServiceLevelObjective` exists + * with this name. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServiceLevelObjective]{@link google.monitoring.v3.ServiceLevelObjective}. + * 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.createServiceLevelObjective(request); + */ + createServiceLevelObjective( + request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createServiceLevelObjective( + request, + options, + callback + ); + } + getServiceLevelObjective( + request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest | undefined, + {} | undefined + ] + >; + getServiceLevelObjective( + request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getServiceLevelObjective( + request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Get a `ServiceLevelObjective` by name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the `ServiceLevelObjective` to get. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view + * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServiceLevelObjective]{@link google.monitoring.v3.ServiceLevelObjective}. + * 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.getServiceLevelObjective(request); + */ + getServiceLevelObjective( + request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getServiceLevelObjective( + request, + options, + callback + ); + } + updateServiceLevelObjective( + request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined + ] + >; + updateServiceLevelObjective( + request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateServiceLevelObjective( + request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, + callback: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Update the given `ServiceLevelObjective`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective + * Required. The `ServiceLevelObjective` to draw updates from. + * The given `name` specifies the resource to update. + * @param {google.protobuf.FieldMask} request.updateMask + * A set of field paths defining which fields to use for the update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ServiceLevelObjective]{@link google.monitoring.v3.ServiceLevelObjective}. + * 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.updateServiceLevelObjective(request); + */ + updateServiceLevelObjective( + request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IServiceLevelObjective, + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective, + ( + | protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'service_level_objective.name': + request.serviceLevelObjective!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateServiceLevelObjective( + request, + options, + callback + ); + } + deleteServiceLevelObjective( + request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | undefined + ), + {} | undefined + ] + >; + deleteServiceLevelObjective( + request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteServiceLevelObjective( + request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Delete the given `ServiceLevelObjective`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the `ServiceLevelObjective` to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.deleteServiceLevelObjective(request); + */ + deleteServiceLevelObjective( + request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteServiceLevelObjective( + request, + options, + callback + ); + } + + listServices( + request: protos.google.monitoring.v3.IListServicesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IService[], + protos.google.monitoring.v3.IListServicesRequest | null, + protos.google.monitoring.v3.IListServicesResponse + ] + >; + listServices( + request: protos.google.monitoring.v3.IListServicesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListServicesRequest, + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + > + ): void; + listServices( + request: protos.google.monitoring.v3.IListServicesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListServicesRequest, + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + > + ): void; + /** + * List `Service`s for this workspace. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed services, either a + * project or a Monitoring Workspace. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * A filter specifying what `Service`s to return. The filter currently + * supports the following fields: + * + * - `identifier_case` + * - `app_engine.module_id` + * - `cloud_endpoints.service` (reserved for future use) + * - `mesh_istio.mesh_uid` + * - `mesh_istio.service_namespace` + * - `mesh_istio.service_name` + * - `cluster_istio.location` (deprecated) + * - `cluster_istio.cluster_name` (deprecated) + * - `cluster_istio.service_namespace` (deprecated) + * - `cluster_istio.service_name` (deprecated) + * + * `identifier_case` refers to which option in the identifier oneof is + * populated. For example, the filter `identifier_case = "CUSTOM"` would match + * all services with a value for the `custom` field. Valid options are + * "CUSTOM", "APP_ENGINE", "MESH_ISTIO", plus "CLUSTER_ISTIO" (deprecated) + * and "CLOUD_ENDPOINTS" (reserved for future use). + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Service]{@link google.monitoring.v3.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.monitoring.v3.IListServicesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListServicesRequest, + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListServicesRequest, + protos.google.monitoring.v3.IListServicesResponse | null | undefined, + protos.google.monitoring.v3.IService + > + ): Promise< + [ + protos.google.monitoring.v3.IService[], + protos.google.monitoring.v3.IListServicesRequest | null, + protos.google.monitoring.v3.IListServicesResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listServices(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed services, either a + * project or a Monitoring Workspace. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * A filter specifying what `Service`s to return. The filter currently + * supports the following fields: + * + * - `identifier_case` + * - `app_engine.module_id` + * - `cloud_endpoints.service` (reserved for future use) + * - `mesh_istio.mesh_uid` + * - `mesh_istio.service_namespace` + * - `mesh_istio.service_name` + * - `cluster_istio.location` (deprecated) + * - `cluster_istio.cluster_name` (deprecated) + * - `cluster_istio.service_namespace` (deprecated) + * - `cluster_istio.service_name` (deprecated) + * + * `identifier_case` refers to which option in the identifier oneof is + * populated. For example, the filter `identifier_case = "CUSTOM"` would match + * all services with a value for the `custom` field. Valid options are + * "CUSTOM", "APP_ENGINE", "MESH_ISTIO", plus "CLUSTER_ISTIO" (deprecated) + * and "CLOUD_ENDPOINTS" (reserved for future use). + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Service]{@link google.monitoring.v3.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.monitoring.v3.IListServicesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listServices.createStream( + this.innerApiCalls.listServices as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listServices`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed services, either a + * project or a Monitoring Workspace. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER] + * @param {string} request.filter + * A filter specifying what `Service`s to return. The filter currently + * supports the following fields: + * + * - `identifier_case` + * - `app_engine.module_id` + * - `cloud_endpoints.service` (reserved for future use) + * - `mesh_istio.mesh_uid` + * - `mesh_istio.service_namespace` + * - `mesh_istio.service_name` + * - `cluster_istio.location` (deprecated) + * - `cluster_istio.cluster_name` (deprecated) + * - `cluster_istio.service_namespace` (deprecated) + * - `cluster_istio.service_name` (deprecated) + * + * `identifier_case` refers to which option in the identifier oneof is + * populated. For example, the filter `identifier_case = "CUSTOM"` would match + * all services with a value for the `custom` field. Valid options are + * "CUSTOM", "APP_ENGINE", "MESH_ISTIO", plus "CLUSTER_ISTIO" (deprecated) + * and "CLOUD_ENDPOINTS" (reserved for future use). + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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.monitoring.v3.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.monitoring.v3.IListServicesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + 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; + } + listServiceLevelObjectives( + request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective[], + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest | null, + protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + ] + >; + listServiceLevelObjectives( + request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + > + ): void; + listServiceLevelObjectives( + request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + > + ): void; + /** + * List the `ServiceLevelObjective`s for the given `Service`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Workspace. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * @param {string} request.filter + * A filter specifying what `ServiceLevelObjective`s to return. + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ServiceLevelObjective]{@link google.monitoring.v3.ServiceLevelObjective}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listServiceLevelObjectivesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServiceLevelObjectives( + request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + | protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + | null + | undefined, + protos.google.monitoring.v3.IServiceLevelObjective + > + ): Promise< + [ + protos.google.monitoring.v3.IServiceLevelObjective[], + protos.google.monitoring.v3.IListServiceLevelObjectivesRequest | null, + protos.google.monitoring.v3.IListServiceLevelObjectivesResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listServiceLevelObjectives( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Workspace. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * @param {string} request.filter + * A filter specifying what `ServiceLevelObjective`s to return. + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ServiceLevelObjective]{@link google.monitoring.v3.ServiceLevelObjective} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listServiceLevelObjectivesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listServiceLevelObjectivesStream( + request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listServiceLevelObjectives.createStream( + this.innerApiCalls.listServiceLevelObjectives as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listServiceLevelObjectives`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the parent containing the listed SLOs, either a + * project or a Monitoring Workspace. The formats are: + * + * projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] + * workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/- + * @param {string} request.filter + * A filter specifying what `ServiceLevelObjective`s to return. + * @param {number} request.pageSize + * A non-negative number that is the maximum number of results to return. + * When 0, use default page size. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return additional results from the previous method call. + * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view + * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each + * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the + * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the + * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [ServiceLevelObjective]{@link google.monitoring.v3.ServiceLevelObjective}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listServiceLevelObjectivesAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listServiceLevelObjectivesAsync( + request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listServiceLevelObjectives.asyncIterate( + this.innerApiCalls['listServiceLevelObjectives'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAlertPolicy resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + folderAlertPolicyPath(folder: string, alertPolicy: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the folder from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified folderAlertPolicyCondition resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the folder from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified folderChannelDescriptor resource name string. + * + * @param {string} folder + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ + folder: folder, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the folder from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).folder; + } + + /** + * Parse the channel_descriptor from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified folderGroup resource name string. + * + * @param {string} folder + * @param {string} group + * @returns {string} Resource name string. + */ + folderGroupPath(folder: string, group: string) { + return this.pathTemplates.folderGroupPathTemplate.render({ + folder: folder, + group: group, + }); + } + + /** + * Parse the folder from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; + } + + /** + * Parse the group from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; + } + + /** + * Return a fully-qualified folderNotificationChannel resource name string. + * + * @param {string} folder + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + folderNotificationChannelPath(folder: string, notificationChannel: string) { + return this.pathTemplates.folderNotificationChannelPathTemplate.render({ + folder: folder, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the folder from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).folder; + } + + /** + * Parse the notification_channel from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified folderService resource name string. + * + * @param {string} folder + * @param {string} service + * @returns {string} Resource name string. + */ + folderServicePath(folder: string, service: string) { + return this.pathTemplates.folderServicePathTemplate.render({ + folder: folder, + service: service, + }); + } + + /** + * Parse the folder from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; + } + + /** + * Parse the service from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; + } + + /** + * Return a fully-qualified folderServiceServiceLevelObjective resource name string. + * + * @param {string} folder + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the folder from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).folder; + } + + /** + * Parse the service from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified folderUptimeCheckConfig resource name string. + * + * @param {string} folder + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ + folder: folder, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the folder from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).folder; + } + + /** + * Parse the uptime_check_config from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified organizationAlertPolicy resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + organizationAlertPolicyPath(organization: string, alertPolicy: string) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ + organization: organization, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the organization from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified organizationAlertPolicyCondition resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + } + ); + } + + /** + * Parse the organization from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified organizationChannelDescriptor resource name string. + * + * @param {string} organization + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ + organization: organization, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the organization from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).organization; + } + + /** + * Parse the channel_descriptor from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified organizationGroup resource name string. + * + * @param {string} organization + * @param {string} group + * @returns {string} Resource name string. + */ + organizationGroupPath(organization: string, group: string) { + return this.pathTemplates.organizationGroupPathTemplate.render({ + organization: organization, + group: group, + }); + } + + /** + * Parse the organization from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).organization; + } + + /** + * Parse the group from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).group; + } + + /** + * Return a fully-qualified organizationNotificationChannel resource name string. + * + * @param {string} organization + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + organizationNotificationChannelPath( + organization: string, + notificationChannel: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + } + ); + } + + /** + * Parse the organization from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).organization; + } + + /** + * Parse the notification_channel from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified organizationService resource name string. + * + * @param {string} organization + * @param {string} service + * @returns {string} Resource name string. + */ + organizationServicePath(organization: string, service: string) { + return this.pathTemplates.organizationServicePathTemplate.render({ + organization: organization, + service: service, + }); + } + + /** + * Parse the organization from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).organization; + } + + /** + * Parse the service from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceName(organizationServiceName: string) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).service; + } + + /** + * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. + * + * @param {string} organization + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the organization from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).organization; + } + + /** + * Parse the service from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified organizationUptimeCheckConfig resource name string. + * + * @param {string} organization + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ + organization: organization, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the organization from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).organization; + } + + /** + * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAlertPolicy resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + projectAlertPolicyPath(project: string, alertPolicy: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the project from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified projectAlertPolicyCondition resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the project from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified projectChannelDescriptor resource name string. + * + * @param {string} project + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + projectChannelDescriptorPath(project: string, channelDescriptor: string) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ + project: project, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the project from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).project; + } + + /** + * Parse the channel_descriptor from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified projectGroup resource name string. + * + * @param {string} project + * @param {string} group + * @returns {string} Resource name string. + */ + projectGroupPath(project: string, group: string) { + return this.pathTemplates.projectGroupPathTemplate.render({ + project: project, + group: group, + }); + } + + /** + * Parse the project from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; + } + + /** + * Parse the group from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; + } + + /** + * Return a fully-qualified projectNotificationChannel resource name string. + * + * @param {string} project + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + projectNotificationChannelPath(project: string, notificationChannel: string) { + return this.pathTemplates.projectNotificationChannelPathTemplate.render({ + project: project, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the project from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).project; + } + + /** + * Parse the notification_channel from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified projectService resource name string. + * + * @param {string} project + * @param {string} service + * @returns {string} Resource name string. + */ + projectServicePath(project: string, service: string) { + return this.pathTemplates.projectServicePathTemplate.render({ + project: project, + service: service, + }); + } + + /** + * Parse the project from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).project; + } + + /** + * Parse the service from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).service; + } + + /** + * Return a fully-qualified projectServiceServiceLevelObjective resource name string. + * + * @param {string} project + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the project from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).project; + } + + /** + * Parse the service from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified projectUptimeCheckConfig resource name string. + * + * @param {string} project + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ + project: project, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the project from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).project; + } + + /** + * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.serviceMonitoringServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client_config.json b/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client_config.json new file mode 100644 index 00000000000..b088f168fe2 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/service_monitoring_service_client_config.json @@ -0,0 +1,85 @@ +{ + "interfaces": { + "google.monitoring.v3.ServiceMonitoringService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateService": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetService": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "ListServices": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "UpdateService": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteService": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "CreateServiceLevelObjective": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetServiceLevelObjective": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "ListServiceLevelObjectives": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "UpdateServiceLevelObjective": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteServiceLevelObjective": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + } + } + } + } +} diff --git a/packages/google-cloud-monitoring/src/v3/service_monitoring_service_proto_list.json b/packages/google-cloud-monitoring/src/v3/service_monitoring_service_proto_list.json new file mode 100644 index 00000000000..e55f61d422f --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/service_monitoring_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/monitoring/v3/alert.proto", + "../../protos/google/monitoring/v3/alert_service.proto", + "../../protos/google/monitoring/v3/common.proto", + "../../protos/google/monitoring/v3/dropped_labels.proto", + "../../protos/google/monitoring/v3/group.proto", + "../../protos/google/monitoring/v3/group_service.proto", + "../../protos/google/monitoring/v3/metric.proto", + "../../protos/google/monitoring/v3/metric_service.proto", + "../../protos/google/monitoring/v3/mutation_record.proto", + "../../protos/google/monitoring/v3/notification.proto", + "../../protos/google/monitoring/v3/notification_service.proto", + "../../protos/google/monitoring/v3/query_service.proto", + "../../protos/google/monitoring/v3/service.proto", + "../../protos/google/monitoring/v3/service_service.proto", + "../../protos/google/monitoring/v3/span_context.proto", + "../../protos/google/monitoring/v3/uptime.proto", + "../../protos/google/monitoring/v3/uptime_service.proto" +] diff --git a/packages/google-cloud-monitoring/src/v3/uptime_check_service_client.ts b/packages/google-cloud-monitoring/src/v3/uptime_check_service_client.ts new file mode 100644 index 00000000000..7a5d6ce8318 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/uptime_check_service_client.ts @@ -0,0 +1,2432 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +/** + * Client JSON configuration object, loaded from + * `src/v3/uptime_check_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './uptime_check_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * The UptimeCheckService API is used to manage (list, create, delete, edit) + * Uptime check configurations in the Stackdriver Monitoring product. An Uptime + * check is a piece of configuration that determines which resources and + * services to monitor for availability. These configurations can also be + * configured interactively by navigating to the [Cloud Console] + * (http://console.cloud.google.com), selecting the appropriate project, + * clicking on "Monitoring" on the left-hand side to navigate to Stackdriver, + * and then clicking on "Uptime". + * @class + * @memberof v3 + */ +export class UptimeCheckServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + uptimeCheckServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of UptimeCheckServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof UptimeCheckServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + this._protos = this._gaxGrpc.loadProto( + opts.fallback + ? // eslint-disable-next-line @typescript-eslint/no-var-requires + require('../../protos/protos.json') + : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}' + ), + folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' + ), + folderGroupPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/groups/{group}' + ), + folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/notificationChannels/{notification_channel}' + ), + folderServicePathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}' + ), + folderServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' + ), + organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}' + ), + organizationAlertPolicyConditionPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + organizationChannelDescriptorPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' + ), + organizationGroupPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/groups/{group}' + ), + organizationNotificationChannelPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/notificationChannels/{notification_channel}' + ), + organizationServicePathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}' + ), + organizationServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + organizationUptimeCheckConfigPathTemplate: + new this._gaxModule.PathTemplate( + 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}' + ), + projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' + ), + projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' + ), + projectGroupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/groups/{group}' + ), + projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/notificationChannels/{notification_channel}' + ), + projectServicePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}' + ), + projectServiceServiceLevelObjectivePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' + ), + projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listUptimeCheckConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'uptimeCheckConfigs' + ), + listUptimeCheckIps: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'uptimeCheckIps' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.monitoring.v3.UptimeCheckService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.uptimeCheckServiceStub) { + return this.uptimeCheckServiceStub; + } + + // Put together the "service stub" for + // google.monitoring.v3.UptimeCheckService. + this.uptimeCheckServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.monitoring.v3.UptimeCheckService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.monitoring.v3.UptimeCheckService, + this._opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const uptimeCheckServiceStubMethods = [ + 'listUptimeCheckConfigs', + 'getUptimeCheckConfig', + 'createUptimeCheckConfig', + 'updateUptimeCheckConfig', + 'deleteUptimeCheckConfig', + 'listUptimeCheckIps', + ]; + for (const methodName of uptimeCheckServiceStubMethods) { + const callPromise = this.uptimeCheckServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.uptimeCheckServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'monitoring.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'monitoring.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/monitoring', + 'https://www.googleapis.com/auth/monitoring.read', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + getUptimeCheckConfig( + request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IGetUptimeCheckConfigRequest | undefined, + {} | undefined + ] + >; + getUptimeCheckConfig( + request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getUptimeCheckConfig( + request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Gets a single Uptime check configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Uptime check configuration to retrieve. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UptimeCheckConfig]{@link google.monitoring.v3.UptimeCheckConfig}. + * 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.getUptimeCheckConfig(request); + */ + getUptimeCheckConfig( + request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IGetUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IGetUptimeCheckConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getUptimeCheckConfig(request, options, callback); + } + createUptimeCheckConfig( + request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest | undefined, + {} | undefined + ] + >; + createUptimeCheckConfig( + request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createUptimeCheckConfig( + request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Creates a new Uptime check configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which to create the Uptime check. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig + * Required. The new Uptime check configuration. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UptimeCheckConfig]{@link google.monitoring.v3.UptimeCheckConfig}. + * 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.createUptimeCheckConfig(request); + */ + createUptimeCheckConfig( + request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createUptimeCheckConfig( + request, + options, + callback + ); + } + updateUptimeCheckConfig( + request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest | undefined, + {} | undefined + ] + >; + updateUptimeCheckConfig( + request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateUptimeCheckConfig( + request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, + callback: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Updates an Uptime check configuration. You can either replace the entire + * configuration with a new one or replace only certain fields in the current + * configuration by specifying the fields to be updated via `updateMask`. + * Returns the updated configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. If present, only the listed fields in the current Uptime check + * configuration are updated with values from the new configuration. If this + * field is empty, then the current configuration is completely replaced with + * the new configuration. + * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig + * Required. If an `updateMask` has been specified, this field gives + * the values for the set of fields mentioned in the `updateMask`. If an + * `updateMask` has not been given, this Uptime check configuration replaces + * the current configuration. If a field is mentioned in `updateMask` but + * the corresonding field is omitted in this partial Uptime check + * configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + * + * The following fields can be updated: `display_name`, + * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and + * `selected_regions`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [UptimeCheckConfig]{@link google.monitoring.v3.UptimeCheckConfig}. + * 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.updateUptimeCheckConfig(request); + */ + updateUptimeCheckConfig( + request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.monitoring.v3.IUptimeCheckConfig, + | protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig, + protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + 'uptime_check_config.name': request.uptimeCheckConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateUptimeCheckConfig( + request, + options, + callback + ); + } + deleteUptimeCheckConfig( + request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest | undefined, + {} | undefined + ] + >; + deleteUptimeCheckConfig( + request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteUptimeCheckConfig( + request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): void; + /** + * Deletes an Uptime check configuration. Note that this method will fail + * if the Uptime check configuration is referenced by an alert policy or + * other dependent configs that would be rendered invalid by the deletion. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Uptime check configuration to delete. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER]/uptimeCheckConfigs/[UPTIME_CHECK_ID] + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * 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.deleteUptimeCheckConfig(request); + */ + deleteUptimeCheckConfig( + request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteUptimeCheckConfig( + request, + options, + callback + ); + } + + listUptimeCheckConfigs( + request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig[], + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + ] + >; + listUptimeCheckConfigs( + request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + > + ): void; + listUptimeCheckConfigs( + request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + > + ): void; + /** + * Lists the existing valid Uptime check configurations for the project + * (leaving out any invalid configurations). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project whose Uptime check configurations are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [UptimeCheckConfig]{@link google.monitoring.v3.UptimeCheckConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listUptimeCheckConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listUptimeCheckConfigs( + request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + | protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckConfig + > + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckConfig[], + protos.google.monitoring.v3.IListUptimeCheckConfigsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckConfigsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listUptimeCheckConfigs( + request, + options, + callback + ); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project whose Uptime check configurations are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [UptimeCheckConfig]{@link google.monitoring.v3.UptimeCheckConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listUptimeCheckConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listUptimeCheckConfigsStream( + request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listUptimeCheckConfigs.createStream( + this.innerApiCalls.listUptimeCheckConfigs as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listUptimeCheckConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project whose Uptime check configurations are listed. The format is: + * + * projects/[PROJECT_ID_OR_NUMBER] + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [UptimeCheckConfig]{@link google.monitoring.v3.UptimeCheckConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listUptimeCheckConfigsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listUptimeCheckConfigsAsync( + request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listUptimeCheckConfigs.asyncIterate( + this.innerApiCalls['listUptimeCheckConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + listUptimeCheckIps( + request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckIp[], + protos.google.monitoring.v3.IListUptimeCheckIpsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckIpsResponse + ] + >; + listUptimeCheckIps( + request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + > + ): void; + listUptimeCheckIps( + request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + callback: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + > + ): void; + /** + * Returns the list of IP addresses that checkers run from + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [UptimeCheckIp]{@link google.monitoring.v3.UptimeCheckIp}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listUptimeCheckIpsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listUptimeCheckIps( + request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + >, + callback?: PaginationCallback< + protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + | protos.google.monitoring.v3.IListUptimeCheckIpsResponse + | null + | undefined, + protos.google.monitoring.v3.IUptimeCheckIp + > + ): Promise< + [ + protos.google.monitoring.v3.IUptimeCheckIp[], + protos.google.monitoring.v3.IListUptimeCheckIpsRequest | null, + protos.google.monitoring.v3.IListUptimeCheckIpsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + this.initialize(); + return this.innerApiCalls.listUptimeCheckIps(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [UptimeCheckIp]{@link google.monitoring.v3.UptimeCheckIp} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listUptimeCheckIpsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listUptimeCheckIpsStream( + request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listUptimeCheckIps.createStream( + this.innerApiCalls.listUptimeCheckIps as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listUptimeCheckIps`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {number} request.pageSize + * The maximum number of results to return in a single response. The server + * may further constrain the maximum number of results returned in a single + * page. If the page_size is <=0, the server will decide the number of results + * to be returned. + * NOTE: this field is not yet implemented + * @param {string} request.pageToken + * If this field is not empty then it must contain the `nextPageToken` value + * returned by a previous call to this method. Using this field causes the + * method to return more results from the previous method call. + * NOTE: this field is not yet implemented + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [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 + * [UptimeCheckIp]{@link google.monitoring.v3.UptimeCheckIp}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listUptimeCheckIpsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listUptimeCheckIpsAsync( + request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listUptimeCheckIps.asyncIterate( + this.innerApiCalls['listUptimeCheckIps'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderAlertPolicy resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + folderAlertPolicyPath(folder: string, alertPolicy: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the folder from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicy resource. + * + * @param {string} folderAlertPolicyName + * A fully-qualified path representing folder_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { + return this.pathTemplates.folderAlertPolicyPathTemplate.match( + folderAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified folderAlertPolicyCondition resource name string. + * + * @param {string} folder + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + folderAlertPolicyConditionPath( + folder: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ + folder: folder, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the folder from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).folder; + } + + /** + * Parse the alert_policy from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from FolderAlertPolicyCondition resource. + * + * @param {string} folderAlertPolicyConditionName + * A fully-qualified path representing folder_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromFolderAlertPolicyConditionName( + folderAlertPolicyConditionName: string + ) { + return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match( + folderAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified folderChannelDescriptor resource name string. + * + * @param {string} folder + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + folderChannelDescriptorPath(folder: string, channelDescriptor: string) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ + folder: folder, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the folder from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).folder; + } + + /** + * Parse the channel_descriptor from FolderChannelDescriptor resource. + * + * @param {string} folderChannelDescriptorName + * A fully-qualified path representing folder_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromFolderChannelDescriptorName( + folderChannelDescriptorName: string + ) { + return this.pathTemplates.folderChannelDescriptorPathTemplate.match( + folderChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified folderGroup resource name string. + * + * @param {string} folder + * @param {string} group + * @returns {string} Resource name string. + */ + folderGroupPath(folder: string, group: string) { + return this.pathTemplates.folderGroupPathTemplate.render({ + folder: folder, + group: group, + }); + } + + /** + * Parse the folder from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .folder; + } + + /** + * Parse the group from FolderGroup resource. + * + * @param {string} folderGroupName + * A fully-qualified path representing folder_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromFolderGroupName(folderGroupName: string) { + return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName) + .group; + } + + /** + * Return a fully-qualified folderNotificationChannel resource name string. + * + * @param {string} folder + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + folderNotificationChannelPath(folder: string, notificationChannel: string) { + return this.pathTemplates.folderNotificationChannelPathTemplate.render({ + folder: folder, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the folder from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).folder; + } + + /** + * Parse the notification_channel from FolderNotificationChannel resource. + * + * @param {string} folderNotificationChannelName + * A fully-qualified path representing folder_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromFolderNotificationChannelName( + folderNotificationChannelName: string + ) { + return this.pathTemplates.folderNotificationChannelPathTemplate.match( + folderNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified folderService resource name string. + * + * @param {string} folder + * @param {string} service + * @returns {string} Resource name string. + */ + folderServicePath(folder: string, service: string) { + return this.pathTemplates.folderServicePathTemplate.render({ + folder: folder, + service: service, + }); + } + + /** + * Parse the folder from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .folder; + } + + /** + * Parse the service from FolderService resource. + * + * @param {string} folderServiceName + * A fully-qualified path representing folder_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceName(folderServiceName: string) { + return this.pathTemplates.folderServicePathTemplate.match(folderServiceName) + .service; + } + + /** + * Return a fully-qualified folderServiceServiceLevelObjective resource name string. + * + * @param {string} folder + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + folderServiceServiceLevelObjectivePath( + folder: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render( + { + folder: folder, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the folder from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).folder; + } + + /** + * Parse the service from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. + * + * @param {string} folderServiceServiceLevelObjectiveName + * A fully-qualified path representing folder_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + folderServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match( + folderServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified folderUptimeCheckConfig resource name string. + * + * @param {string} folder + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + folderUptimeCheckConfigPath(folder: string, uptimeCheckConfig: string) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ + folder: folder, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the folder from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).folder; + } + + /** + * Parse the uptime_check_config from FolderUptimeCheckConfig resource. + * + * @param {string} folderUptimeCheckConfigName + * A fully-qualified path representing folder_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + folderUptimeCheckConfigName: string + ) { + return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match( + folderUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified organizationAlertPolicy resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + organizationAlertPolicyPath(organization: string, alertPolicy: string) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ + organization: organization, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the organization from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicy resource. + * + * @param {string} organizationAlertPolicyName + * A fully-qualified path representing organization_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyName( + organizationAlertPolicyName: string + ) { + return this.pathTemplates.organizationAlertPolicyPathTemplate.match( + organizationAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified organizationAlertPolicyCondition resource name string. + * + * @param {string} organization + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + organizationAlertPolicyConditionPath( + organization: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render( + { + organization: organization, + alert_policy: alertPolicy, + condition: condition, + } + ); + } + + /** + * Parse the organization from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).organization; + } + + /** + * Parse the alert_policy from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from OrganizationAlertPolicyCondition resource. + * + * @param {string} organizationAlertPolicyConditionName + * A fully-qualified path representing organization_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromOrganizationAlertPolicyConditionName( + organizationAlertPolicyConditionName: string + ) { + return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match( + organizationAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified organizationChannelDescriptor resource name string. + * + * @param {string} organization + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + organizationChannelDescriptorPath( + organization: string, + channelDescriptor: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ + organization: organization, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the organization from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).organization; + } + + /** + * Parse the channel_descriptor from OrganizationChannelDescriptor resource. + * + * @param {string} organizationChannelDescriptorName + * A fully-qualified path representing organization_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromOrganizationChannelDescriptorName( + organizationChannelDescriptorName: string + ) { + return this.pathTemplates.organizationChannelDescriptorPathTemplate.match( + organizationChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified organizationGroup resource name string. + * + * @param {string} organization + * @param {string} group + * @returns {string} Resource name string. + */ + organizationGroupPath(organization: string, group: string) { + return this.pathTemplates.organizationGroupPathTemplate.render({ + organization: organization, + group: group, + }); + } + + /** + * Parse the organization from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).organization; + } + + /** + * Parse the group from OrganizationGroup resource. + * + * @param {string} organizationGroupName + * A fully-qualified path representing organization_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromOrganizationGroupName(organizationGroupName: string) { + return this.pathTemplates.organizationGroupPathTemplate.match( + organizationGroupName + ).group; + } + + /** + * Return a fully-qualified organizationNotificationChannel resource name string. + * + * @param {string} organization + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + organizationNotificationChannelPath( + organization: string, + notificationChannel: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.render( + { + organization: organization, + notification_channel: notificationChannel, + } + ); + } + + /** + * Parse the organization from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).organization; + } + + /** + * Parse the notification_channel from OrganizationNotificationChannel resource. + * + * @param {string} organizationNotificationChannelName + * A fully-qualified path representing organization_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromOrganizationNotificationChannelName( + organizationNotificationChannelName: string + ) { + return this.pathTemplates.organizationNotificationChannelPathTemplate.match( + organizationNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified organizationService resource name string. + * + * @param {string} organization + * @param {string} service + * @returns {string} Resource name string. + */ + organizationServicePath(organization: string, service: string) { + return this.pathTemplates.organizationServicePathTemplate.render({ + organization: organization, + service: service, + }); + } + + /** + * Parse the organization from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceName( + organizationServiceName: string + ) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).organization; + } + + /** + * Parse the service from OrganizationService resource. + * + * @param {string} organizationServiceName + * A fully-qualified path representing organization_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceName(organizationServiceName: string) { + return this.pathTemplates.organizationServicePathTemplate.match( + organizationServiceName + ).service; + } + + /** + * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. + * + * @param {string} organization + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + organizationServiceServiceLevelObjectivePath( + organization: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render( + { + organization: organization, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the organization from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).organization; + } + + /** + * Parse the service from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. + * + * @param {string} organizationServiceServiceLevelObjectiveName + * A fully-qualified path representing organization_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + organizationServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match( + organizationServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified organizationUptimeCheckConfig resource name string. + * + * @param {string} organization + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + organizationUptimeCheckConfigPath( + organization: string, + uptimeCheckConfig: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ + organization: organization, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the organization from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).organization; + } + + /** + * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. + * + * @param {string} organizationUptimeCheckConfigName + * A fully-qualified path representing organization_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + organizationUptimeCheckConfigName: string + ) { + return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match( + organizationUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAlertPolicy resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @returns {string} Resource name string. + */ + projectAlertPolicyPath(project: string, alertPolicy: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + }); + } + + /** + * Parse the project from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicy resource. + * + * @param {string} projectAlertPolicyName + * A fully-qualified path representing project_alert_policy resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { + return this.pathTemplates.projectAlertPolicyPathTemplate.match( + projectAlertPolicyName + ).alert_policy; + } + + /** + * Return a fully-qualified projectAlertPolicyCondition resource name string. + * + * @param {string} project + * @param {string} alert_policy + * @param {string} condition + * @returns {string} Resource name string. + */ + projectAlertPolicyConditionPath( + project: string, + alertPolicy: string, + condition: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ + project: project, + alert_policy: alertPolicy, + condition: condition, + }); + } + + /** + * Parse the project from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).project; + } + + /** + * Parse the alert_policy from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the alert_policy. + */ + matchAlertPolicyFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).alert_policy; + } + + /** + * Parse the condition from ProjectAlertPolicyCondition resource. + * + * @param {string} projectAlertPolicyConditionName + * A fully-qualified path representing project_alert_policy_condition resource. + * @returns {string} A string representing the condition. + */ + matchConditionFromProjectAlertPolicyConditionName( + projectAlertPolicyConditionName: string + ) { + return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match( + projectAlertPolicyConditionName + ).condition; + } + + /** + * Return a fully-qualified projectChannelDescriptor resource name string. + * + * @param {string} project + * @param {string} channel_descriptor + * @returns {string} Resource name string. + */ + projectChannelDescriptorPath(project: string, channelDescriptor: string) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ + project: project, + channel_descriptor: channelDescriptor, + }); + } + + /** + * Parse the project from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).project; + } + + /** + * Parse the channel_descriptor from ProjectChannelDescriptor resource. + * + * @param {string} projectChannelDescriptorName + * A fully-qualified path representing project_channel_descriptor resource. + * @returns {string} A string representing the channel_descriptor. + */ + matchChannelDescriptorFromProjectChannelDescriptorName( + projectChannelDescriptorName: string + ) { + return this.pathTemplates.projectChannelDescriptorPathTemplate.match( + projectChannelDescriptorName + ).channel_descriptor; + } + + /** + * Return a fully-qualified projectGroup resource name string. + * + * @param {string} project + * @param {string} group + * @returns {string} Resource name string. + */ + projectGroupPath(project: string, group: string) { + return this.pathTemplates.projectGroupPathTemplate.render({ + project: project, + group: group, + }); + } + + /** + * Parse the project from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .project; + } + + /** + * Parse the group from ProjectGroup resource. + * + * @param {string} projectGroupName + * A fully-qualified path representing project_group resource. + * @returns {string} A string representing the group. + */ + matchGroupFromProjectGroupName(projectGroupName: string) { + return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName) + .group; + } + + /** + * Return a fully-qualified projectNotificationChannel resource name string. + * + * @param {string} project + * @param {string} notification_channel + * @returns {string} Resource name string. + */ + projectNotificationChannelPath(project: string, notificationChannel: string) { + return this.pathTemplates.projectNotificationChannelPathTemplate.render({ + project: project, + notification_channel: notificationChannel, + }); + } + + /** + * Parse the project from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).project; + } + + /** + * Parse the notification_channel from ProjectNotificationChannel resource. + * + * @param {string} projectNotificationChannelName + * A fully-qualified path representing project_notification_channel resource. + * @returns {string} A string representing the notification_channel. + */ + matchNotificationChannelFromProjectNotificationChannelName( + projectNotificationChannelName: string + ) { + return this.pathTemplates.projectNotificationChannelPathTemplate.match( + projectNotificationChannelName + ).notification_channel; + } + + /** + * Return a fully-qualified projectService resource name string. + * + * @param {string} project + * @param {string} service + * @returns {string} Resource name string. + */ + projectServicePath(project: string, service: string) { + return this.pathTemplates.projectServicePathTemplate.render({ + project: project, + service: service, + }); + } + + /** + * Parse the project from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).project; + } + + /** + * Parse the service from ProjectService resource. + * + * @param {string} projectServiceName + * A fully-qualified path representing project_service resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceName(projectServiceName: string) { + return this.pathTemplates.projectServicePathTemplate.match( + projectServiceName + ).service; + } + + /** + * Return a fully-qualified projectServiceServiceLevelObjective resource name string. + * + * @param {string} project + * @param {string} service + * @param {string} service_level_objective + * @returns {string} Resource name string. + */ + projectServiceServiceLevelObjectivePath( + project: string, + service: string, + serviceLevelObjective: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render( + { + project: project, + service: service, + service_level_objective: serviceLevelObjective, + } + ); + } + + /** + * Parse the project from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).project; + } + + /** + * Parse the service from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service. + */ + matchServiceFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service; + } + + /** + * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. + * + * @param {string} projectServiceServiceLevelObjectiveName + * A fully-qualified path representing project_service_service_level_objective resource. + * @returns {string} A string representing the service_level_objective. + */ + matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + projectServiceServiceLevelObjectiveName: string + ) { + return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match( + projectServiceServiceLevelObjectiveName + ).service_level_objective; + } + + /** + * Return a fully-qualified projectUptimeCheckConfig resource name string. + * + * @param {string} project + * @param {string} uptime_check_config + * @returns {string} Resource name string. + */ + projectUptimeCheckConfigPath(project: string, uptimeCheckConfig: string) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ + project: project, + uptime_check_config: uptimeCheckConfig, + }); + } + + /** + * Parse the project from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).project; + } + + /** + * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. + * + * @param {string} projectUptimeCheckConfigName + * A fully-qualified path representing project_uptime_check_config resource. + * @returns {string} A string representing the uptime_check_config. + */ + matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + projectUptimeCheckConfigName: string + ) { + return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match( + projectUptimeCheckConfigName + ).uptime_check_config; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + this.initialize(); + if (!this._terminated) { + return this.uptimeCheckServiceStub!.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-monitoring/src/v3/uptime_check_service_client_config.json b/packages/google-cloud-monitoring/src/v3/uptime_check_service_client_config.json new file mode 100644 index 00000000000..90df7a47556 --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/uptime_check_service_client_config.json @@ -0,0 +1,65 @@ +{ + "interfaces": { + "google.monitoring.v3.UptimeCheckService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 30000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListUptimeCheckConfigs": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "GetUptimeCheckConfig": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "CreateUptimeCheckConfig": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateUptimeCheckConfig": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteUptimeCheckConfig": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + }, + "ListUptimeCheckIps": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" + } + } + } + } +} diff --git a/packages/google-cloud-monitoring/src/v3/uptime_check_service_proto_list.json b/packages/google-cloud-monitoring/src/v3/uptime_check_service_proto_list.json new file mode 100644 index 00000000000..e55f61d422f --- /dev/null +++ b/packages/google-cloud-monitoring/src/v3/uptime_check_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/monitoring/v3/alert.proto", + "../../protos/google/monitoring/v3/alert_service.proto", + "../../protos/google/monitoring/v3/common.proto", + "../../protos/google/monitoring/v3/dropped_labels.proto", + "../../protos/google/monitoring/v3/group.proto", + "../../protos/google/monitoring/v3/group_service.proto", + "../../protos/google/monitoring/v3/metric.proto", + "../../protos/google/monitoring/v3/metric_service.proto", + "../../protos/google/monitoring/v3/mutation_record.proto", + "../../protos/google/monitoring/v3/notification.proto", + "../../protos/google/monitoring/v3/notification_service.proto", + "../../protos/google/monitoring/v3/query_service.proto", + "../../protos/google/monitoring/v3/service.proto", + "../../protos/google/monitoring/v3/service_service.proto", + "../../protos/google/monitoring/v3/span_context.proto", + "../../protos/google/monitoring/v3/uptime.proto", + "../../protos/google/monitoring/v3/uptime_service.proto" +] diff --git a/packages/google-cloud-monitoring/system-test/.eslintrc.yml b/packages/google-cloud-monitoring/system-test/.eslintrc.yml new file mode 100644 index 00000000000..282535f55f6 --- /dev/null +++ b/packages/google-cloud-monitoring/system-test/.eslintrc.yml @@ -0,0 +1,3 @@ +--- +rules: + no-console: off diff --git a/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.js b/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..49be45ef93a --- /dev/null +++ b/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.js @@ -0,0 +1,34 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const monitoring = require('@google-cloud/monitoring'); + +function main() { + const alertPolicyServiceClient = new monitoring.AlertPolicyServiceClient(); + const groupServiceClient = new monitoring.GroupServiceClient(); + const metricServiceClient = new monitoring.MetricServiceClient(); + const notificationChannelServiceClient = + new monitoring.NotificationChannelServiceClient(); + const queryServiceClient = new monitoring.QueryServiceClient(); + const serviceMonitoringServiceClient = + new monitoring.ServiceMonitoringServiceClient(); + const uptimeCheckServiceClient = new monitoring.UptimeCheckServiceClient(); +} + +main(); diff --git a/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..3c852d99a4a --- /dev/null +++ b/packages/google-cloud-monitoring/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,81 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { + AlertPolicyServiceClient, + GroupServiceClient, + MetricServiceClient, + NotificationChannelServiceClient, + QueryServiceClient, + ServiceMonitoringServiceClient, + UptimeCheckServiceClient, +} from '@google-cloud/monitoring'; + +// check that the client class type name can be used +function doStuffWithAlertPolicyServiceClient(client: AlertPolicyServiceClient) { + client.close(); +} +function doStuffWithGroupServiceClient(client: GroupServiceClient) { + client.close(); +} +function doStuffWithMetricServiceClient(client: MetricServiceClient) { + client.close(); +} +function doStuffWithNotificationChannelServiceClient( + client: NotificationChannelServiceClient +) { + client.close(); +} +function doStuffWithQueryServiceClient(client: QueryServiceClient) { + client.close(); +} +function doStuffWithServiceMonitoringServiceClient( + client: ServiceMonitoringServiceClient +) { + client.close(); +} +function doStuffWithUptimeCheckServiceClient(client: UptimeCheckServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const alertPolicyServiceClient = new AlertPolicyServiceClient(); + doStuffWithAlertPolicyServiceClient(alertPolicyServiceClient); + // check that the client instance can be created + const groupServiceClient = new GroupServiceClient(); + doStuffWithGroupServiceClient(groupServiceClient); + // check that the client instance can be created + const metricServiceClient = new MetricServiceClient(); + doStuffWithMetricServiceClient(metricServiceClient); + // check that the client instance can be created + const notificationChannelServiceClient = + new NotificationChannelServiceClient(); + doStuffWithNotificationChannelServiceClient(notificationChannelServiceClient); + // check that the client instance can be created + const queryServiceClient = new QueryServiceClient(); + doStuffWithQueryServiceClient(queryServiceClient); + // check that the client instance can be created + const serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); + doStuffWithServiceMonitoringServiceClient(serviceMonitoringServiceClient); + // check that the client instance can be created + const uptimeCheckServiceClient = new UptimeCheckServiceClient(); + doStuffWithUptimeCheckServiceClient(uptimeCheckServiceClient); +} + +main(); diff --git a/packages/google-cloud-monitoring/system-test/install.ts b/packages/google-cloud-monitoring/system-test/install.ts new file mode 100644 index 00000000000..d2d61c0396f --- /dev/null +++ b/packages/google-cloud-monitoring/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, + }; + await packNTest(options); + }); + + it('JavaScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, + }; + await packNTest(options); + }); +}); diff --git a/packages/google-cloud-monitoring/test/gapic_alert_policy_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_alert_policy_service_v3.ts new file mode 100644 index 00000000000..8002a011759 --- /dev/null +++ b/packages/google-cloud-monitoring/test/gapic_alert_policy_service_v3.ts @@ -0,0 +1,2554 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as alertpolicyserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3.AlertPolicyServiceClient', () => { + it('has servicePath', () => { + const servicePath = + alertpolicyserviceModule.v3.AlertPolicyServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + alertpolicyserviceModule.v3.AlertPolicyServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = alertpolicyserviceModule.v3.AlertPolicyServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.alertPolicyServiceStub, undefined); + await client.initialize(); + assert(client.alertPolicyServiceStub); + }); + + it('has close method', () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getAlertPolicy', () => { + it('invokes getAlertPolicy without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy() + ); + client.innerApiCalls.getAlertPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getAlertPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getAlertPolicy without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy() + ); + client.innerApiCalls.getAlertPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAlertPolicy( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IAlertPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getAlertPolicy with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAlertPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getAlertPolicy(request), expectedError); + assert( + (client.innerApiCalls.getAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createAlertPolicy', () => { + it('invokes createAlertPolicy without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy() + ); + client.innerApiCalls.createAlertPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.createAlertPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createAlertPolicy without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy() + ); + client.innerApiCalls.createAlertPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAlertPolicy( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IAlertPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createAlertPolicy with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAlertPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createAlertPolicy(request), expectedError); + assert( + (client.innerApiCalls.createAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteAlertPolicy', () => { + it('invokes deleteAlertPolicy without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAlertPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAlertPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteAlertPolicy without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAlertPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAlertPolicy( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteAlertPolicy with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteAlertPolicyRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAlertPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteAlertPolicy(request), expectedError); + assert( + (client.innerApiCalls.deleteAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateAlertPolicy', () => { + it('invokes updateAlertPolicy without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateAlertPolicyRequest() + ); + request.alertPolicy = {}; + request.alertPolicy.name = ''; + const expectedHeaderRequestParams = 'alert_policy.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy() + ); + client.innerApiCalls.updateAlertPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.updateAlertPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateAlertPolicy without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateAlertPolicyRequest() + ); + request.alertPolicy = {}; + request.alertPolicy.name = ''; + const expectedHeaderRequestParams = 'alert_policy.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.AlertPolicy() + ); + client.innerApiCalls.updateAlertPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAlertPolicy( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IAlertPolicy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateAlertPolicy with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateAlertPolicyRequest() + ); + request.alertPolicy = {}; + request.alertPolicy.name = ''; + const expectedHeaderRequestParams = 'alert_policy.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAlertPolicy = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateAlertPolicy(request), expectedError); + assert( + (client.innerApiCalls.updateAlertPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listAlertPolicies', () => { + it('invokes listAlertPolicies without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + ]; + client.innerApiCalls.listAlertPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.listAlertPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listAlertPolicies as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listAlertPolicies without error using callback', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + ]; + client.innerApiCalls.listAlertPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAlertPolicies( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IAlertPolicy[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listAlertPolicies as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listAlertPolicies with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAlertPolicies = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listAlertPolicies(request), expectedError); + assert( + (client.innerApiCalls.listAlertPolicies as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listAlertPoliciesStream without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + ]; + client.descriptors.page.listAlertPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAlertPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.AlertPolicy[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.AlertPolicy) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAlertPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAlertPolicies, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listAlertPolicies.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAlertPoliciesStream with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listAlertPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAlertPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.AlertPolicy[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.AlertPolicy) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAlertPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAlertPolicies, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listAlertPolicies.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAlertPolicies without error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), + ]; + client.descriptors.page.listAlertPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; + const iterable = client.listAlertPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAlertPolicies with error', async () => { + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListAlertPoliciesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listAlertPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAlertPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderAlertPolicyCondition', () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderChannelDescriptor', () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderGroup', () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderNotificationChannel', () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderService', () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderUptimeCheckConfig', () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicy', () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicyCondition', () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationChannelDescriptor', () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationGroup', () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationNotificationChannel', () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationService', () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationServiceServiceLevelObjective', () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationUptimeCheckConfig', () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicy', () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicyCondition', () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectChannelDescriptor', () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectGroup', () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectNotificationChannel', () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectService', () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectUptimeCheckConfig', () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-monitoring/test/gapic_group_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_group_service_v3.ts new file mode 100644 index 00000000000..6ca1907f044 --- /dev/null +++ b/packages/google-cloud-monitoring/test/gapic_group_service_v3.ts @@ -0,0 +1,2822 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as groupserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3.GroupServiceClient', () => { + it('has servicePath', () => { + const servicePath = groupserviceModule.v3.GroupServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = groupserviceModule.v3.GroupServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = groupserviceModule.v3.GroupServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new groupserviceModule.v3.GroupServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.groupServiceStub, undefined); + await client.initialize(); + assert(client.groupServiceStub); + }); + + it('has close method', () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getGroup', () => { + it('invokes getGroup without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group() + ); + client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); + const [response] = await client.getGroup(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getGroup without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group() + ); + client.innerApiCalls.getGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGroup( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGroup | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getGroup with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGroup(request), expectedError); + assert( + (client.innerApiCalls.getGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createGroup', () => { + it('invokes createGroup without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group() + ); + client.innerApiCalls.createGroup = stubSimpleCall(expectedResponse); + const [response] = await client.createGroup(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createGroup without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group() + ); + client.innerApiCalls.createGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGroup( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGroup | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createGroup with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createGroup = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createGroup(request), expectedError); + assert( + (client.innerApiCalls.createGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateGroup', () => { + it('invokes updateGroup without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateGroupRequest() + ); + request.group = {}; + request.group.name = ''; + const expectedHeaderRequestParams = 'group.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group() + ); + client.innerApiCalls.updateGroup = stubSimpleCall(expectedResponse); + const [response] = await client.updateGroup(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateGroup without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateGroupRequest() + ); + request.group = {}; + request.group.name = ''; + const expectedHeaderRequestParams = 'group.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Group() + ); + client.innerApiCalls.updateGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGroup( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGroup | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateGroup with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateGroupRequest() + ); + request.group = {}; + request.group.name = ''; + const expectedHeaderRequestParams = 'group.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGroup = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateGroup(request), expectedError); + assert( + (client.innerApiCalls.updateGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteGroup', () => { + it('invokes deleteGroup without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteGroup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteGroup(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteGroup without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGroup( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteGroup with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteGroupRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGroup = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteGroup(request), expectedError); + assert( + (client.innerApiCalls.deleteGroup as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listGroups', () => { + it('invokes listGroups without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + ]; + client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); + const [response] = await client.listGroups(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listGroups as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listGroups without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + ]; + client.innerApiCalls.listGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGroups( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGroup[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listGroups as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listGroups with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listGroups = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listGroups(request), expectedError); + assert( + (client.innerApiCalls.listGroups as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listGroupsStream without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + ]; + client.descriptors.page.listGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Group[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Group) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroups, request) + ); + assert.strictEqual( + (client.descriptors.page.listGroups.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listGroupsStream with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listGroups.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Group[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Group) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroups, request) + ); + assert.strictEqual( + (client.descriptors.page.listGroups.createStream as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listGroups without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + generateSampleMessage(new protos.google.monitoring.v3.Group()), + ]; + client.descriptors.page.listGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IGroup[] = []; + const iterable = client.listGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listGroups with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IGroup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert.strictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub).getCall( + 0 + ).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listGroupMembers', () => { + it('invokes listGroupMembers without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + ]; + client.innerApiCalls.listGroupMembers = stubSimpleCall(expectedResponse); + const [response] = await client.listGroupMembers(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listGroupMembers as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listGroupMembers without error using callback', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + ]; + client.innerApiCalls.listGroupMembers = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGroupMembers( + request, + ( + err?: Error | null, + result?: protos.google.api.IMonitoredResource[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listGroupMembers as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listGroupMembers with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listGroupMembers = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listGroupMembers(request), expectedError); + assert( + (client.innerApiCalls.listGroupMembers as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listGroupMembersStream without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + ]; + client.descriptors.page.listGroupMembers.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGroupMembersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResource[] = []; + stream.on('data', (response: protos.google.api.MonitoredResource) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listGroupMembers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroupMembers, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listGroupMembers.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listGroupMembersStream with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listGroupMembers.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listGroupMembersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResource[] = []; + stream.on('data', (response: protos.google.api.MonitoredResource) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listGroupMembers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroupMembers, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listGroupMembers.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listGroupMembers without error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + generateSampleMessage(new protos.google.api.MonitoredResource()), + ]; + client.descriptors.page.listGroupMembers.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.IMonitoredResource[] = []; + const iterable = client.listGroupMembersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listGroupMembers.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listGroupMembers.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listGroupMembers with error', async () => { + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListGroupMembersRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listGroupMembers.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listGroupMembersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.IMonitoredResource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listGroupMembers.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listGroupMembers.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderAlertPolicyCondition', () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderChannelDescriptor', () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderGroup', () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderNotificationChannel', () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderService', () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderUptimeCheckConfig', () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicy', () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicyCondition', () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationChannelDescriptor', () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationGroup', () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationNotificationChannel', () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationService', () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationServiceServiceLevelObjective', () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationUptimeCheckConfig', () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicy', () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicyCondition', () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectChannelDescriptor', () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectGroup', () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectNotificationChannel', () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectService', () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectUptimeCheckConfig', () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new groupserviceModule.v3.GroupServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-monitoring/test/gapic_metric_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_metric_service_v3.ts new file mode 100644 index 00000000000..8b4684de354 --- /dev/null +++ b/packages/google-cloud-monitoring/test/gapic_metric_service_v3.ts @@ -0,0 +1,3740 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as metricserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3.MetricServiceClient', () => { + it('has servicePath', () => { + const servicePath = metricserviceModule.v3.MetricServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = metricserviceModule.v3.MetricServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = metricserviceModule.v3.MetricServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new metricserviceModule.v3.MetricServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.metricServiceStub, undefined); + await client.initialize(); + assert(client.metricServiceStub); + }); + + it('has close method', () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getMonitoredResourceDescriptor', () => { + it('invokes getMonitoredResourceDescriptor without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ); + client.innerApiCalls.getMonitoredResourceDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.getMonitoredResourceDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getMonitoredResourceDescriptor without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ); + client.innerApiCalls.getMonitoredResourceDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMonitoredResourceDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.api.IMonitoredResourceDescriptor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getMonitoredResourceDescriptor with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getMonitoredResourceDescriptor(request), + expectedError + ); + assert( + (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getMetricDescriptor', () => { + it('invokes getMetricDescriptor without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.MetricDescriptor() + ); + client.innerApiCalls.getMetricDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.getMetricDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getMetricDescriptor without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.MetricDescriptor() + ); + client.innerApiCalls.getMetricDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMetricDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.api.IMetricDescriptor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getMetricDescriptor with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getMetricDescriptor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getMetricDescriptor(request), expectedError); + assert( + (client.innerApiCalls.getMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createMetricDescriptor', () => { + it('invokes createMetricDescriptor without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.MetricDescriptor() + ); + client.innerApiCalls.createMetricDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.createMetricDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createMetricDescriptor without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.api.MetricDescriptor() + ); + client.innerApiCalls.createMetricDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMetricDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.api.IMetricDescriptor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createMetricDescriptor with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createMetricDescriptor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createMetricDescriptor(request), + expectedError + ); + assert( + (client.innerApiCalls.createMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteMetricDescriptor', () => { + it('invokes deleteMetricDescriptor without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteMetricDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteMetricDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteMetricDescriptor without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteMetricDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMetricDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteMetricDescriptor with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMetricDescriptor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteMetricDescriptor(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteMetricDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createTimeSeries', () => { + it('invokes createTimeSeries without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.createTimeSeries = stubSimpleCall(expectedResponse); + const [response] = await client.createTimeSeries(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createTimeSeries without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.createTimeSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTimeSeries( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createTimeSeries with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createTimeSeries = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createTimeSeries(request), expectedError); + assert( + (client.innerApiCalls.createTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listMonitoredResourceDescriptors', () => { + it('invokes listMonitoredResourceDescriptors without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + ]; + client.innerApiCalls.listMonitoredResourceDescriptors = + stubSimpleCall(expectedResponse); + const [response] = await client.listMonitoredResourceDescriptors(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listMonitoredResourceDescriptors without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + ]; + client.innerApiCalls.listMonitoredResourceDescriptors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMonitoredResourceDescriptors( + request, + ( + err?: Error | null, + result?: protos.google.api.IMonitoredResourceDescriptor[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listMonitoredResourceDescriptors with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listMonitoredResourceDescriptors(request), + expectedError + ); + assert( + (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listMonitoredResourceDescriptorsStream without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + ]; + client.descriptors.page.listMonitoredResourceDescriptors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMonitoredResourceDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResourceDescriptor[] = []; + stream.on( + 'data', + (response: protos.google.api.MonitoredResourceDescriptor) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMonitoredResourceDescriptors, + request + ) + ); + assert.strictEqual( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listMonitoredResourceDescriptorsStream with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listMonitoredResourceDescriptors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMonitoredResourceDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MonitoredResourceDescriptor[] = []; + stream.on( + 'data', + (response: protos.google.api.MonitoredResourceDescriptor) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listMonitoredResourceDescriptors, + request + ) + ); + assert.strictEqual( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + generateSampleMessage( + new protos.google.api.MonitoredResourceDescriptor() + ), + ]; + client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; + const iterable = client.listMonitoredResourceDescriptorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMonitoredResourceDescriptorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listMonitoredResourceDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listMetricDescriptors', () => { + it('invokes listMetricDescriptors without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + ]; + client.innerApiCalls.listMetricDescriptors = + stubSimpleCall(expectedResponse); + const [response] = await client.listMetricDescriptors(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listMetricDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listMetricDescriptors without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + ]; + client.innerApiCalls.listMetricDescriptors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMetricDescriptors( + request, + ( + err?: Error | null, + result?: protos.google.api.IMetricDescriptor[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listMetricDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listMetricDescriptors with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listMetricDescriptors = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listMetricDescriptors(request), + expectedError + ); + assert( + (client.innerApiCalls.listMetricDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listMetricDescriptorsStream without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + ]; + client.descriptors.page.listMetricDescriptors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMetricDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MetricDescriptor[] = []; + stream.on('data', (response: protos.google.api.MetricDescriptor) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listMetricDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listMetricDescriptors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listMetricDescriptors + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listMetricDescriptorsStream with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listMetricDescriptors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMetricDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.api.MetricDescriptor[] = []; + stream.on('data', (response: protos.google.api.MetricDescriptor) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listMetricDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listMetricDescriptors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listMetricDescriptors + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMetricDescriptors without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + generateSampleMessage(new protos.google.api.MetricDescriptor()), + ]; + client.descriptors.page.listMetricDescriptors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.api.IMetricDescriptor[] = []; + const iterable = client.listMetricDescriptorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMetricDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listMetricDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listMetricDescriptors with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListMetricDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listMetricDescriptors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMetricDescriptorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.api.IMetricDescriptor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMetricDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listMetricDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listTimeSeries', () => { + it('invokes listTimeSeries without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + ]; + client.innerApiCalls.listTimeSeries = stubSimpleCall(expectedResponse); + const [response] = await client.listTimeSeries(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listTimeSeries without error using callback', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + ]; + client.innerApiCalls.listTimeSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTimeSeries( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.ITimeSeries[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listTimeSeries with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listTimeSeries = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listTimeSeries(request), expectedError); + assert( + (client.innerApiCalls.listTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listTimeSeriesStream without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + ]; + client.descriptors.page.listTimeSeries.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listTimeSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.TimeSeries[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.TimeSeries) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listTimeSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTimeSeries, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listTimeSeries.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listTimeSeriesStream with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listTimeSeries.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listTimeSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.TimeSeries[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.TimeSeries) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listTimeSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTimeSeries, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listTimeSeries.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTimeSeries without error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), + ]; + client.descriptors.page.listTimeSeries.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.ITimeSeries[] = []; + const iterable = client.listTimeSeriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listTimeSeries with error', async () => { + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listTimeSeries.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTimeSeriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.ITimeSeries[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderAlertPolicyCondition', () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderChannelDescriptor', () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderGroup', () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderMetricDescriptor', () => { + const fakePath = '/rendered/path/folderMetricDescriptor'; + const expectedParameters = { + folder: 'folderValue', + metric_descriptor: 'metricDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderMetricDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderMetricDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderMetricDescriptorPath', () => { + const result = client.folderMetricDescriptorPath( + 'folderValue', + 'metricDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderMetricDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderMetricDescriptorName', () => { + const result = + client.matchFolderFromFolderMetricDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMetricDescriptorFromFolderMetricDescriptorName', () => { + const result = + client.matchMetricDescriptorFromFolderMetricDescriptorName(fakePath); + assert.strictEqual(result, 'metricDescriptorValue'); + assert( + ( + client.pathTemplates.folderMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderMonitoredResourceDescriptor', () => { + const fakePath = '/rendered/path/folderMonitoredResourceDescriptor'; + const expectedParameters = { + folder: 'folderValue', + monitored_resource_descriptor: 'monitoredResourceDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderMonitoredResourceDescriptorPath', () => { + const result = client.folderMonitoredResourceDescriptorPath( + 'folderValue', + 'monitoredResourceDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderMonitoredResourceDescriptorName', () => { + const result = + client.matchFolderFromFolderMonitoredResourceDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName', () => { + const result = + client.matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName( + fakePath + ); + assert.strictEqual(result, 'monitoredResourceDescriptorValue'); + assert( + ( + client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderNotificationChannel', () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderService', () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderUptimeCheckConfig', () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicy', () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicyCondition', () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationChannelDescriptor', () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationGroup', () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationMetricDescriptor', () => { + const fakePath = '/rendered/path/organizationMetricDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + metric_descriptor: 'metricDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationMetricDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationMetricDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationMetricDescriptorPath', () => { + const result = client.organizationMetricDescriptorPath( + 'organizationValue', + 'metricDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationMetricDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationMetricDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationMetricDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMetricDescriptorFromOrganizationMetricDescriptorName', () => { + const result = + client.matchMetricDescriptorFromOrganizationMetricDescriptorName( + fakePath + ); + assert.strictEqual(result, 'metricDescriptorValue'); + assert( + ( + client.pathTemplates.organizationMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationMonitoredResourceDescriptor', () => { + const fakePath = '/rendered/path/organizationMonitoredResourceDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + monitored_resource_descriptor: 'monitoredResourceDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationMonitoredResourceDescriptorPath', () => { + const result = client.organizationMonitoredResourceDescriptorPath( + 'organizationValue', + 'monitoredResourceDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationMonitoredResourceDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationMonitoredResourceDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationMonitoredResourceDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName', () => { + const result = + client.matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName( + fakePath + ); + assert.strictEqual(result, 'monitoredResourceDescriptorValue'); + assert( + ( + client.pathTemplates + .organizationMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationNotificationChannel', () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationService', () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationServiceServiceLevelObjective', () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationUptimeCheckConfig', () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicy', () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicyCondition', () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectChannelDescriptor', () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectGroup', () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectMetricDescriptor', () => { + const fakePath = '/rendered/path/projectMetricDescriptor'; + const expectedParameters = { + project: 'projectValue', + metric_descriptor: 'metricDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectMetricDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectMetricDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectMetricDescriptorPath', () => { + const result = client.projectMetricDescriptorPath( + 'projectValue', + 'metricDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectMetricDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectMetricDescriptorName', () => { + const result = + client.matchProjectFromProjectMetricDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMetricDescriptorFromProjectMetricDescriptorName', () => { + const result = + client.matchMetricDescriptorFromProjectMetricDescriptorName(fakePath); + assert.strictEqual(result, 'metricDescriptorValue'); + assert( + ( + client.pathTemplates.projectMetricDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectMonitoredResourceDescriptor', () => { + const fakePath = '/rendered/path/projectMonitoredResourceDescriptor'; + const expectedParameters = { + project: 'projectValue', + monitored_resource_descriptor: 'monitoredResourceDescriptorValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectMonitoredResourceDescriptorPath', () => { + const result = client.projectMonitoredResourceDescriptorPath( + 'projectValue', + 'monitoredResourceDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectMonitoredResourceDescriptorName', () => { + const result = + client.matchProjectFromProjectMonitoredResourceDescriptorName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName', () => { + const result = + client.matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName( + fakePath + ); + assert.strictEqual(result, 'monitoredResourceDescriptorValue'); + assert( + ( + client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectNotificationChannel', () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectService', () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectTimeSeries', () => { + const fakePath = '/rendered/path/projectTimeSeries'; + const expectedParameters = { + project: 'projectValue', + time_series: 'timeSeriesValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectTimeSeriesPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectTimeSeriesPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectTimeSeriesPath', () => { + const result = client.projectTimeSeriesPath( + 'projectValue', + 'timeSeriesValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectTimeSeriesPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectTimeSeriesName', () => { + const result = client.matchProjectFromProjectTimeSeriesName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectTimeSeriesPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchTimeSeriesFromProjectTimeSeriesName', () => { + const result = + client.matchTimeSeriesFromProjectTimeSeriesName(fakePath); + assert.strictEqual(result, 'timeSeriesValue'); + assert( + ( + client.pathTemplates.projectTimeSeriesPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectUptimeCheckConfig', () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new metricserviceModule.v3.MetricServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-monitoring/test/gapic_notification_channel_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_notification_channel_service_v3.ts new file mode 100644 index 00000000000..6a8e7f73d41 --- /dev/null +++ b/packages/google-cloud-monitoring/test/gapic_notification_channel_service_v3.ts @@ -0,0 +1,3626 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as notificationchannelserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3.NotificationChannelServiceClient', () => { + it('has servicePath', () => { + const servicePath = + notificationchannelserviceModule.v3.NotificationChannelServiceClient + .servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + notificationchannelserviceModule.v3.NotificationChannelServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + notificationchannelserviceModule.v3.NotificationChannelServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.notificationChannelServiceStub, undefined); + await client.initialize(); + assert(client.notificationChannelServiceStub); + }); + + it('has close method', () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getNotificationChannelDescriptor', () => { + it('invokes getNotificationChannelDescriptor without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ); + client.innerApiCalls.getNotificationChannelDescriptor = + stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationChannelDescriptor(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getNotificationChannelDescriptor without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ); + client.innerApiCalls.getNotificationChannelDescriptor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationChannelDescriptor( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannelDescriptor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getNotificationChannelDescriptor with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getNotificationChannelDescriptor(request), + expectedError + ); + assert( + (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getNotificationChannel', () => { + it('invokes getNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ); + client.innerApiCalls.getNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ); + client.innerApiCalls.getNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationChannel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getNotificationChannel(request), + expectedError + ); + assert( + (client.innerApiCalls.getNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createNotificationChannel', () => { + it('invokes createNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ); + client.innerApiCalls.createNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.createNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ); + client.innerApiCalls.createNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createNotificationChannel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createNotificationChannel(request), + expectedError + ); + assert( + (client.innerApiCalls.createNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateNotificationChannel', () => { + it('invokes updateNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateNotificationChannelRequest() + ); + request.notificationChannel = {}; + request.notificationChannel.name = ''; + const expectedHeaderRequestParams = 'notification_channel.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ); + client.innerApiCalls.updateNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.updateNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateNotificationChannelRequest() + ); + request.notificationChannel = {}; + request.notificationChannel.name = ''; + const expectedHeaderRequestParams = 'notification_channel.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ); + client.innerApiCalls.updateNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateNotificationChannelRequest() + ); + request.notificationChannel = {}; + request.notificationChannel.name = ''; + const expectedHeaderRequestParams = 'notification_channel.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNotificationChannel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateNotificationChannel(request), + expectedError + ); + assert( + (client.innerApiCalls.updateNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteNotificationChannel', () => { + it('invokes deleteNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNotificationChannel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteNotificationChannel(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('sendNotificationChannelVerificationCode', () => { + it('invokes sendNotificationChannelVerificationCode without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.sendNotificationChannelVerificationCode = + stubSimpleCall(expectedResponse); + const [response] = await client.sendNotificationChannelVerificationCode( + request + ); + assert.deepStrictEqual(response, expectedResponse); + assert( + ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes sendNotificationChannelVerificationCode without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.sendNotificationChannelVerificationCode = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.sendNotificationChannelVerificationCode( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes sendNotificationChannelVerificationCode with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.sendNotificationChannelVerificationCode = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.sendNotificationChannelVerificationCode(request), + expectedError + ); + assert( + ( + client.innerApiCalls + .sendNotificationChannelVerificationCode as SinonStub + ) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getNotificationChannelVerificationCode', () => { + it('invokes getNotificationChannelVerificationCode without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse() + ); + client.innerApiCalls.getNotificationChannelVerificationCode = + stubSimpleCall(expectedResponse); + const [response] = await client.getNotificationChannelVerificationCode( + request + ); + assert.deepStrictEqual(response, expectedResponse); + assert( + ( + client.innerApiCalls + .getNotificationChannelVerificationCode as SinonStub + ) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getNotificationChannelVerificationCode without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse() + ); + client.innerApiCalls.getNotificationChannelVerificationCode = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNotificationChannelVerificationCode( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + ( + client.innerApiCalls + .getNotificationChannelVerificationCode as SinonStub + ) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getNotificationChannelVerificationCode with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getNotificationChannelVerificationCode = + stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getNotificationChannelVerificationCode(request), + expectedError + ); + assert( + ( + client.innerApiCalls + .getNotificationChannelVerificationCode as SinonStub + ) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('verifyNotificationChannel', () => { + it('invokes verifyNotificationChannel without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.VerifyNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ); + client.innerApiCalls.verifyNotificationChannel = + stubSimpleCall(expectedResponse); + const [response] = await client.verifyNotificationChannel(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.verifyNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes verifyNotificationChannel without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.VerifyNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ); + client.innerApiCalls.verifyNotificationChannel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyNotificationChannel( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.verifyNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes verifyNotificationChannel with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.VerifyNotificationChannelRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyNotificationChannel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.verifyNotificationChannel(request), + expectedError + ); + assert( + (client.innerApiCalls.verifyNotificationChannel as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listNotificationChannelDescriptors', () => { + it('invokes listNotificationChannelDescriptors without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + ]; + client.innerApiCalls.listNotificationChannelDescriptors = + stubSimpleCall(expectedResponse); + const [response] = await client.listNotificationChannelDescriptors( + request + ); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listNotificationChannelDescriptors without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + ]; + client.innerApiCalls.listNotificationChannelDescriptors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotificationChannelDescriptors( + request, + ( + err?: Error | null, + result?: + | protos.google.monitoring.v3.INotificationChannelDescriptor[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listNotificationChannelDescriptors with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listNotificationChannelDescriptors(request), + expectedError + ); + assert( + (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listNotificationChannelDescriptorsStream without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + ]; + client.descriptors.page.listNotificationChannelDescriptors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNotificationChannelDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = + []; + stream.on( + 'data', + ( + response: protos.google.monitoring.v3.NotificationChannelDescriptor + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listNotificationChannelDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listNotificationChannelDescriptors, + request + ) + ); + assert.strictEqual( + ( + client.descriptors.page.listNotificationChannelDescriptors + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listNotificationChannelDescriptorsStream with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationChannelDescriptors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotificationChannelDescriptorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = + []; + stream.on( + 'data', + ( + response: protos.google.monitoring.v3.NotificationChannelDescriptor + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listNotificationChannelDescriptors + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listNotificationChannelDescriptors, + request + ) + ); + assert.strictEqual( + ( + client.descriptors.page.listNotificationChannelDescriptors + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNotificationChannelDescriptors without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannelDescriptor() + ), + ]; + client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = + []; + const iterable = client.listNotificationChannelDescriptorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listNotificationChannelDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listNotificationChannelDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNotificationChannelDescriptors with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotificationChannelDescriptorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listNotificationChannelDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listNotificationChannelDescriptors + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listNotificationChannels', () => { + it('invokes listNotificationChannels without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + ]; + client.innerApiCalls.listNotificationChannels = + stubSimpleCall(expectedResponse); + const [response] = await client.listNotificationChannels(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listNotificationChannels as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listNotificationChannels without error using callback', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + ]; + client.innerApiCalls.listNotificationChannels = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNotificationChannels( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.INotificationChannel[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listNotificationChannels as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listNotificationChannels with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listNotificationChannels = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listNotificationChannels(request), + expectedError + ); + assert( + (client.innerApiCalls.listNotificationChannels as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listNotificationChannelsStream without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + ]; + client.descriptors.page.listNotificationChannels.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNotificationChannelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.NotificationChannel[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.NotificationChannel) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listNotificationChannels + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listNotificationChannels, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listNotificationChannels + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listNotificationChannelsStream with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationChannels.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listNotificationChannelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.NotificationChannel[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.NotificationChannel) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listNotificationChannels + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listNotificationChannels, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listNotificationChannels + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNotificationChannels without error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + generateSampleMessage( + new protos.google.monitoring.v3.NotificationChannel() + ), + ]; + client.descriptors.page.listNotificationChannels.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.INotificationChannel[] = []; + const iterable = client.listNotificationChannelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listNotificationChannels + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listNotificationChannels + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listNotificationChannels with error', async () => { + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListNotificationChannelsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.listNotificationChannels.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNotificationChannelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.INotificationChannel[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listNotificationChannels + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listNotificationChannels + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderAlertPolicyCondition', () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderChannelDescriptor', () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderGroup', () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderNotificationChannel', () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderService', () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderUptimeCheckConfig', () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicy', () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicyCondition', () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationChannelDescriptor', () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationGroup', () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationNotificationChannel', () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationService', () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationServiceServiceLevelObjective', () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationUptimeCheckConfig', () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicy', () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicyCondition', () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectChannelDescriptor', () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectGroup', () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectNotificationChannel', () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectService', () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectUptimeCheckConfig', () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new notificationchannelserviceModule.v3.NotificationChannelServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-monitoring/test/gapic_query_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_query_service_v3.ts new file mode 100644 index 00000000000..93db4341d2d --- /dev/null +++ b/packages/google-cloud-monitoring/test/gapic_query_service_v3.ts @@ -0,0 +1,2067 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 queryserviceModule 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('v3.QueryServiceClient', () => { + it('has servicePath', () => { + const servicePath = queryserviceModule.v3.QueryServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = queryserviceModule.v3.QueryServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = queryserviceModule.v3.QueryServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new queryserviceModule.v3.QueryServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.queryServiceStub, undefined); + await client.initialize(); + assert(client.queryServiceStub); + }); + + it('has close method', () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new queryserviceModule.v3.QueryServiceClient({ + 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 queryserviceModule.v3.QueryServiceClient({ + 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('queryTimeSeries', () => { + it('invokes queryTimeSeries without error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + ]; + client.innerApiCalls.queryTimeSeries = stubSimpleCall(expectedResponse); + const [response] = await client.queryTimeSeries(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.queryTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes queryTimeSeries without error using callback', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + ]; + client.innerApiCalls.queryTimeSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.queryTimeSeries( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.ITimeSeriesData[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.queryTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes queryTimeSeries with error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.queryTimeSeries = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.queryTimeSeries(request), expectedError); + assert( + (client.innerApiCalls.queryTimeSeries as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes queryTimeSeriesStream without error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + ]; + client.descriptors.page.queryTimeSeries.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.queryTimeSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.TimeSeriesData[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.TimeSeriesData) => { + 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.queryTimeSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.queryTimeSeries, request) + ); + assert.strictEqual( + ( + client.descriptors.page.queryTimeSeries.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes queryTimeSeriesStream with error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.queryTimeSeries.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.queryTimeSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.TimeSeriesData[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.TimeSeriesData) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.queryTimeSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.queryTimeSeries, request) + ); + assert.strictEqual( + ( + client.descriptors.page.queryTimeSeries.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with queryTimeSeries without error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + generateSampleMessage(new protos.google.monitoring.v3.TimeSeriesData()), + ]; + client.descriptors.page.queryTimeSeries.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.ITimeSeriesData[] = []; + const iterable = client.queryTimeSeriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with queryTimeSeries with error', async () => { + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.QueryTimeSeriesRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.descriptors.page.queryTimeSeries.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.queryTimeSeriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.ITimeSeriesData[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.queryTimeSeries.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderAlertPolicyCondition', () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderChannelDescriptor', () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderGroup', () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderNotificationChannel', () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderService', () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderUptimeCheckConfig', () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicy', () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicyCondition', () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationChannelDescriptor', () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationGroup', () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationNotificationChannel', () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationService', () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationServiceServiceLevelObjective', () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationUptimeCheckConfig', () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicy', () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicyCondition', () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectChannelDescriptor', () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectGroup', () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectNotificationChannel', () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectService', () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectUptimeCheckConfig', () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new queryserviceModule.v3.QueryServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-monitoring/test/gapic_service_monitoring_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_service_monitoring_service_v3.ts new file mode 100644 index 00000000000..7d99c191a16 --- /dev/null +++ b/packages/google-cloud-monitoring/test/gapic_service_monitoring_service_v3.ts @@ -0,0 +1,3410 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as servicemonitoringserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3.ServiceMonitoringServiceClient', () => { + it('has servicePath', () => { + const servicePath = + servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient + .servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient + .apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.serviceMonitoringServiceStub, undefined); + await client.initialize(); + assert(client.serviceMonitoringServiceStub); + }); + + it('has close method', () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('createService', () => { + it('invokes createService without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service() + ); + client.innerApiCalls.createService = stubSimpleCall(expectedResponse); + const [response] = await client.createService(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createService without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service() + ); + client.innerApiCalls.createService = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createService( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IService | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createService with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createService = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createService(request), expectedError); + assert( + (client.innerApiCalls.createService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getService', () => { + it('invokes getService without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service() + ); + client.innerApiCalls.getService = stubSimpleCall(expectedResponse); + const [response] = await client.getService(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getService without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service() + ); + client.innerApiCalls.getService = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getService( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IService | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getService with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getService = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getService(request), expectedError); + assert( + (client.innerApiCalls.getService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateService', () => { + it('invokes updateService without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceRequest() + ); + request.service = {}; + request.service.name = ''; + const expectedHeaderRequestParams = 'service.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service() + ); + client.innerApiCalls.updateService = stubSimpleCall(expectedResponse); + const [response] = await client.updateService(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateService without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceRequest() + ); + request.service = {}; + request.service.name = ''; + const expectedHeaderRequestParams = 'service.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.Service() + ); + client.innerApiCalls.updateService = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateService( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IService | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateService with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceRequest() + ); + request.service = {}; + request.service.name = ''; + const expectedHeaderRequestParams = 'service.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateService = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateService(request), expectedError); + assert( + (client.innerApiCalls.updateService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteService', () => { + it('invokes deleteService without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteService = stubSimpleCall(expectedResponse); + const [response] = await client.deleteService(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteService without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteService = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteService( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteService with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteService = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteService(request), expectedError); + assert( + (client.innerApiCalls.deleteService as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createServiceLevelObjective', () => { + it('invokes createServiceLevelObjective without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ); + client.innerApiCalls.createServiceLevelObjective = + stubSimpleCall(expectedResponse); + const [response] = await client.createServiceLevelObjective(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createServiceLevelObjective without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ); + client.innerApiCalls.createServiceLevelObjective = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createServiceLevelObjective( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IServiceLevelObjective | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createServiceLevelObjective with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createServiceLevelObjective = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createServiceLevelObjective(request), + expectedError + ); + assert( + (client.innerApiCalls.createServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('getServiceLevelObjective', () => { + it('invokes getServiceLevelObjective without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ); + client.innerApiCalls.getServiceLevelObjective = + stubSimpleCall(expectedResponse); + const [response] = await client.getServiceLevelObjective(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getServiceLevelObjective without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ); + client.innerApiCalls.getServiceLevelObjective = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getServiceLevelObjective( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IServiceLevelObjective | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getServiceLevelObjective with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getServiceLevelObjective = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getServiceLevelObjective(request), + expectedError + ); + assert( + (client.innerApiCalls.getServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateServiceLevelObjective', () => { + it('invokes updateServiceLevelObjective without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() + ); + request.serviceLevelObjective = {}; + request.serviceLevelObjective.name = ''; + const expectedHeaderRequestParams = 'service_level_objective.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ); + client.innerApiCalls.updateServiceLevelObjective = + stubSimpleCall(expectedResponse); + const [response] = await client.updateServiceLevelObjective(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateServiceLevelObjective without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() + ); + request.serviceLevelObjective = {}; + request.serviceLevelObjective.name = ''; + const expectedHeaderRequestParams = 'service_level_objective.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ); + client.innerApiCalls.updateServiceLevelObjective = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateServiceLevelObjective( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IServiceLevelObjective | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateServiceLevelObjective with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() + ); + request.serviceLevelObjective = {}; + request.serviceLevelObjective.name = ''; + const expectedHeaderRequestParams = 'service_level_objective.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateServiceLevelObjective = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateServiceLevelObjective(request), + expectedError + ); + assert( + (client.innerApiCalls.updateServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteServiceLevelObjective', () => { + it('invokes deleteServiceLevelObjective without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteServiceLevelObjective = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteServiceLevelObjective(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteServiceLevelObjective without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteServiceLevelObjective = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteServiceLevelObjective( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteServiceLevelObjective with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteServiceLevelObjective(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listServices', () => { + it('invokes listServices without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + ]; + client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); + const [response] = await client.listServices(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServices as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServices without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + ]; + client.innerApiCalls.listServices = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServices( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IService[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServices as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listServices with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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 () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + ]; + client.descriptors.page.listServices.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Service[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServices, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServices.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listServicesStream with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listServicesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.Service[] = []; + stream.on('data', (response: protos.google.monitoring.v3.Service) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listServices.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listServices, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServices.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServices without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + generateSampleMessage(new protos.google.monitoring.v3.Service()), + ]; + client.descriptors.page.listServices.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IService[] = []; + const iterable = client.listServicesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServices with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServicesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServices.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServicesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IService[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServices.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listServiceLevelObjectives', () => { + it('invokes listServiceLevelObjectives without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + ]; + client.innerApiCalls.listServiceLevelObjectives = + stubSimpleCall(expectedResponse); + const [response] = await client.listServiceLevelObjectives(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServiceLevelObjectives as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServiceLevelObjectives without error using callback', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + ]; + client.innerApiCalls.listServiceLevelObjectives = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServiceLevelObjectives( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IServiceLevelObjective[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listServiceLevelObjectives as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listServiceLevelObjectives with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listServiceLevelObjectives = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listServiceLevelObjectives(request), + expectedError + ); + assert( + (client.innerApiCalls.listServiceLevelObjectives as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listServiceLevelObjectivesStream without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + ]; + client.descriptors.page.listServiceLevelObjectives.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listServiceLevelObjectivesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = + []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.ServiceLevelObjective) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listServiceLevelObjectives + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServiceLevelObjectives, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServiceLevelObjectives + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listServiceLevelObjectivesStream with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServiceLevelObjectives.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listServiceLevelObjectivesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = + []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.ServiceLevelObjective) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listServiceLevelObjectives + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listServiceLevelObjectives, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listServiceLevelObjectives + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServiceLevelObjectives without error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + generateSampleMessage( + new protos.google.monitoring.v3.ServiceLevelObjective() + ), + ]; + client.descriptors.page.listServiceLevelObjectives.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = + []; + const iterable = client.listServiceLevelObjectivesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listServiceLevelObjectives + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServiceLevelObjectives + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listServiceLevelObjectives with error', async () => { + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listServiceLevelObjectives.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listServiceLevelObjectivesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listServiceLevelObjectives + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listServiceLevelObjectives + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderAlertPolicyCondition', () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderChannelDescriptor', () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderGroup', () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderNotificationChannel', () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderService', () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderUptimeCheckConfig', () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicy', () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicyCondition', () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationChannelDescriptor', () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationGroup', () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationNotificationChannel', () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationService', () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationServiceServiceLevelObjective', () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationUptimeCheckConfig', () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicy', () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicyCondition', () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectChannelDescriptor', () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectGroup', () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectNotificationChannel', () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectService', () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectUptimeCheckConfig', () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = + new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-monitoring/test/gapic_uptime_check_service_v3.ts b/packages/google-cloud-monitoring/test/gapic_uptime_check_service_v3.ts new file mode 100644 index 00000000000..3c0de536ba0 --- /dev/null +++ b/packages/google-cloud-monitoring/test/gapic_uptime_check_service_v3.ts @@ -0,0 +1,2833 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as uptimecheckserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v3.UptimeCheckServiceClient', () => { + it('has servicePath', () => { + const servicePath = + uptimecheckserviceModule.v3.UptimeCheckServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + uptimecheckserviceModule.v3.UptimeCheckServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = uptimecheckserviceModule.v3.UptimeCheckServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.uptimeCheckServiceStub, undefined); + await client.initialize(); + assert(client.uptimeCheckServiceStub); + }); + + it('has close method', () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + + describe('getUptimeCheckConfig', () => { + it('invokes getUptimeCheckConfig without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ); + client.innerApiCalls.getUptimeCheckConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getUptimeCheckConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes getUptimeCheckConfig without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ); + client.innerApiCalls.getUptimeCheckConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getUptimeCheckConfig( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes getUptimeCheckConfig with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getUptimeCheckConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getUptimeCheckConfig(request), expectedError); + assert( + (client.innerApiCalls.getUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('createUptimeCheckConfig', () => { + it('invokes createUptimeCheckConfig without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ); + client.innerApiCalls.createUptimeCheckConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.createUptimeCheckConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createUptimeCheckConfig without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ); + client.innerApiCalls.createUptimeCheckConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createUptimeCheckConfig( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createUptimeCheckConfig with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createUptimeCheckConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createUptimeCheckConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.createUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('updateUptimeCheckConfig', () => { + it('invokes updateUptimeCheckConfig without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() + ); + request.uptimeCheckConfig = {}; + request.uptimeCheckConfig.name = ''; + const expectedHeaderRequestParams = 'uptime_check_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ); + client.innerApiCalls.updateUptimeCheckConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateUptimeCheckConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes updateUptimeCheckConfig without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() + ); + request.uptimeCheckConfig = {}; + request.uptimeCheckConfig.name = ''; + const expectedHeaderRequestParams = 'uptime_check_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ); + client.innerApiCalls.updateUptimeCheckConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateUptimeCheckConfig( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckConfig | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes updateUptimeCheckConfig with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() + ); + request.uptimeCheckConfig = {}; + request.uptimeCheckConfig.name = ''; + const expectedHeaderRequestParams = 'uptime_check_config.name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateUptimeCheckConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('deleteUptimeCheckConfig', () => { + it('invokes deleteUptimeCheckConfig without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteUptimeCheckConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteUptimeCheckConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteUptimeCheckConfig without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteUptimeCheckConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteUptimeCheckConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteUptimeCheckConfig with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteUptimeCheckConfig(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + + describe('listUptimeCheckConfigs', () => { + it('invokes listUptimeCheckConfigs without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + ]; + client.innerApiCalls.listUptimeCheckConfigs = + stubSimpleCall(expectedResponse); + const [response] = await client.listUptimeCheckConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listUptimeCheckConfigs without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + ]; + client.innerApiCalls.listUptimeCheckConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUptimeCheckConfigs( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckConfig[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listUptimeCheckConfigs with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listUptimeCheckConfigs(request), + expectedError + ); + assert( + (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listUptimeCheckConfigsStream without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + ]; + client.descriptors.page.listUptimeCheckConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listUptimeCheckConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.UptimeCheckConfig) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listUptimeCheckConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listUptimeCheckConfigs, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listUptimeCheckConfigs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listUptimeCheckConfigsStream with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listUptimeCheckConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listUptimeCheckConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.UptimeCheckConfig) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listUptimeCheckConfigs + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listUptimeCheckConfigs, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listUptimeCheckConfigs + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listUptimeCheckConfigs without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + generateSampleMessage( + new protos.google.monitoring.v3.UptimeCheckConfig() + ), + ]; + client.descriptors.page.listUptimeCheckConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; + const iterable = client.listUptimeCheckConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listUptimeCheckConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listUptimeCheckConfigs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listUptimeCheckConfigs with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listUptimeCheckConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUptimeCheckConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listUptimeCheckConfigs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listUptimeCheckConfigs + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listUptimeCheckIps', () => { + it('invokes listUptimeCheckIps without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + ]; + client.innerApiCalls.listUptimeCheckIps = + stubSimpleCall(expectedResponse); + const [response] = await client.listUptimeCheckIps(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listUptimeCheckIps as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listUptimeCheckIps without error using callback', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() + ); + const expectedOptions = {}; + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + ]; + client.innerApiCalls.listUptimeCheckIps = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUptimeCheckIps( + request, + ( + err?: Error | null, + result?: protos.google.monitoring.v3.IUptimeCheckIp[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listUptimeCheckIps as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listUptimeCheckIps with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() + ); + const expectedOptions = {}; + const expectedError = new Error('expected'); + client.innerApiCalls.listUptimeCheckIps = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listUptimeCheckIps(request), expectedError); + assert( + (client.innerApiCalls.listUptimeCheckIps as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listUptimeCheckIpsStream without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + ]; + client.descriptors.page.listUptimeCheckIps.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listUptimeCheckIpsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.UptimeCheckIp) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listUptimeCheckIps, request) + ); + }); + + it('invokes listUptimeCheckIpsStream with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listUptimeCheckIps.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listUptimeCheckIpsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; + stream.on( + 'data', + (response: protos.google.monitoring.v3.UptimeCheckIp) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listUptimeCheckIps, request) + ); + }); + + it('uses async iteration with listUptimeCheckIps without error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() + ); + const expectedResponse = [ + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), + ]; + client.descriptors.page.listUptimeCheckIps.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; + const iterable = client.listUptimeCheckIpsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + + it('uses async iteration with listUptimeCheckIps with error', async () => { + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() + ); + const expectedError = new Error('expected'); + client.descriptors.page.listUptimeCheckIps.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUptimeCheckIpsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('folderAlertPolicy', () => { + const fakePath = '/rendered/path/folderAlertPolicy'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyPath', () => { + const result = client.folderAlertPolicyPath( + 'folderValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyName', () => { + const result = client.matchFolderFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderAlertPolicyCondition', () => { + const fakePath = '/rendered/path/folderAlertPolicyCondition'; + const expectedParameters = { + folder: 'folderValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderAlertPolicyConditionPath', () => { + const result = client.folderAlertPolicyConditionPath( + 'folderValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderAlertPolicyConditionName', () => { + const result = + client.matchFolderFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromFolderAlertPolicyConditionName', () => { + const result = + client.matchConditionFromFolderAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.folderAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderChannelDescriptor', () => { + const fakePath = '/rendered/path/folderChannelDescriptor'; + const expectedParameters = { + folder: 'folderValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderChannelDescriptorPath', () => { + const result = client.folderChannelDescriptorPath( + 'folderValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderChannelDescriptorName', () => { + const result = + client.matchFolderFromFolderChannelDescriptorName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromFolderChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.folderChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderGroup', () => { + const fakePath = '/rendered/path/folderGroup'; + const expectedParameters = { + folder: 'folderValue', + group: 'groupValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderGroupPath', () => { + const result = client.folderGroupPath('folderValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderGroupName', () => { + const result = client.matchFolderFromFolderGroupName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromFolderGroupName', () => { + const result = client.matchGroupFromFolderGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.folderGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderNotificationChannel', () => { + const fakePath = '/rendered/path/folderNotificationChannel'; + const expectedParameters = { + folder: 'folderValue', + notification_channel: 'notificationChannelValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderNotificationChannelPath', () => { + const result = client.folderNotificationChannelPath( + 'folderValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderNotificationChannelName', () => { + const result = + client.matchFolderFromFolderNotificationChannelName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromFolderNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromFolderNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.folderNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderService', () => { + const fakePath = '/rendered/path/folderService'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderServicePath', () => { + const result = client.folderServicePath('folderValue', 'serviceValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.folderServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceName', () => { + const result = client.matchFolderFromFolderServiceName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceName', () => { + const result = client.matchServiceFromFolderServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.folderServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/folderServiceServiceLevelObjective'; + const expectedParameters = { + folder: 'folderValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderServiceServiceLevelObjectivePath', () => { + const result = client.folderServiceServiceLevelObjectivePath( + 'folderValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchFolderFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('folderUptimeCheckConfig', () => { + const fakePath = '/rendered/path/folderUptimeCheckConfig'; + const expectedParameters = { + folder: 'folderValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('folderUptimeCheckConfigPath', () => { + const result = client.folderUptimeCheckConfigPath( + 'folderValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchFolderFromFolderUptimeCheckConfigName', () => { + const result = + client.matchFolderFromFolderUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'folderValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.folderUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicy', () => { + const fakePath = '/rendered/path/organizationAlertPolicy'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationAlertPolicyPath', () => { + const result = client.organizationAlertPolicyPath( + 'organizationValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationAlertPolicyCondition', () => { + const fakePath = '/rendered/path/organizationAlertPolicyCondition'; + const expectedParameters = { + organization: 'organizationValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationAlertPolicyConditionPath', () => { + const result = client.organizationAlertPolicyConditionPath( + 'organizationValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchOrganizationFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromOrganizationAlertPolicyConditionName', () => { + const result = + client.matchConditionFromOrganizationAlertPolicyConditionName( + fakePath + ); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.organizationAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationChannelDescriptor', () => { + const fakePath = '/rendered/path/organizationChannelDescriptor'; + const expectedParameters = { + organization: 'organizationValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationChannelDescriptorPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationChannelDescriptorPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationChannelDescriptorPath', () => { + const result = client.organizationChannelDescriptorPath( + 'organizationValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationChannelDescriptorName', () => { + const result = + client.matchOrganizationFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromOrganizationChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.organizationChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationGroup', () => { + const fakePath = '/rendered/path/organizationGroup'; + const expectedParameters = { + organization: 'organizationValue', + group: 'groupValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationGroupPath', () => { + const result = client.organizationGroupPath( + 'organizationValue', + 'groupValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationGroupName', () => { + const result = + client.matchOrganizationFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromOrganizationGroupName', () => { + const result = client.matchGroupFromOrganizationGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + ( + client.pathTemplates.organizationGroupPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationNotificationChannel', () => { + const fakePath = '/rendered/path/organizationNotificationChannel'; + const expectedParameters = { + organization: 'organizationValue', + notification_channel: 'notificationChannelValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationNotificationChannelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationNotificationChannelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationNotificationChannelPath', () => { + const result = client.organizationNotificationChannelPath( + 'organizationValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationNotificationChannelName', () => { + const result = + client.matchOrganizationFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromOrganizationNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.organizationNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationService', () => { + const fakePath = '/rendered/path/organizationService'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.organizationServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('organizationServicePath', () => { + const result = client.organizationServicePath( + 'organizationValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceName', () => { + const result = + client.matchOrganizationFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceName', () => { + const result = client.matchServiceFromOrganizationServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.organizationServicePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationServiceServiceLevelObjective', () => { + const fakePath = + '/rendered/path/organizationServiceServiceLevelObjective'; + const expectedParameters = { + organization: 'organizationValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationServiceServiceLevelObjectivePath', () => { + const result = client.organizationServiceServiceLevelObjectivePath( + 'organizationValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates + .organizationServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('organizationUptimeCheckConfig', () => { + const fakePath = '/rendered/path/organizationUptimeCheckConfig'; + const expectedParameters = { + organization: 'organizationValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationUptimeCheckConfigPath', () => { + const result = client.organizationUptimeCheckConfigPath( + 'organizationValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchOrganizationFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'organizationValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.organizationUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicy', () => { + const fakePath = '/rendered/path/projectAlertPolicy'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAlertPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyPath', () => { + const result = client.projectAlertPolicyPath( + 'projectValue', + 'alertPolicyValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyName', () => { + const result = client.matchProjectFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAlertPolicyCondition', () => { + const fakePath = '/rendered/path/projectAlertPolicyCondition'; + const expectedParameters = { + project: 'projectValue', + alert_policy: 'alertPolicyValue', + condition: 'conditionValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAlertPolicyConditionPath', () => { + const result = client.projectAlertPolicyConditionPath( + 'projectValue', + 'alertPolicyValue', + 'conditionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAlertPolicyConditionName', () => { + const result = + client.matchProjectFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { + const result = + client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'alertPolicyValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConditionFromProjectAlertPolicyConditionName', () => { + const result = + client.matchConditionFromProjectAlertPolicyConditionName(fakePath); + assert.strictEqual(result, 'conditionValue'); + assert( + ( + client.pathTemplates.projectAlertPolicyConditionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectChannelDescriptor', () => { + const fakePath = '/rendered/path/projectChannelDescriptor'; + const expectedParameters = { + project: 'projectValue', + channel_descriptor: 'channelDescriptorValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectChannelDescriptorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectChannelDescriptorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectChannelDescriptorPath', () => { + const result = client.projectChannelDescriptorPath( + 'projectValue', + 'channelDescriptorValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectChannelDescriptorName', () => { + const result = + client.matchProjectFromProjectChannelDescriptorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { + const result = + client.matchChannelDescriptorFromProjectChannelDescriptorName( + fakePath + ); + assert.strictEqual(result, 'channelDescriptorValue'); + assert( + ( + client.pathTemplates.projectChannelDescriptorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectGroup', () => { + const fakePath = '/rendered/path/projectGroup'; + const expectedParameters = { + project: 'projectValue', + group: 'groupValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectGroupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectGroupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectGroupPath', () => { + const result = client.projectGroupPath('projectValue', 'groupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectGroupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectGroupName', () => { + const result = client.matchProjectFromProjectGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchGroupFromProjectGroupName', () => { + const result = client.matchGroupFromProjectGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.projectGroupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectNotificationChannel', () => { + const fakePath = '/rendered/path/projectNotificationChannel'; + const expectedParameters = { + project: 'projectValue', + notification_channel: 'notificationChannelValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectNotificationChannelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectNotificationChannelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectNotificationChannelPath', () => { + const result = client.projectNotificationChannelPath( + 'projectValue', + 'notificationChannelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectNotificationChannelName', () => { + const result = + client.matchProjectFromProjectNotificationChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchNotificationChannelFromProjectNotificationChannelName', () => { + const result = + client.matchNotificationChannelFromProjectNotificationChannelName( + fakePath + ); + assert.strictEqual(result, 'notificationChannelValue'); + assert( + ( + client.pathTemplates.projectNotificationChannelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectService', () => { + const fakePath = '/rendered/path/projectService'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServicePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectServicePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectServicePath', () => { + const result = client.projectServicePath( + 'projectValue', + 'serviceValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectServicePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceName', () => { + const result = client.matchProjectFromProjectServiceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceName', () => { + const result = client.matchServiceFromProjectServiceName(fakePath); + assert.strictEqual(result, 'serviceValue'); + assert( + (client.pathTemplates.projectServicePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectServiceServiceLevelObjective', () => { + const fakePath = '/rendered/path/projectServiceServiceLevelObjective'; + const expectedParameters = { + project: 'projectValue', + service: 'serviceValue', + service_level_objective: 'serviceLevelObjectiveValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectServiceServiceLevelObjectivePath', () => { + const result = client.projectServiceServiceLevelObjectivePath( + 'projectValue', + 'serviceValue', + 'serviceLevelObjectiveValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchProjectFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { + const result = + client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName( + fakePath + ); + assert.strictEqual(result, 'serviceLevelObjectiveValue'); + assert( + ( + client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectUptimeCheckConfig', () => { + const fakePath = '/rendered/path/projectUptimeCheckConfig'; + const expectedParameters = { + project: 'projectValue', + uptime_check_config: 'uptimeCheckConfigValue', + }; + const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectUptimeCheckConfigPath', () => { + const result = client.projectUptimeCheckConfigPath( + 'projectValue', + 'uptimeCheckConfigValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectUptimeCheckConfigName', () => { + const result = + client.matchProjectFromProjectUptimeCheckConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { + const result = + client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName( + fakePath + ); + assert.strictEqual(result, 'uptimeCheckConfigValue'); + assert( + ( + client.pathTemplates.projectUptimeCheckConfigPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-monitoring/tsconfig.json b/packages/google-cloud-monitoring/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/packages/google-cloud-monitoring/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/packages/google-cloud-monitoring/webpack.config.js b/packages/google-cloud-monitoring/webpack.config.js new file mode 100644 index 00000000000..e6c0bc651fe --- /dev/null +++ b/packages/google-cloud-monitoring/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'monitoring', + filename: './monitoring.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/, + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader', + }, + ], + }, + mode: 'production', +}; diff --git a/release-please-config.json b/release-please-config.json index 065edc12bd5..ca8fb90627b 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -23,6 +23,7 @@ "packages/google-cloud-gkemulticloud": {}, "packages/google-cloud-language": {}, "packages/google-cloud-memcache": {}, + "packages/google-cloud-monitoring": {}, "packages/google-cloud-oslogin": {}, "packages/google-cloud-phishingprotection": {}, "packages/google-cloud-policytroubleshooter": {},