diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d68c0bd4397..16c6eb41325 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -52,6 +52,7 @@ "packages/google-cloud-gkeconnect-gateway": "2.0.5", "packages/google-cloud-gkehub": "3.2.2", "packages/google-cloud-gkemulticloud": "0.1.4", + "packages/google-cloud-kms": "3.1.0", "packages/google-cloud-ids": "2.1.2", "packages/google-cloud-iap": "2.0.3", "packages/google-cloud-iot": "3.1.2", diff --git a/packages/google-cloud-kms/.OwlBot.yaml b/packages/google-cloud-kms/.OwlBot.yaml new file mode 100644 index 00000000000..a4354f061a2 --- /dev/null +++ b/packages/google-cloud-kms/.OwlBot.yaml @@ -0,0 +1,21 @@ +# 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/kms/(.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-kms/$1 + diff --git a/packages/google-cloud-kms/.eslintignore b/packages/google-cloud-kms/.eslintignore new file mode 100644 index 00000000000..ea5b04aebe6 --- /dev/null +++ b/packages/google-cloud-kms/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ +samples/generated/ diff --git a/packages/google-cloud-kms/.eslintrc.json b/packages/google-cloud-kms/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-kms/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-kms/.gitattributes b/packages/google-cloud-kms/.gitattributes new file mode 100644 index 00000000000..33739cb74e4 --- /dev/null +++ b/packages/google-cloud-kms/.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-kms/.gitignore b/packages/google-cloud-kms/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-kms/.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-kms/.jsdoc.js b/packages/google-cloud-kms/.jsdoc.js new file mode 100644 index 00000000000..36bbc77bc9a --- /dev/null +++ b/packages/google-cloud-kms/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/kms', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-kms/.mocharc.js b/packages/google-cloud-kms/.mocharc.js new file mode 100644 index 00000000000..cdb7b752160 --- /dev/null +++ b/packages/google-cloud-kms/.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-kms/.nycrc b/packages/google-cloud-kms/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /dev/null +++ b/packages/google-cloud-kms/.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-kms/.prettierignore b/packages/google-cloud-kms/.prettierignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-kms/.prettierignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-kms/.prettierrc.js b/packages/google-cloud-kms/.prettierrc.js new file mode 100644 index 00000000000..d546a4ad546 --- /dev/null +++ b/packages/google-cloud-kms/.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-kms/.repo-metadata.json b/packages/google-cloud-kms/.repo-metadata.json new file mode 100644 index 00000000000..7dc132eb95a --- /dev/null +++ b/packages/google-cloud-kms/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/kms/latest", + "api_id": "kms.googleapis.com", + "distribution_name": "@google-cloud/kms", + "release_level": "stable", + "default_version": "v1", + "language": "nodejs", + "name_pretty": "Google Cloud Key Management Service", + "repo": "googleapis/google-cloud-node", + "product_documentation": "https://cloud.google.com/kms", + "requires_billing": true, + "name": "kms", + "issue_tracker": "https://issuetracker.google.com/savedsearches/5264932", + "codeowner_team": "@googleapis/api-kms", + "api_shortname": "cloudkms", + "library_type": "GAPIC_AUTO" +} diff --git a/packages/google-cloud-kms/CHANGELOG.md b/packages/google-cloud-kms/CHANGELOG.md new file mode 100644 index 00000000000..99bdea4fb3e --- /dev/null +++ b/packages/google-cloud-kms/CHANGELOG.md @@ -0,0 +1,500 @@ +# Changelog + +[npm history][1] + +[1]: https://www.npmjs.com/package/@google-cloud/kms?activeTab=versions + +## [3.1.0](https://github.com/googleapis/nodejs-kms/compare/v3.0.1...v3.1.0) (2022-11-11) + + +### Features + +* **kms:** Enable generation of Locations mixin ([#578](https://github.com/googleapis/nodejs-kms/issues/578)) ([5205ddc](https://github.com/googleapis/nodejs-kms/commit/5205ddc20daa79b1d39b89e2c7ea7063a4f5d93e)) + + +### Bug Fixes + +* Allow passing gax instance to client constructor ([#570](https://github.com/googleapis/nodejs-kms/issues/570)) ([1072346](https://github.com/googleapis/nodejs-kms/commit/1072346f45496885a6cba33dbb5e72f500661656)) +* Better support for fallback mode ([#565](https://github.com/googleapis/nodejs-kms/issues/565)) ([ebb7caf](https://github.com/googleapis/nodejs-kms/commit/ebb7caf95716814af6e1f3d0b423f68dba289593)) +* Change import long to require ([#566](https://github.com/googleapis/nodejs-kms/issues/566)) ([ac44194](https://github.com/googleapis/nodejs-kms/commit/ac4419470711d19d30811e3ff88659e0484ce38d)) +* **deps:** Use google-gax v3.5.2 ([#581](https://github.com/googleapis/nodejs-kms/issues/581)) ([54c26f3](https://github.com/googleapis/nodejs-kms/commit/54c26f3f97c1e65ee2cc3f85cfed9c8a4b974432)) +* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-kms/issues/1553)) ([#569](https://github.com/googleapis/nodejs-kms/issues/569)) ([c981d1a](https://github.com/googleapis/nodejs-kms/commit/c981d1a423c86a86b2b0ca47f09cedf26be1f28a)) +* Preserve default values in x-goog-request-params header ([#573](https://github.com/googleapis/nodejs-kms/issues/573)) ([2ab539d](https://github.com/googleapis/nodejs-kms/commit/2ab539dd02674f010c10e6933da8d06da0e983b5)) +* Remove pip install statements ([#1546](https://github.com/googleapis/nodejs-kms/issues/1546)) ([#568](https://github.com/googleapis/nodejs-kms/issues/568)) ([e704093](https://github.com/googleapis/nodejs-kms/commit/e704093f79aefe6706bae5b62e78525705366fe6)) +* use google-gax v3.3.0 ([c981d1a](https://github.com/googleapis/nodejs-kms/commit/c981d1a423c86a86b2b0ca47f09cedf26be1f28a)) + +## [3.0.1](https://github.com/googleapis/nodejs-kms/compare/v3.0.0...v3.0.1) (2022-06-30) + + +### Bug Fixes + +* **docs:** document fallback rest option ([#561](https://github.com/googleapis/nodejs-kms/issues/561)) ([df8b28f](https://github.com/googleapis/nodejs-kms/commit/df8b28ff9db20a089bbf730038e4051f89f5c4dd)) + +## [3.0.0](https://github.com/googleapis/nodejs-kms/compare/v2.11.1...v3.0.0) (2022-05-20) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#556) + +### Build System + +* update library to use Node 12 ([#556](https://github.com/googleapis/nodejs-kms/issues/556)) ([c53f95a](https://github.com/googleapis/nodejs-kms/commit/c53f95abfed91cda76ed480806d38ea77a98aad5)) + +### [2.11.1](https://github.com/googleapis/nodejs-kms/compare/v2.11.0...v2.11.1) (2022-04-08) + + +### Bug Fixes + +* **docs:** document that fast-crc32c must be installed ([#546](https://github.com/googleapis/nodejs-kms/issues/546)) ([57253bb](https://github.com/googleapis/nodejs-kms/commit/57253bb85e91d8d1273cea9ec170a910247b61ab)) + +## [2.11.0](https://github.com/googleapis/nodejs-kms/compare/v2.10.0...v2.11.0) (2022-02-03) + + +### Features + +* add a new EkmService API ([#532](https://github.com/googleapis/nodejs-kms/issues/532)) ([f62a19c](https://github.com/googleapis/nodejs-kms/commit/f62a19ca3944a48e981cee17415f5b5456a7054a)) + +## [2.10.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.9.0...v2.10.0) (2021-10-19) + + +### Features + +* add support for Raw PKCS[#1](https://www.github.com/googleapis/nodejs-kms/issues/1) signing keys ([#509](https://www.github.com/googleapis/nodejs-kms/issues/509)) ([3dfb35d](https://www.github.com/googleapis/nodejs-kms/commit/3dfb35dbe8847d8fbc0635a624e6deff7830d547)) + +## [2.9.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.8.1...v2.9.0) (2021-10-14) + + +### Features + +* add OAEP+SHA1 to the list of supported algorithms ([#503](https://www.github.com/googleapis/nodejs-kms/issues/503)) ([00cc42e](https://www.github.com/googleapis/nodejs-kms/commit/00cc42ed9a30650fc88d27c8205e08bb305dd0f8)) +* add RPC retry information for MacSign, MacVerify, and GenerateRandomBytes Committer: [@bdhess](https://www.github.com/bdhess) ([#506](https://www.github.com/googleapis/nodejs-kms/issues/506)) ([08cd155](https://www.github.com/googleapis/nodejs-kms/commit/08cd15524662ba81a35761df592ea8ce1557e023)) + +### [2.8.1](https://www.github.com/googleapis/nodejs-kms/compare/v2.8.0...v2.8.1) (2021-09-03) + + +### Bug Fixes + +* **build:** migrate to main branch ([#496](https://www.github.com/googleapis/nodejs-kms/issues/496)) ([b1804fb](https://www.github.com/googleapis/nodejs-kms/commit/b1804fbc2bc85cbc03c50c82f33690682dd91d58)) + +## [2.8.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.7.0...v2.8.0) (2021-08-30) + + +### Features + +* add support for Key Reimport ([#493](https://www.github.com/googleapis/nodejs-kms/issues/493)) ([9728525](https://www.github.com/googleapis/nodejs-kms/commit/97285257ec5c28821eb9c7c8d4bb50d2729bf95a)) + +## [2.7.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.6.0...v2.7.0) (2021-08-23) + + +### Features + +* turns on self-signed JWT feature flag ([#490](https://www.github.com/googleapis/nodejs-kms/issues/490)) ([3db7ee5](https://www.github.com/googleapis/nodejs-kms/commit/3db7ee57cbf22a27f639df150c4a408107dfcde6)) + +## [2.6.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.5.0...v2.6.0) (2021-08-17) + + +### Features + +* **kms:** add samples for new rng and hmac kms apis ([#487](https://www.github.com/googleapis/nodejs-kms/issues/487)) ([5278a8e](https://www.github.com/googleapis/nodejs-kms/commit/5278a8e62c14fcc5cc02e4bd7b36e68a4ed48b72)) + + +### Bug Fixes + +* **deps:** google-gax v2.24.1 ([#489](https://www.github.com/googleapis/nodejs-kms/issues/489)) ([f5e8569](https://www.github.com/googleapis/nodejs-kms/commit/f5e85696de33d8870951d684b491338fc3c029f3)) + +## [2.5.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.4.4...v2.5.0) (2021-08-05) + + +### Features + +* add support for HMAC, Variable Key Destruction, and GenerateRandom ([#484](https://www.github.com/googleapis/nodejs-kms/issues/484)) ([c207423](https://www.github.com/googleapis/nodejs-kms/commit/c207423806e36057d74244e1c79294f595e5a740)) + +### [2.4.4](https://www.github.com/googleapis/nodejs-kms/compare/v2.4.3...v2.4.4) (2021-07-16) + + +### Bug Fixes + +* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#476](https://www.github.com/googleapis/nodejs-kms/issues/476)) ([5332b9f](https://www.github.com/googleapis/nodejs-kms/commit/5332b9f924b3102aeb0c6fb704c8fe451746ce84)) + +### [2.4.3](https://www.github.com/googleapis/nodejs-kms/compare/v2.4.2...v2.4.3) (2021-07-12) + + +### Bug Fixes + +* **deps:** google-gax v2.17.1 ([#474](https://www.github.com/googleapis/nodejs-kms/issues/474)) ([1e1a3fc](https://www.github.com/googleapis/nodejs-kms/commit/1e1a3fcb437cdfb86e3fcb06ac34a329898b970a)) + +### [2.4.2](https://www.github.com/googleapis/nodejs-kms/compare/v2.4.1...v2.4.2) (2021-06-29) + + +### Bug Fixes + +* **deps:** google-gax v2.17.0 with mTLS ([#471](https://www.github.com/googleapis/nodejs-kms/issues/471)) ([9841f22](https://www.github.com/googleapis/nodejs-kms/commit/9841f227e64da2ee6158b6c43a0339c2b1fa8e3a)) + +### [2.4.1](https://www.github.com/googleapis/nodejs-kms/compare/v2.4.0...v2.4.1) (2021-06-25) + + +### Bug Fixes + +* make request optional in all cases ([#466](https://www.github.com/googleapis/nodejs-kms/issues/466)) ([bba9a58](https://www.github.com/googleapis/nodejs-kms/commit/bba9a58b087c96ff66adbde8702599aac05fc4a1)) + +## [2.4.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.3.3...v2.4.0) (2021-06-14) + + +### Features + +* add ECDSA secp256k1 to the list of supported algorithms ([#464](https://www.github.com/googleapis/nodejs-kms/issues/464)) ([a27f95d](https://www.github.com/googleapis/nodejs-kms/commit/a27f95dffdea8a803d02da443a38b10ed7720c86)) + +### [2.3.3](https://www.github.com/googleapis/nodejs-kms/compare/v2.3.2...v2.3.3) (2021-05-25) + + +### Bug Fixes + +* GoogleAdsError missing using generator version after 1.3.0 ([#456](https://www.github.com/googleapis/nodejs-kms/issues/456)) ([6f9ceae](https://www.github.com/googleapis/nodejs-kms/commit/6f9ceae5600620e889fb87f6ab250c951d73c3c3)) + +### [2.3.2](https://www.github.com/googleapis/nodejs-kms/compare/v2.3.1...v2.3.2) (2021-05-12) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#447](https://www.github.com/googleapis/nodejs-kms/issues/447)) ([5fcb7ff](https://www.github.com/googleapis/nodejs-kms/commit/5fcb7ff15d68346f786ac6d0652547232d016f3a)) +* use require() to load JSON protos ([#450](https://www.github.com/googleapis/nodejs-kms/issues/450)) ([bd67dfb](https://www.github.com/googleapis/nodejs-kms/commit/bd67dfba1a813ef7dd67437c3df76fa4b2aaa1c1)) + +### [2.3.1](https://www.github.com/googleapis/nodejs-kms/compare/v2.3.0...v2.3.1) (2021-02-12) + + +### Bug Fixes + +* do not retry on 13 INTERNAL ([#418](https://www.github.com/googleapis/nodejs-kms/issues/418)) ([3f6014a](https://www.github.com/googleapis/nodejs-kms/commit/3f6014ac2cbd6988fd400d076ad46920d3039d5c)) + +## [2.3.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.2.0...v2.3.0) (2021-01-08) + + +### Features + +* **samples:** add integrity verification to Cloud KMS crypto samples ([#409](https://www.github.com/googleapis/nodejs-kms/issues/409)) ([d2897f6](https://www.github.com/googleapis/nodejs-kms/commit/d2897f681ae409b34a50b91ea718fa9e294895c5)) + +## [2.2.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.1.4...v2.2.0) (2021-01-06) + + +### Features + +* introduces style enum ([7e8c957](https://www.github.com/googleapis/nodejs-kms/commit/7e8c957bd457939fb27e9922b4c92ae1e98c4961)) + +### [2.1.4](https://www.github.com/googleapis/nodejs-kms/compare/v2.1.3...v2.1.4) (2020-11-25) + + +### Bug Fixes + +* **browser:** check for fetch on window ([#404](https://www.github.com/googleapis/nodejs-kms/issues/404)) ([96a90e3](https://www.github.com/googleapis/nodejs-kms/commit/96a90e3bea1c8b7e8e2d57cc1eb6204ed326b915)) + +### [2.1.3](https://www.github.com/googleapis/nodejs-kms/compare/v2.1.2...v2.1.3) (2020-11-07) + + +### Bug Fixes + +* do not modify options object, use defaultScopes ([#399](https://www.github.com/googleapis/nodejs-kms/issues/399)) ([288b417](https://www.github.com/googleapis/nodejs-kms/commit/288b4172079145686ca9c129005ba27dec788712)) + +### [2.1.2](https://www.github.com/googleapis/nodejs-kms/compare/v2.1.1...v2.1.2) (2020-06-12) + + +### Bug Fixes + +* handle fallback option properly ([753a5b5](https://www.github.com/googleapis/nodejs-kms/commit/753a5b546a69131fe2627236871d4aa2cf5b1012)) + +### [2.1.1](https://www.github.com/googleapis/nodejs-kms/compare/v2.1.0...v2.1.1) (2020-06-08) + + +### Bug Fixes + +* samples-test script ([#338](https://www.github.com/googleapis/nodejs-kms/issues/338)) ([b3b0c70](https://www.github.com/googleapis/nodejs-kms/commit/b3b0c70b082e4cc7de3063428b20a9b43d1844a5)) + +## [2.1.0](https://www.github.com/googleapis/nodejs-kms/compare/v2.0.0...v2.1.0) (2020-06-04) + + +### Features + +* clean up synth.py by using IAM service option from generator ([#305](https://www.github.com/googleapis/nodejs-kms/issues/305)) ([797ee55](https://www.github.com/googleapis/nodejs-kms/commit/797ee5581a60b66f841951a90bbd2ba3995da58d)) +* **samples:** add new samples ([#324](https://www.github.com/googleapis/nodejs-kms/issues/324)) ([eb1c213](https://www.github.com/googleapis/nodejs-kms/commit/eb1c2137195137858b344e6d2ebace3005d87fe2)) + + +### Bug Fixes + +* regen protos and tests, fix formatting ([#329](https://www.github.com/googleapis/nodejs-kms/issues/329)) ([e6083a9](https://www.github.com/googleapis/nodejs-kms/commit/e6083a9c3d1e3c97785faee3bdfbe8bcce14d3ee)) +* remove eslint, update gax, fix generated protos, run the generator ([#309](https://www.github.com/googleapis/nodejs-kms/issues/309)) ([54fccb6](https://www.github.com/googleapis/nodejs-kms/commit/54fccb61a01d31fc1e5bec3b73a300fd8fed502e)) +* synth.py clean up for multiple version ([#330](https://www.github.com/googleapis/nodejs-kms/issues/330)) ([50de8d0](https://www.github.com/googleapis/nodejs-kms/commit/50de8d069c95b12e10daed40f1743d710fac7eff)) +* update common protos and fix synth ([#336](https://www.github.com/googleapis/nodejs-kms/issues/336)) ([3ed7e67](https://www.github.com/googleapis/nodejs-kms/commit/3ed7e67e5fbb459b478afb38770fb217ee6f81f4)) + +## [2.0.0](https://www.github.com/googleapis/nodejs-kms/compare/v1.6.3...v2.0.0) (2020-04-07) + + +### ⚠ BREAKING CHANGES + +* The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. + +New feature: methods with pagination now support async iteration. +* move to typescript code generation (#264) + +### Features + +* add support for Cloud EKM to the Cloud KMS service and resource protos ([#306](https://www.github.com/googleapis/nodejs-kms/issues/306)) ([f6e28c7](https://www.github.com/googleapis/nodejs-kms/commit/f6e28c788600d24e89ced41d834ec091600d1238)) +* deferred client initialization ([#286](https://www.github.com/googleapis/nodejs-kms/issues/286)) ([e116119](https://www.github.com/googleapis/nodejs-kms/commit/e11611913e553ac2581c528692174c6e4c0cb627)) +* drop node8 support, support for async iterators ([#300](https://www.github.com/googleapis/nodejs-kms/issues/300)) ([c2ca42e](https://www.github.com/googleapis/nodejs-kms/commit/c2ca42e06286910a94981c5bb2e3989b1f1de2a7)) +* move to typescript code generation ([#264](https://www.github.com/googleapis/nodejs-kms/issues/264)) ([ad02c1c](https://www.github.com/googleapis/nodejs-kms/commit/ad02c1c9978c9489314130a9fcee81d1d0244a0c)) + + +### Bug Fixes + +* export explicit version in protos.js ([#303](https://www.github.com/googleapis/nodejs-kms/issues/303)) ([90e1b52](https://www.github.com/googleapis/nodejs-kms/commit/90e1b52bd25265500c9c150e9f0c765bb250c309)) + +### [1.6.3](https://www.github.com/googleapis/nodejs-kms/compare/v1.6.2...v1.6.3) (2020-02-10) + + +### Bug Fixes + +* proto messages now accept strings for enums ([b5241d9](https://www.github.com/googleapis/nodejs-kms/commit/b5241d9748864344e68f088d92f59a4fb7032afd)) + +### [1.6.2](https://www.github.com/googleapis/nodejs-kms/compare/v1.6.1...v1.6.2) (2020-01-09) + + +### Bug Fixes + +* protos: removed extra resource annotations, no code changes ([b3d99be](https://www.github.com/googleapis/nodejs-kms/commit/b3d99bed61a3f28cb8a000b8ea84589979deeffd)) + +### [1.6.1](https://www.github.com/googleapis/nodejs-kms/compare/v1.6.0...v1.6.1) (2020-01-05) + + +### Bug Fixes + +* updated proto annotations ([#258](https://www.github.com/googleapis/nodejs-kms/issues/258)) ([b05916b](https://www.github.com/googleapis/nodejs-kms/commit/b05916b35b9f280ba8cbfea5044d52137bd9081c)) + +## [1.6.0](https://www.github.com/googleapis/nodejs-kms/compare/v1.5.3...v1.6.0) (2019-12-31) + + +### Features + +* **samples:** add asymmetric samples ([#241](https://www.github.com/googleapis/nodejs-kms/issues/241)) ([563b941](https://www.github.com/googleapis/nodejs-kms/commit/563b94187df53d5e4a2ab5a07bb7d2d8dad086b5)) + + +### Bug Fixes + +* remove superfluous base64-encoding/decoding ([#242](https://www.github.com/googleapis/nodejs-kms/issues/242)) ([aad6cc4](https://www.github.com/googleapis/nodejs-kms/commit/aad6cc451952f42b96d752f31399a2c364f07610)) +* **deps:** TypeScript 3.7.0 causes breaking change in typings ([#246](https://www.github.com/googleapis/nodejs-kms/issues/246)) ([d274c2a](https://www.github.com/googleapis/nodejs-kms/commit/d274c2aa336ffa57bc517cabd00cabdead0e518b)) + +### [1.5.3](https://www.github.com/googleapis/nodejs-kms/compare/v1.5.2...v1.5.3) (2019-11-18) + + +### Bug Fixes + +* **docs:** bump release level to GA ([#235](https://www.github.com/googleapis/nodejs-kms/issues/235)) ([d753095](https://www.github.com/googleapis/nodejs-kms/commit/d753095e4b5d623538e20477b69ed96ca801346a)) + +### [1.5.2](https://www.github.com/googleapis/nodejs-kms/compare/v1.5.1...v1.5.2) (2019-11-14) + + +### Bug Fixes + +* **docs:** snippets are now replaced in jsdoc comments ([#230](https://www.github.com/googleapis/nodejs-kms/issues/230)) ([ed142f3](https://www.github.com/googleapis/nodejs-kms/commit/ed142f3479c3fe5b98c65e05b6debfded1bad9b1)) +* import long into proto ts declaration file ([#231](https://www.github.com/googleapis/nodejs-kms/issues/231)) ([bc21cff](https://www.github.com/googleapis/nodejs-kms/commit/bc21cff485bccd679c248a3f9c1137fa99775f76)) + +### [1.5.1](https://www.github.com/googleapis/nodejs-kms/compare/v1.5.0...v1.5.1) (2019-10-22) + + +### Bug Fixes + +* **deps:** bump google-gax to 1.7.5 ([#220](https://www.github.com/googleapis/nodejs-kms/issues/220)) ([f409971](https://www.github.com/googleapis/nodejs-kms/commit/f409971f331438c01316ef8536904d0e72d18243)) + +## [1.5.0](https://www.github.com/googleapis/nodejs-kms/compare/v1.4.0...v1.5.0) (2019-10-09) + + +### Bug Fixes + +* use compatible version of google-gax ([b674eee](https://www.github.com/googleapis/nodejs-kms/commit/b674eee)) + + +### Features + +* .d.ts for protos ([#210](https://www.github.com/googleapis/nodejs-kms/issues/210)) ([e7ca801](https://www.github.com/googleapis/nodejs-kms/commit/e7ca801)) + +## [1.4.0](https://www.github.com/googleapis/nodejs-kms/compare/v1.3.2...v1.4.0) (2019-09-16) + + +### Features + +* load protos from JSON, grpc-fallback support ([628f665](https://www.github.com/googleapis/nodejs-kms/commit/628f665)) + +### [1.3.2](https://www.github.com/googleapis/nodejs-kms/compare/v1.3.1...v1.3.2) (2019-08-28) + + +### Bug Fixes + +* update retry code settings per API call ([#196](https://www.github.com/googleapis/nodejs-kms/issues/196)) ([3ce2076](https://www.github.com/googleapis/nodejs-kms/commit/3ce2076)) +* use process versions object for client header ([#199](https://www.github.com/googleapis/nodejs-kms/issues/199)) ([900eb1b](https://www.github.com/googleapis/nodejs-kms/commit/900eb1b)) +* **docs:** stop redirecting reference docs to anchor link ([9edd953](https://www.github.com/googleapis/nodejs-kms/commit/9edd953)) + +### [1.3.1](https://www.github.com/googleapis/nodejs-kms/compare/v1.3.0...v1.3.1) (2019-08-05) + + +### Bug Fixes + +* allow calls with no request, add JSON proto ([e50e0ef](https://www.github.com/googleapis/nodejs-kms/commit/e50e0ef)) + +## [1.3.0](https://www.github.com/googleapis/nodejs-kms/compare/v1.2.1...v1.3.0) (2019-07-02) + + +### Features + +* add IAM Policy Options ([#186](https://www.github.com/googleapis/nodejs-kms/issues/186)) ([7474dff](https://www.github.com/googleapis/nodejs-kms/commit/7474dff)) + +### [1.2.1](https://www.github.com/googleapis/nodejs-kms/compare/v1.2.0...v1.2.1) (2019-06-27) + + +### Bug Fixes + +* **docs:** link to reference docs section on googleapis.dev ([#183](https://www.github.com/googleapis/nodejs-kms/issues/183)) ([7c40adf](https://www.github.com/googleapis/nodejs-kms/commit/7c40adf)) + +## [1.2.0](https://www.github.com/googleapis/nodejs-kms/compare/v1.1.1...v1.2.0) (2019-06-24) + + +### Features + +* introduces CreateImportJob, ListImportJob, GetImportJob ([#180](https://www.github.com/googleapis/nodejs-kms/issues/180)) ([9fb4efb](https://www.github.com/googleapis/nodejs-kms/commit/9fb4efb)) + +### [1.1.1](https://www.github.com/googleapis/nodejs-kms/compare/v1.1.0...v1.1.1) (2019-06-14) + + +### Bug Fixes + +* **docs:** move to new client docs URL ([#177](https://www.github.com/googleapis/nodejs-kms/issues/177)) ([50d93e7](https://www.github.com/googleapis/nodejs-kms/commit/50d93e7)) + +## [1.1.0](https://www.github.com/googleapis/nodejs-kms/compare/v1.0.0...v1.1.0) (2019-06-05) + + +### Features + +* support apiEndpoint override in client constructor ([#173](https://www.github.com/googleapis/nodejs-kms/issues/173)) ([0e67019](https://www.github.com/googleapis/nodejs-kms/commit/0e67019)) + +## [1.0.0](https://www.github.com/googleapis/nodejs-kms/compare/v0.4.0...v1.0.0) (2019-05-20) + + +### ⚠ BREAKING CHANGES + +* upgrade engines field to >=8.10.0 (#151) + +### Bug Fixes + +* **deps:** update dependency google-gax to ^0.26.0 ([#149](https://www.github.com/googleapis/nodejs-kms/issues/149)) ([b92c822](https://www.github.com/googleapis/nodejs-kms/commit/b92c822)) +* DEADLINE_EXCEEDED is no longer retried ([5f4f9ff](https://www.github.com/googleapis/nodejs-kms/commit/5f4f9ff)) +* DEADLINE_EXCEEDED retry code is idempotent ([#159](https://www.github.com/googleapis/nodejs-kms/issues/159)) ([a7e511a](https://www.github.com/googleapis/nodejs-kms/commit/a7e511a)) +* indicate that Encrypt, Decrypt, AsymmetricDecrypt, AsymmetricSign are idempotent, such that they're retried ([122b3f8](https://www.github.com/googleapis/nodejs-kms/commit/122b3f8)) +* **deps:** update dependency google-gax to v1 ([#158](https://www.github.com/googleapis/nodejs-kms/issues/158)) ([91fe078](https://www.github.com/googleapis/nodejs-kms/commit/91fe078)) + + +### Build System + +* upgrade engines field to >=8.10.0 ([#151](https://www.github.com/googleapis/nodejs-kms/issues/151)) ([45b2a9f](https://www.github.com/googleapis/nodejs-kms/commit/45b2a9f)) + +## v0.4.0 + +03-13-2019 16:16 PDT + +### New Features +- feat: add support for the CAVIUM_V2_COMPRESSED type ([#126](https://github.com/googleapis/nodejs-kms/pull/126)) + +### Bug Fixes +- fix: throw on invalid credentials +- fix(deps): update dependency google-gax to ^0.25.0 ([#113](https://github.com/googleapis/nodejs-kms/pull/113)) + +### Documentation +- docs: update links in contrib guide ([#125](https://github.com/googleapis/nodejs-kms/pull/125)) +- docs: update contributing path in README ([#119](https://github.com/googleapis/nodejs-kms/pull/119)) +- docs: move CONTRIBUTING.md to root ([#118](https://github.com/googleapis/nodejs-kms/pull/118)) +- docs: add lint/fix example to contributing guide ([#116](https://github.com/googleapis/nodejs-kms/pull/116)) +- docs: fix example comments ([#115](https://github.com/googleapis/nodejs-kms/pull/115)) + +### Internal / Testing Changes +- refactor: update json import paths ([#134](https://github.com/googleapis/nodejs-kms/pull/134)) +- build: Add docuploader credentials to node publish jobs ([#132](https://github.com/googleapis/nodejs-kms/pull/132)) +- build: use node10 to run samples-test, system-test etc ([#131](https://github.com/googleapis/nodejs-kms/pull/131)) +- build: update release configuration +- chore: sync latest proto docs +- chore(deps): update dependency mocha to v6 +- build: use linkinator for docs test ([#124](https://github.com/googleapis/nodejs-kms/pull/124)) +- chore(deps): update dependency yargs to v13 ([#122](https://github.com/googleapis/nodejs-kms/pull/122)) +- build: create docs test npm scripts ([#121](https://github.com/googleapis/nodejs-kms/pull/121)) +- build: test using @grpc/grpc-js in CI ([#120](https://github.com/googleapis/nodejs-kms/pull/120)) +- refactor: improve generated code style. ([#114](https://github.com/googleapis/nodejs-kms/pull/114)) +- chore(deps): update dependency eslint-config-prettier to v4 ([#112](https://github.com/googleapis/nodejs-kms/pull/112)) +- test: add a system test to list global keys ([#111](https://github.com/googleapis/nodejs-kms/pull/111)) +- build: ignore googleapis.com in doc link check ([#108](https://github.com/googleapis/nodejs-kms/pull/108)) +- chore: sync gapic files + +## v0.3.0 + +01-15-2019 10:50 PST + +### Implementation Changes +- Add iam_policy proto ([#101](https://github.com/googleapis/nodejs-kms/pull/101)) + +### Dependencies +- fix(deps): update dependency google-gax to ^0.23.0 ([#105](https://github.com/googleapis/nodejs-kms/pull/105)) +- fix(deps): update dependency google-gax to ^0.22.0 ([#73](https://github.com/googleapis/nodejs-kms/pull/73)) +- chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 ([#71](https://github.com/googleapis/nodejs-kms/pull/71)) +- chore(deps): update dependency through2 to v3 ([#67](https://github.com/googleapis/nodejs-kms/pull/67)) +- chore(deps): update dependency eslint-plugin-node to v8 ([#59](https://github.com/googleapis/nodejs-kms/pull/59)) +- chore(deps): update dependency eslint-plugin-prettier to v3 ([#44](https://github.com/googleapis/nodejs-kms/pull/44)) + +### Documentation +- build: check broken links in generated docs ([#102](https://github.com/googleapis/nodejs-kms/pull/102)) +- fix(docs): remove unused IAM message types ([#103](https://github.com/googleapis/nodejs-kms/pull/103)) +- docs: Changes 'dencrypt' to 'decrypt' ([#97](https://github.com/googleapis/nodejs-kms/pull/97)) +- docs: add samples ([#88](https://github.com/googleapis/nodejs-kms/pull/88)) +- docs: update readme badges ([#81](https://github.com/googleapis/nodejs-kms/pull/81)) + +### Internal / Testing Changes +- chore(build): inject yoshi automation key ([#96](https://github.com/googleapis/nodejs-kms/pull/96)) +- chore: update nyc and eslint configs ([#95](https://github.com/googleapis/nodejs-kms/pull/95)) +- chore: fix publish.sh permission +x ([#93](https://github.com/googleapis/nodejs-kms/pull/93)) +- fix(build): fix Kokoro release script ([#92](https://github.com/googleapis/nodejs-kms/pull/92)) +- build: add Kokoro configs for autorelease ([#91](https://github.com/googleapis/nodejs-kms/pull/91)) +- chore: always nyc report before calling codecov ([#87](https://github.com/googleapis/nodejs-kms/pull/87)) +- chore: nyc ignore build/test by default ([#86](https://github.com/googleapis/nodejs-kms/pull/86)) +- chore: update the renovate config ([#84](https://github.com/googleapis/nodejs-kms/pull/84)) +- chore: update license file ([#83](https://github.com/googleapis/nodejs-kms/pull/83)) +- fix(build): fix system key decryption ([#79](https://github.com/googleapis/nodejs-kms/pull/79)) +- chore: add a synth.metadata +- chore: update eslintignore config ([#72](https://github.com/googleapis/nodejs-kms/pull/72)) +- chore: update lint rules ([#69](https://github.com/googleapis/nodejs-kms/pull/69)) +- chore: drop contributors from multiple places ([#70](https://github.com/googleapis/nodejs-kms/pull/70)) +- chore: use latest npm on Windows ([#68](https://github.com/googleapis/nodejs-kms/pull/68)) +- chore: update CircleCI config ([#66](https://github.com/googleapis/nodejs-kms/pull/66)) +- chore: include build in eslintignore ([#63](https://github.com/googleapis/nodejs-kms/pull/63)) +- chore: update issue templates ([#58](https://github.com/googleapis/nodejs-kms/pull/58)) +- chore: remove old issue template ([#56](https://github.com/googleapis/nodejs-kms/pull/56)) +- build: run tests on node11 ([#55](https://github.com/googleapis/nodejs-kms/pull/55)) +- chores(build): do not collect sponge.xml from windows builds ([#54](https://github.com/googleapis/nodejs-kms/pull/54)) +- chores(build): run codecov on continuous builds ([#53](https://github.com/googleapis/nodejs-kms/pull/53)) +- chore: update new issue template ([#52](https://github.com/googleapis/nodejs-kms/pull/52)) +- build: fix codecov uploading on Kokoro ([#48](https://github.com/googleapis/nodejs-kms/pull/48)) +- Update kokoro config ([#45](https://github.com/googleapis/nodejs-kms/pull/45)) +- test: remove appveyor config ([#41](https://github.com/googleapis/nodejs-kms/pull/41)) +- Enable prefer-const in the eslint config ([#38](https://github.com/googleapis/nodejs-kms/pull/38)) + +## v0.2.0 + +### New Features +- Add new features to the library ([#33](https://github.com/googleapis/nodejs-kms/pull/33)) + - CryptoKeyPurpose: ASSYMETRIC_SIGN, ASSYMETRIC_DECRYPT + - CryptoKeyVersion + - KeyOperationAttestation + - various improved code documentation + +### Dependencies +- fix(deps): update dependency google-gax to ^0.20.0 ([#34](https://github.com/googleapis/nodejs-kms/pull/34)) +- chore(deps): update dependency nyc to v13 ([#25](https://github.com/googleapis/nodejs-kms/pull/25)) +- fix(deps): update dependency google-gax to ^0.19.0 ([#22](https://github.com/googleapis/nodejs-kms/pull/22)) + +### Internal / Testing Changes +- Enable no-var in eslint ([#35](https://github.com/googleapis/nodejs-kms/pull/35)) +- Update CI config ([#32](https://github.com/googleapis/nodejs-kms/pull/32)) +- Retry npm install in CI ([#30](https://github.com/googleapis/nodejs-kms/pull/30)) +- Update CI config ([#27](https://github.com/googleapis/nodejs-kms/pull/27)) diff --git a/packages/google-cloud-kms/CODE_OF_CONDUCT.md b/packages/google-cloud-kms/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..2add2547a81 --- /dev/null +++ b/packages/google-cloud-kms/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-kms/CONTRIBUTING.md b/packages/google-cloud-kms/CONTRIBUTING.md new file mode 100644 index 00000000000..a08d6538627 --- /dev/null +++ b/packages/google-cloud-kms/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 Google Cloud Key Management Service 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=kms.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-kms/LICENSE b/packages/google-cloud-kms/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-kms/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-kms/README.md b/packages/google-cloud-kms/README.md new file mode 100644 index 00000000000..a950f5859b5 --- /dev/null +++ b/packages/google-cloud-kms/README.md @@ -0,0 +1,200 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Google Cloud Key Management Service: 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/kms.svg)](https://www.npmjs.org/package/@google-cloud/kms) + + + + +Google Cloud Key Management Service (KMS) 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-kms/CHANGELOG.md). + +* [Google Cloud Key Management Service Node.js Client API Reference][client-docs] +* [Google Cloud Key Management Service Documentation][product-docs] +* [github.com/googleapis/google-cloud-node/packages/google-cloud-kms](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-kms) + +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 Google Cloud Key Management Service 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/kms +``` + + +### Using the client library + +```javascript +// +// TODO(developer): Uncomment these variables before running the sample. +// +// const projectId = 'my-project'; +// const locationId = 'us-east1'; + +// Imports the Cloud KMS library +const {KeyManagementServiceClient} = require('@google-cloud/kms'); + +// Instantiates a client +const client = new KeyManagementServiceClient(); + +// Build the location name +const locationName = client.locationPath(projectId, locationId); + +async function listKeyRings() { + const [keyRings] = await client.listKeyRings({ + parent: locationName, + }); + + for (const keyRing of keyRings) { + console.log(keyRing.name); + } + + return keyRings; +} + +return listKeyRings(); + +``` + + + +## 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 | +| --------------------------- | --------------------------------- | ------ | +| Ekm_service.create_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.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-kms/samples/generated/v1/ekm_service.create_ekm_connection.js,samples/README.md) | +| Ekm_service.get_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.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-kms/samples/generated/v1/ekm_service.get_ekm_connection.js,samples/README.md) | +| Ekm_service.list_ekm_connections | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.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-kms/samples/generated/v1/ekm_service.list_ekm_connections.js,samples/README.md) | +| Ekm_service.update_ekm_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.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-kms/samples/generated/v1/ekm_service.update_ekm_connection.js,samples/README.md) | +| Key_management_service.asymmetric_decrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.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-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js,samples/README.md) | +| Key_management_service.asymmetric_sign | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.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-kms/samples/generated/v1/key_management_service.asymmetric_sign.js,samples/README.md) | +| Key_management_service.create_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.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-kms/samples/generated/v1/key_management_service.create_crypto_key.js,samples/README.md) | +| Key_management_service.create_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.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-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js,samples/README.md) | +| Key_management_service.create_import_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.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-kms/samples/generated/v1/key_management_service.create_import_job.js,samples/README.md) | +| Key_management_service.create_key_ring | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.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-kms/samples/generated/v1/key_management_service.create_key_ring.js,samples/README.md) | +| Key_management_service.decrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.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-kms/samples/generated/v1/key_management_service.decrypt.js,samples/README.md) | +| Key_management_service.destroy_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.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-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js,samples/README.md) | +| Key_management_service.encrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.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-kms/samples/generated/v1/key_management_service.encrypt.js,samples/README.md) | +| Key_management_service.generate_random_bytes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.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-kms/samples/generated/v1/key_management_service.generate_random_bytes.js,samples/README.md) | +| Key_management_service.get_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.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-kms/samples/generated/v1/key_management_service.get_crypto_key.js,samples/README.md) | +| Key_management_service.get_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.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-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js,samples/README.md) | +| Key_management_service.get_import_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.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-kms/samples/generated/v1/key_management_service.get_import_job.js,samples/README.md) | +| Key_management_service.get_key_ring | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.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-kms/samples/generated/v1/key_management_service.get_key_ring.js,samples/README.md) | +| Key_management_service.get_public_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.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-kms/samples/generated/v1/key_management_service.get_public_key.js,samples/README.md) | +| Key_management_service.import_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.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-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js,samples/README.md) | +| Key_management_service.list_crypto_key_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.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-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js,samples/README.md) | +| Key_management_service.list_crypto_keys | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.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-kms/samples/generated/v1/key_management_service.list_crypto_keys.js,samples/README.md) | +| Key_management_service.list_import_jobs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.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-kms/samples/generated/v1/key_management_service.list_import_jobs.js,samples/README.md) | +| Key_management_service.list_key_rings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.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-kms/samples/generated/v1/key_management_service.list_key_rings.js,samples/README.md) | +| Key_management_service.mac_sign | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.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-kms/samples/generated/v1/key_management_service.mac_sign.js,samples/README.md) | +| Key_management_service.mac_verify | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.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-kms/samples/generated/v1/key_management_service.mac_verify.js,samples/README.md) | +| Key_management_service.restore_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.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-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js,samples/README.md) | +| Key_management_service.update_crypto_key | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.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-kms/samples/generated/v1/key_management_service.update_crypto_key.js,samples/README.md) | +| Key_management_service.update_crypto_key_primary_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.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-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js,samples/README.md) | +| Key_management_service.update_crypto_key_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.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-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/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-kms/samples/quickstart.js,samples/README.md) | +| Quickstart.test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/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-kms/samples/test/quickstart.test.js,samples/README.md) | + + + +The [Google Cloud Key Management Service 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/kms@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/kms/latest +[product-docs]: https://cloud.google.com/kms +[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=kms.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-kms/linkinator.config.json b/packages/google-cloud-kms/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/packages/google-cloud-kms/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/packages/google-cloud-kms/package.json b/packages/google-cloud-kms/package.json new file mode 100644 index 00000000000..b435041b1b1 --- /dev/null +++ b/packages/google-cloud-kms/package.json @@ -0,0 +1,72 @@ +{ + "name": "@google-cloud/kms", + "description": "Google Cloud Key Management Service (KMS) API client for Node.js", + "version": "3.1.0", + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "directory": "packages/google-cloud-kms", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, + "main": "build/src/index.js", + "files": [ + "build/protos", + "build/src" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google kms", + "kms", + "Google Cloud Key Management Service (KMS) API" + ], + "scripts": { + "clean": "gts clean", + "compile-protos": "compileProtos src", + "compile": "tsc -p . && cp -r protos build/", + "docs-test": "linkinator docs", + "docs": "jsdoc -c .jsdoc.js", + "fix": "gts fix", + "lint": "gts check", + "precompile": "gts clean", + "predocs-test": "npm run docs", + "prelint": "cd samples; npm link ../; npm install", + "prepare": "npm run compile-protos && npm run compile", + "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" + }, + "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", + "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-kms" +} diff --git a/packages/google-cloud-kms/protos/google/cloud/common_resources.proto b/packages/google-cloud-kms/protos/google/cloud/common_resources.proto new file mode 100644 index 00000000000..56c9f800d5e --- /dev/null +++ b/packages/google-cloud-kms/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-kms/protos/google/cloud/kms/v1/ekm_service.proto b/packages/google-cloud-kms/protos/google/cloud/kms/v1/ekm_service.proto new file mode 100644 index 00000000000..de8669dbf3d --- /dev/null +++ b/packages/google-cloud-kms/protos/google/cloud/kms/v1/ekm_service.proto @@ -0,0 +1,293 @@ +// 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.cloud.kms.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; +option java_multiple_files = true; +option java_outer_classname = "EkmServiceProto"; +option java_package = "com.google.cloud.kms.v1"; +option php_namespace = "Google\\Cloud\\Kms\\V1"; +option (google.api.resource_definition) = { + type: "servicedirectory.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" +}; + +// Google Cloud Key Management EKM Service +// +// Manages external cryptographic keys and operations using those keys. +// Implements a REST model with the following objects: +// * [EkmConnection][google.cloud.kms.v1.EkmConnection] +service EkmService { + option (google.api.default_host) = "cloudkms.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloudkms"; + + // Lists [EkmConnections][google.cloud.kms.v1.EkmConnection]. + rpc ListEkmConnections(ListEkmConnectionsRequest) + returns (ListEkmConnectionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/ekmConnections" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns metadata for a given + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + rpc GetEkmConnection(GetEkmConnectionRequest) returns (EkmConnection) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/ekmConnections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given + // Project and Location. + rpc CreateEkmConnection(CreateEkmConnectionRequest) returns (EkmConnection) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/ekmConnections" + body: "ekm_connection" + }; + option (google.api.method_signature) = + "parent,ekm_connection_id,ekm_connection"; + } + + // Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata. + rpc UpdateEkmConnection(UpdateEkmConnectionRequest) returns (EkmConnection) { + option (google.api.http) = { + patch: "/v1/{ekm_connection.name=projects/*/locations/*/ekmConnections/*}" + body: "ekm_connection" + }; + option (google.api.method_signature) = "ekm_connection,update_mask"; + } +} + +// Request message for [KeyManagementService.ListEkmConnections][]. +message ListEkmConnectionsRequest { + // Required. The resource name of the location associated with the + // [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Optional limit on the number of + // [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the + // response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can + // subsequently be obtained by including the + // [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [KeyManagementService.ListEkmConnections][]. +message ListEkmConnectionsResponse { + // The list of [EkmConnections][google.cloud.kms.v1.EkmConnection]. + repeated EkmConnection ekm_connections = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection] + // that matched the query. + int32 total_size = 3; +} + +// Request message for [KeyManagementService.GetEkmConnection][]. +message GetEkmConnectionRequest { + // Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the + // [EkmConnection][google.cloud.kms.v1.EkmConnection] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/EkmConnection" + } + ]; +} + +// Request message for [KeyManagementService.CreateEkmConnection][]. +message CreateEkmConnectionRequest { + // Required. The resource name of the location associated with the + // [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. It must be unique within a location and match the regular + // expression `[a-zA-Z0-9_-]{1,63}`. + string ekm_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with + // initial field values. + EkmConnection ekm_connection = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [KeyManagementService.UpdateEkmConnection][]. +message UpdateEkmConnectionRequest { + // Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated + // values. + EkmConnection ekm_connection = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509 +// certificate used to authenticate HTTPS connections to EKM replicas. +message Certificate { + // Required. The raw certificate bytes in DER format. + bytes raw_der = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. True if the certificate was parsed successfully. + bool parsed = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The issuer distinguished name in RFC 2253 format. Only present + // if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + string issuer = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The subject distinguished name in RFC 2253 format. Only + // present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + string subject = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The subject Alternative DNS names. Only present if + // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + repeated string subject_alternative_dns_names = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The certificate is not valid before this time. Only present if + // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + google.protobuf.Timestamp not_before_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The certificate is not valid after this time. Only present if + // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + google.protobuf.Timestamp not_after_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The certificate serial number as a hex string. Only present if + // [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + string serial_number = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The SHA-256 certificate fingerprint as a hex string. Only + // present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. + string sha256_fingerprint = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an +// individual EKM connection. It can be used for creating +// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and +// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a +// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of +// [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC], as well as +// performing cryptographic operations using keys created within the +// [EkmConnection][google.cloud.kms.v1.EkmConnection]. +message EkmConnection { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/EkmConnection" + pattern: "projects/{project}/locations/{location}/ekmConnections/{ekm_connection}" + }; + + // A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] + // represents an EKM replica that can be reached within an + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + message ServiceResolver { + // Required. The resource name of the Service Directory service pointing to + // an EKM replica, in the format + // `projects/*/locations/*/namespaces/*/services/*`. + string service_directory_service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; + + // Optional. The filter applied to the endpoints of the resolved service. If + // no filter is specified, all endpoints will be considered. An endpoint + // will be chosen arbitrarily from the filtered list for each request. + // + // For endpoint filter syntax and examples, see + // https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest. + string endpoint_filter = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The hostname of the EKM replica used at TLS and HTTP layers. + string hostname = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. A list of leaf server certificates used to authenticate HTTPS + // connections to the EKM replica. + repeated Certificate server_certificates = 4 + [(google.api.field_behavior) = REQUIRED]; + } + + // Output only. The resource name for the + // [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format + // `projects/*/locations/*/ekmConnections/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the + // [EkmConnection][google.cloud.kms.v1.EkmConnection] was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A list of + // [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where + // the EKM can be reached. There should be one ServiceResolver per EKM + // replica. Currently, only a single + // [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is + // supported. + repeated ServiceResolver service_resolvers = 3; + + // This checksum is computed by the server based on the value of other fields, + // and may be sent on update requests to ensure the client has an up-to-date + // value before proceeding. + string etag = 5; +} diff --git a/packages/google-cloud-kms/protos/google/cloud/kms/v1/resources.proto b/packages/google-cloud-kms/protos/google/cloud/kms/v1/resources.proto new file mode 100644 index 00000000000..5029f3e0348 --- /dev/null +++ b/packages/google-cloud-kms/protos/google/cloud/kms/v1/resources.proto @@ -0,0 +1,816 @@ +// 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.cloud.kms.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; +option java_multiple_files = true; +option java_outer_classname = "KmsResourcesProto"; +option java_package = "com.google.cloud.kms.v1"; +option php_namespace = "Google\\Cloud\\Kms\\V1"; + +// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of +// [CryptoKeys][google.cloud.kms.v1.CryptoKey]. +message KeyRing { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/KeyRing" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}" + }; + + // Output only. The resource name for the + // [KeyRing][google.cloud.kms.v1.KeyRing] in the format + // `projects/*/locations/*/keyRings/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] + // was created. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that +// can be used for cryptographic operations. +// +// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more +// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual +// key material used in cryptographic operations. +message CryptoKey { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/CryptoKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" + }; + + // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] + // describes the cryptographic capabilities of a + // [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used + // for the operations allowed by its purpose. For more information, see [Key + // purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes). + enum CryptoKeyPurpose { + // Not specified. + CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + ENCRYPT_DECRYPT = 1; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with + // [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] + // and + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + ASYMMETRIC_SIGN = 5; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with + // [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] + // and + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + ASYMMETRIC_DECRYPT = 6; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used + // with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. + MAC = 9; + } + + // Output only. The resource name for this + // [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A copy of the "primary" + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used + // by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this + // [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in + // [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name]. + // + // The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be + // updated via + // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. + // + // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] + // may have a primary. For other keys, this field will be omitted. + CryptoKeyVersion primary = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The immutable purpose of this + // [CryptoKey][google.cloud.kms.v1.CryptoKey]. + CryptoKeyPurpose purpose = 3 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time at which this + // [CryptoKey][google.cloud.kms.v1.CryptoKey] was created. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], + // the Key Management Service will automatically: + // + // 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. + // 2. Mark the new version as primary. + // + // Key rotations performed manually via + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] + // and + // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion] + // do not affect + // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]. + // + // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] + // support automatic rotation. For other keys, this field must be omitted. + google.protobuf.Timestamp next_rotation_time = 7; + + // Controls the rate of automatic rotation. + oneof rotation_schedule { + // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] + // will be advanced by this period when the service automatically rotates a + // key. Must be at least 24 hours and at most 876,000 hours. + // + // If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is + // set, + // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] + // must also be set. + // + // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] + // support automatic rotation. For other keys, this field must be omitted. + google.protobuf.Duration rotation_period = 8; + } + + // A template describing settings for new + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The + // properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // instances created by either + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] + // or auto-rotation are controlled by this template. + CryptoKeyVersionTemplate version_template = 11; + + // Labels with user-defined metadata. For more information, see + // [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys). + map labels = 10; + + // Immutable. Whether this key may contain imported versions only. + bool import_only = 13 [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The period of time that versions of this key spend in the + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + // state before transitioning to + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. + // If not specified at creation time, the default duration is 24 hours. + google.protobuf.Duration destroy_scheduled_duration = 14 + [(google.api.field_behavior) = IMMUTABLE]; + + // Immutable. The resource name of the backend environment where the key + // material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] + // associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and + // where all related cryptographic operations are performed. Only applicable + // if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a + // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of + // [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC], with the + // resource name in the format `projects/*/locations/*/ekmConnections/*`. + // Note, this list is non-exhaustive and may apply to additional + // [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future. + string crypto_key_backend = 15 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { type: "*" } + ]; +} + +// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate] +// specifies the properties to use when creating a new +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually +// with +// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] +// or automatically as a result of auto-rotation. +message CryptoKeyVersionTemplate { + // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating + // a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this + // template. Immutable. Defaults to + // [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE]. + ProtectionLevel protection_level = 1; + + // Required. + // [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // to use when creating a + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this + // template. + // + // For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both + // this field is omitted and + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Contains an HSM-generated attestation about a key operation. For more +// information, see [Verifying attestations] +// (https://cloud.google.com/kms/docs/attest-key). +message KeyOperationAttestation { + // Attestation formats provided by the HSM. + enum AttestationFormat { + // Not specified. + ATTESTATION_FORMAT_UNSPECIFIED = 0; + + // Cavium HSM attestation compressed with gzip. Note that this format is + // defined by Cavium and subject to change at any time. + CAVIUM_V1_COMPRESSED = 3; + + // Cavium HSM attestation V2 compressed with gzip. This is a new format + // introduced in Cavium's version 3.2-08. + CAVIUM_V2_COMPRESSED = 4; + } + + // Certificate chains needed to verify the attestation. + // Certificates in chains are PEM-encoded and are ordered based on + // https://tools.ietf.org/html/rfc5246#section-7.4.2. + message CertificateChains { + // Cavium certificate chain corresponding to the attestation. + repeated string cavium_certs = 1; + + // Google card certificate chain corresponding to the attestation. + repeated string google_card_certs = 2; + + // Google partition certificate chain corresponding to the attestation. + repeated string google_partition_certs = 3; + } + + // Output only. The format of the attestation data. + AttestationFormat format = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The attestation data provided by the HSM when the key + // operation was performed. + bytes content = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The certificate chains needed to validate the attestation + CertificateChains cert_chains = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an +// individual cryptographic key, and the associated key material. +// +// An +// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] +// version can be used for cryptographic operations. +// +// For security reasons, the raw cryptographic key material represented by a +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed +// or exported. It can only be used to encrypt, decrypt, or sign data when an +// authorized user or application invokes Cloud KMS. +message CryptoKeyVersion { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}" + }; + + // The algorithm of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what + // parameters must be used for each cryptographic operation. + // + // The + // [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION] + // algorithm is usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + // + // Algorithms beginning with "RSA_SIGN_" are usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. + // + // The fields in the name after "RSA_SIGN_" correspond to the following + // parameters: padding algorithm, modulus bit length, and digest algorithm. + // + // For PSS, the salt length used is equal to the length of digest + // algorithm. For example, + // [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256] + // will use PSS with a salt length of 256 bits or 32 bytes. + // + // Algorithms beginning with "RSA_DECRYPT_" are usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. + // + // The fields in the name after "RSA_DECRYPT_" correspond to the following + // parameters: padding algorithm, modulus bit length, and digest algorithm. + // + // Algorithms beginning with "EC_SIGN_" are usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. + // + // The fields in the name after "EC_SIGN_" correspond to the following + // parameters: elliptic curve, digest algorithm. + // + // Algorithms beginning with "HMAC_" are usable with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]. + // + // The suffix following "HMAC_" corresponds to the hash algorithm being used + // (eg. SHA256). + // + // For more information, see [Key purposes and algorithms] + // (https://cloud.google.com/kms/docs/algorithms). + enum CryptoKeyVersionAlgorithm { + // Not specified. + CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0; + + // Creates symmetric encryption keys. + GOOGLE_SYMMETRIC_ENCRYPTION = 1; + + // RSASSA-PSS 2048 bit key with a SHA256 digest. + RSA_SIGN_PSS_2048_SHA256 = 2; + + // RSASSA-PSS 3072 bit key with a SHA256 digest. + RSA_SIGN_PSS_3072_SHA256 = 3; + + // RSASSA-PSS 4096 bit key with a SHA256 digest. + RSA_SIGN_PSS_4096_SHA256 = 4; + + // RSASSA-PSS 4096 bit key with a SHA512 digest. + RSA_SIGN_PSS_4096_SHA512 = 15; + + // RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_2048_SHA256 = 5; + + // RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_3072_SHA256 = 6; + + // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_4096_SHA256 = 7; + + // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest. + RSA_SIGN_PKCS1_4096_SHA512 = 16; + + // RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key. + RSA_SIGN_RAW_PKCS1_2048 = 28; + + // RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key. + RSA_SIGN_RAW_PKCS1_3072 = 29; + + // RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key. + RSA_SIGN_RAW_PKCS1_4096 = 30; + + // RSAES-OAEP 2048 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_2048_SHA256 = 8; + + // RSAES-OAEP 3072 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_3072_SHA256 = 9; + + // RSAES-OAEP 4096 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_4096_SHA256 = 10; + + // RSAES-OAEP 4096 bit key with a SHA512 digest. + RSA_DECRYPT_OAEP_4096_SHA512 = 17; + + // RSAES-OAEP 2048 bit key with a SHA1 digest. + RSA_DECRYPT_OAEP_2048_SHA1 = 37; + + // RSAES-OAEP 3072 bit key with a SHA1 digest. + RSA_DECRYPT_OAEP_3072_SHA1 = 38; + + // RSAES-OAEP 4096 bit key with a SHA1 digest. + RSA_DECRYPT_OAEP_4096_SHA1 = 39; + + // ECDSA on the NIST P-256 curve with a SHA256 digest. + EC_SIGN_P256_SHA256 = 12; + + // ECDSA on the NIST P-384 curve with a SHA384 digest. + EC_SIGN_P384_SHA384 = 13; + + // ECDSA on the non-NIST secp256k1 curve. This curve is only supported for + // HSM protection level. + EC_SIGN_SECP256K1_SHA256 = 31; + + // HMAC-SHA256 signing with a 256 bit key. + HMAC_SHA256 = 32; + + // Algorithm representing symmetric encryption by an external key manager. + EXTERNAL_SYMMETRIC_ENCRYPTION = 18; + } + + // The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], + // indicating if it can be used. + enum CryptoKeyVersionState { + // Not specified. + CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + + // This version is still being generated. It may not be used, enabled, + // disabled, or destroyed yet. Cloud KMS will automatically mark this + // version + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // as soon as the version is ready. + PENDING_GENERATION = 5; + + // This version may be used for cryptographic operations. + ENABLED = 1; + + // This version may not be used, but the key material is still available, + // and the version can be placed back into the + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // state. + DISABLED = 2; + + // This version is destroyed, and the key material is no longer stored. + // This version may only become + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // again if this version is + // [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible] + // and the original key material is reimported with a call to + // [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. + DESTROYED = 3; + + // This version is scheduled for destruction, and will be destroyed soon. + // Call + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // to put it back into the + // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] + // state. + DESTROY_SCHEDULED = 4; + + // This version is still being imported. It may not be used, enabled, + // disabled, or destroyed yet. Cloud KMS will automatically mark this + // version + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // as soon as the version is ready. + PENDING_IMPORT = 6; + + // This version was not imported successfully. It may not be used, enabled, + // disabled, or destroyed. The submitted key material has been discarded. + // Additional details can be found in + // [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]. + IMPORT_FAILED = 7; + } + + // A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s. + // Controls the level of detail returned for + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in + // [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions] + // and + // [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. + enum CryptoKeyVersionView { + // Default view for each + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not + // include the + // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field. + CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0; + + // Provides all fields in each + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the + // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]. + FULL = 1; + } + + // Output only. The resource name for this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The current state of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + CryptoKeyVersionState state = 3; + + // Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] + // describing how crypto operations are performed with this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + ProtectionLevel protection_level = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The + // [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // supports. + CryptoKeyVersionAlgorithm algorithm = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Statement that was generated and signed by the HSM at key + // creation time. Use this statement to verify attributes of the key as stored + // on the HSM, independently of Google. Only provided for key versions with + // [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level] + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. + KeyOperationAttestation attestation = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created. + google.protobuf.Timestamp create_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was + // generated. + google.protobuf.Timestamp generate_time = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is + // scheduled for destruction. Only present if + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]. + google.protobuf.Timestamp destroy_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this CryptoKeyVersion's key material was + // destroyed. Only present if + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. + google.protobuf.Timestamp destroy_event_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob] + // used in the most recent import of this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if + // the underlying key material was imported. + string import_job = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was + // most recently imported. + google.protobuf.Timestamp import_time = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The root cause of the most recent import failure. Only present + // if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]. + string import_failure_reason = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // ExternalProtectionLevelOptions stores a group of additional fields for + // configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that + // are specific to the + // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level + // and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] + // protection levels. + ExternalProtectionLevelOptions external_protection_level_options = 17; + + // Output only. Whether or not this key version is eligible for reimport, by + // being specified as a target in + // [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]. + bool reimport_eligible = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The public key for a given +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via +// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. +message PublicKey { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/PublicKey" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey" + }; + + // The public key, encoded in PEM format. For more information, see the + // [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for + // [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and + // [Textual Encoding of Subject Public Key Info] + // (https://tools.ietf.org/html/rfc7468#section-13). + string pem = 1; + + // The + // [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // associated with this key. + CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2; + + // Integrity verification field. A CRC32C checksum of the returned + // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of + // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by + // computing the CRC32C checksum of + // [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your + // results to this field. Discard the response in case of non-matching + // checksum values, and perform a limited number of retries. A persistent + // mismatch may indicate an issue in your computation of the CRC32C checksum. + // Note: This field is defined as int64 for reasons of compatibility across + // different languages. However, it is a non-negative integer, which will + // never exceed 2^32-1, and can be safely downconverted to uint32 in languages + // that support this type. + // + // NOTE: This field is in Beta. + google.protobuf.Int64Value pem_crc32c = 3; + + // The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key. + // Provided here for verification. + // + // NOTE: This field is in Beta. + string name = 4; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key. + ProtectionLevel protection_level = 5; +} + +// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create +// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and +// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing +// key material, generated outside of Cloud KMS. +// +// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will +// generate a "wrapping key", which is a public/private key pair. You use the +// wrapping key to encrypt (also known as wrap) the pre-existing key material to +// protect it during the import process. The nature of the wrapping key depends +// on the choice of +// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the +// wrapping key generation is complete, the +// [state][google.cloud.kms.v1.ImportJob.state] will be set to +// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the +// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The +// fetched public key can then be used to wrap your pre-existing key material. +// +// Once the key material is wrapped, it can be imported into a new +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing +// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling +// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. +// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be +// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS +// uses the private key portion of the wrapping key to unwrap the key material. +// Only Cloud KMS has access to the private key. +// +// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is +// created. Once expired, Cloud KMS will no longer be able to import or unwrap +// any key material that was wrapped with the +// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key. +// +// For more information, see +// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key). +message ImportJob { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/ImportJob" + pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}" + }; + + // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the + // key wrapping method chosen for this + // [ImportJob][google.cloud.kms.v1.ImportJob]. + enum ImportMethod { + // Not specified. + IMPORT_METHOD_UNSPECIFIED = 0; + + // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping + // scheme defined in the PKCS #11 standard. In summary, this involves + // wrapping the raw key with an ephemeral AES key, and wrapping the + // ephemeral AES key with a 3072 bit RSA key. For more details, see + // [RSA AES key wrap + // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). + RSA_OAEP_3072_SHA1_AES_256 = 1; + + // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping + // scheme defined in the PKCS #11 standard. In summary, this involves + // wrapping the raw key with an ephemeral AES key, and wrapping the + // ephemeral AES key with a 4096 bit RSA key. For more details, see + // [RSA AES key wrap + // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). + RSA_OAEP_4096_SHA1_AES_256 = 2; + } + + // The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if + // it can be used. + enum ImportJobState { + // Not specified. + IMPORT_JOB_STATE_UNSPECIFIED = 0; + + // The wrapping key for this job is still being generated. It may not be + // used. Cloud KMS will automatically mark this job as + // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as + // the wrapping key is generated. + PENDING_GENERATION = 1; + + // This job may be used in + // [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey] + // and + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] + // requests. + ACTIVE = 2; + + // This job can no longer be used and may not leave this state once entered. + EXPIRED = 3; + } + + // The public key component of the wrapping key. For details of the type of + // key this public key corresponds to, see the + // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod]. + message WrappingPublicKey { + // The public key, encoded in PEM format. For more information, see the [RFC + // 7468](https://tools.ietf.org/html/rfc7468) sections for [General + // Considerations](https://tools.ietf.org/html/rfc7468#section-2) and + // [Textual Encoding of Subject Public Key Info] + // (https://tools.ietf.org/html/rfc7468#section-13). + string pem = 1; + } + + // Output only. The resource name for this + // [ImportJob][google.cloud.kms.v1.ImportJob] in the format + // `projects/*/locations/*/keyRings/*/importJobs/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The wrapping method to be used for incoming key + // material. + ImportMethod import_method = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. Immutable. The protection level of the + // [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] + // of the [version_template][google.cloud.kms.v1.CryptoKey.version_template] + // on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import + // into. + ProtectionLevel protection_level = 9 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Output only. The time at which this + // [ImportJob][google.cloud.kms.v1.ImportJob] was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key + // material was generated. + google.protobuf.Timestamp generate_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which this + // [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and + // can no longer be used to import key material. + google.protobuf.Timestamp expire_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob] + // expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is + // [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]. + google.protobuf.Timestamp expire_event_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the + // [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used. + ImportJobState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The public key with which to wrap key material prior to + // import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is + // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]. + WrappingPublicKey public_key = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Statement that was generated and signed by the key creator + // (for example, an HSM) at key creation time. Use this statement to verify + // attributes of the key as stored on the HSM, independently of Google. + // Only present if the chosen + // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a + // protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. + KeyOperationAttestation attestation = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// ExternalProtectionLevelOptions stores a group of additional fields for +// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that +// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] +// protection level and +// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection +// levels. +message ExternalProtectionLevelOptions { + // The URI for an external resource that this + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents. + string external_key_uri = 1; + + // The path to the external key material on the EKM when using + // [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set + // this field instead of external_key_uri when using an + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + string ekm_connection_key_path = 2; +} + +// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how +// cryptographic operations are performed. For more information, see [Protection +// levels] (https://cloud.google.com/kms/docs/algorithms#protection_levels). +enum ProtectionLevel { + // Not specified. + PROTECTION_LEVEL_UNSPECIFIED = 0; + + // Crypto operations are performed in software. + SOFTWARE = 1; + + // Crypto operations are performed in a Hardware Security Module. + HSM = 2; + + // Crypto operations are performed by an external key manager. + EXTERNAL = 3; + + // Crypto operations are performed in an EKM-over-VPC backend. + EXTERNAL_VPC = 4; +} diff --git a/packages/google-cloud-kms/protos/google/cloud/kms/v1/service.proto b/packages/google-cloud-kms/protos/google/cloud/kms/v1/service.proto new file mode 100644 index 00000000000..565678da32c --- /dev/null +++ b/packages/google-cloud-kms/protos/google/cloud/kms/v1/service.proto @@ -0,0 +1,1666 @@ +// 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.cloud.kms.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/kms/v1/resources.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/wrappers.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; +option java_multiple_files = true; +option java_outer_classname = "KmsProto"; +option java_package = "com.google.cloud.kms.v1"; +option php_namespace = "Google\\Cloud\\Kms\\V1"; + +// Google Cloud Key Management Service +// +// Manages cryptographic keys and operations using those keys. Implements a REST +// model with the following objects: +// +// * [KeyRing][google.cloud.kms.v1.KeyRing] +// * [CryptoKey][google.cloud.kms.v1.CryptoKey] +// * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] +// * [ImportJob][google.cloud.kms.v1.ImportJob] +// +// If you are using manual gRPC libraries, see +// [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). +service KeyManagementService { + option (google.api.default_host) = "cloudkms.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloudkms"; + + // Lists [KeyRings][google.cloud.kms.v1.KeyRing]. + rpc ListKeyRings(ListKeyRingsRequest) returns (ListKeyRingsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/keyRings" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + rpc ListCryptoKeys(ListCryptoKeysRequest) returns (ListCryptoKeysResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + rpc ListCryptoKeyVersions(ListCryptoKeyVersionsRequest) + returns (ListCryptoKeyVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists [ImportJobs][google.cloud.kms.v1.ImportJob]. + rpc ListImportJobs(ListImportJobsRequest) returns (ListImportJobsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. + rpc GetKeyRing(GetKeyRingRequest) returns (KeyRing) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as + // well as its [primary][google.cloud.kms.v1.CryptoKey.primary] + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + rpc GetCryptoKey(GetCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns metadata for a given + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + rpc GetCryptoKeyVersion(GetCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns the public key for the given + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be + // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] + // or + // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. + rpc GetPublicKey(GetPublicKeyRequest) returns (PublicKey) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}/publicKey" + }; + option (google.api.method_signature) = "name"; + } + + // Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob]. + rpc GetImportJob(GetImportJobRequest) returns (ImportJob) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/keyRings/*/importJobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and + // Location. + rpc CreateKeyRing(CreateKeyRingRequest) returns (KeyRing) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/keyRings" + body: "key_ring" + }; + option (google.api.method_signature) = "parent,key_ring_id,key_ring"; + } + + // Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a + // [KeyRing][google.cloud.kms.v1.KeyRing]. + // + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and + // [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] + // are required. + rpc CreateCryptoKey(CreateCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" + body: "crypto_key" + }; + option (google.api.method_signature) = "parent,crypto_key_id,crypto_key"; + } + + // Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a + // [CryptoKey][google.cloud.kms.v1.CryptoKey]. + // + // The server will assign the next sequential id. If unset, + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. + rpc CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" + body: "crypto_key_version" + }; + option (google.api.method_signature) = "parent,crypto_key_version"; + } + + // Import wrapped key material into a + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + // + // All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If + // a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is additionally + // specified in the request, key material will be reimported into that + // version. Otherwise, a new version will be created, and will be assigned the + // next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey]. + rpc ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions:import" + body: "*" + }; + } + + // Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a + // [KeyRing][google.cloud.kms.v1.KeyRing]. + // + // [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is + // required. + rpc CreateImportJob(CreateImportJobRequest) returns (ImportJob) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" + body: "import_job" + }; + option (google.api.method_signature) = "parent,import_job_id,import_job"; + } + + // Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. + rpc UpdateCryptoKey(UpdateCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { + patch: "/v1/{crypto_key.name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" + body: "crypto_key" + }; + option (google.api.method_signature) = "crypto_key,update_mask"; + } + + // Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s + // metadata. + // + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] + // and + // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] + // using this method. See + // [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] + // and + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // to move between other states. + rpc UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + patch: "/v1/{crypto_key_version.name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" + body: "crypto_key_version" + }; + option (google.api.method_signature) = "crypto_key_version,update_mask"; + } + + // Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that + // will be used in + // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. + // + // Returns an error if called on a key whose purpose is not + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + rpc UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest) + returns (CryptoKey) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:updatePrimaryVersion" + body: "*" + }; + option (google.api.method_signature) = "name,crypto_key_version_id"; + } + + // Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for + // destruction. + // + // Upon calling this method, + // [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will + // be set to + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], + // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will + // be set to the time + // [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] + // in the future. At that time, the + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically + // change to + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], + // and the key material will be irrevocably destroyed. + // + // Before the + // [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is + // reached, + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // may be called to reverse the process. + rpc DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:destroy" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + // state. + // + // Upon restoration of the CryptoKeyVersion, + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], + // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will + // be cleared. + rpc RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest) + returns (CryptoKeyVersion) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:restore" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Encrypts data, so that it can only be recovered by a call to + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + rpc Encrypt(EncryptRequest) returns (EncryptResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt" + body: "*" + }; + option (google.api.method_signature) = "name,plaintext"; + } + + // Decrypts data that was protected by + // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be + // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + rpc Decrypt(DecryptRequest) returns (DecryptResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:decrypt" + body: "*" + }; + option (google.api.method_signature) = "name,ciphertext"; + } + + // Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // ASYMMETRIC_SIGN, producing a signature that can be verified with the public + // key retrieved from + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + rpc AsymmetricSign(AsymmetricSignRequest) returns (AsymmetricSignResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricSign" + body: "*" + }; + option (google.api.method_signature) = "name,digest"; + } + + // Decrypts data that was encrypted with a public key retrieved from + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] + // corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] + // ASYMMETRIC_DECRYPT. + rpc AsymmetricDecrypt(AsymmetricDecryptRequest) + returns (AsymmetricDecryptResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricDecrypt" + body: "*" + }; + option (google.api.method_signature) = "name,ciphertext"; + } + + // Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, + // producing a tag that can be verified by another source with the same key. + rpc MacSign(MacSignRequest) returns (MacSignResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macSign" + body: "*" + }; + option (google.api.method_signature) = "name,data"; + } + + // Verifies MAC tag using a + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns + // a response that indicates whether or not the verification was successful. + rpc MacVerify(MacVerifyRequest) returns (MacVerifyResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macVerify" + body: "*" + }; + option (google.api.method_signature) = "name,data,mac"; + } + + // Generate random bytes using the Cloud KMS randomness source in the provided + // location. + rpc GenerateRandomBytes(GenerateRandomBytesRequest) + returns (GenerateRandomBytesResponse) { + option (google.api.http) = { + post: "/v1/{location=projects/*/locations/*}:generateRandomBytes" + body: "*" + }; + option (google.api.method_signature) = + "location,length_bytes,protection_level"; + } +} + +// Request message for +// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. +message ListKeyRingsRequest { + // Required. The resource name of the location associated with the + // [KeyRings][google.cloud.kms.v1.KeyRing], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Optional limit on the number of + // [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further + // [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by + // including the + // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. +message ListCryptoKeysRequest { + // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] + // to list, in the format `projects/*/locations/*/keyRings/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; + + // Optional. Optional limit on the number of + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response. + // Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be + // obtained by including the + // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // The fields of the primary version to include in the response. + CryptoKeyVersion.CryptoKeyVersionView version_view = 4; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. +message ListCryptoKeyVersionsRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Optional. Optional limit on the number of + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the + // response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] + // can subsequently be obtained by including the + // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // The fields to include in the response. + CryptoKeyVersion.CryptoKeyVersionView view = 4; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. +message ListImportJobsRequest { + // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] + // to list, in the format `projects/*/locations/*/keyRings/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; + + // Optional. Optional limit on the number of + // [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response. + // Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be + // obtained by including the + // [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token] + // in a subsequent request. If unspecified, the server will pick an + // appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional pagination token, returned earlier via + // [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only include resources that match the filter in the response. For + // more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specify how the results should be sorted. If not specified, the + // results will be sorted in the default order. For more information, see + // [Sorting and filtering list + // results](https://cloud.google.com/kms/docs/sorting-and-filtering). + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for +// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. +message ListKeyRingsResponse { + // The list of [KeyRings][google.cloud.kms.v1.KeyRing]. + repeated KeyRing key_rings = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched + // the query. + int32 total_size = 3; +} + +// Response message for +// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. +message ListCryptoKeysResponse { + // The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + repeated CryptoKey crypto_keys = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that + // matched the query. + int32 total_size = 3; +} + +// Response message for +// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. +message ListCryptoKeyVersionsResponse { + // The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + repeated CryptoKeyVersion crypto_key_versions = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the + // query. + int32 total_size = 3; +} + +// Response message for +// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. +message ListImportJobsResponse { + // The list of [ImportJobs][google.cloud.kms.v1.ImportJob]. + repeated ImportJob import_jobs = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token] + // to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that + // matched the query. + int32 total_size = 3; +} + +// Request message for +// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing]. +message GetKeyRingRequest { + // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the + // [KeyRing][google.cloud.kms.v1.KeyRing] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; +} + +// Request message for +// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey]. +message GetCryptoKeyRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; +} + +// Request message for +// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]. +message GetCryptoKeyVersionRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for +// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. +message GetPublicKeyRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for +// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]. +message GetImportJobRequest { + // Required. The [name][google.cloud.kms.v1.ImportJob.name] of the + // [ImportJob][google.cloud.kms.v1.ImportJob] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/ImportJob" + } + ]; +} + +// Request message for +// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing]. +message CreateKeyRingRequest { + // Required. The resource name of the location associated with the + // [KeyRings][google.cloud.kms.v1.KeyRing], in the format + // `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. It must be unique within a location and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string key_ring_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field + // values. + KeyRing key_ring = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]. +message CreateCryptoKeyRequest { + // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing + // associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; + + // Required. It must be unique within a KeyRing and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string crypto_key_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field + // values. + CryptoKey crypto_key = 3 [(google.api.field_behavior) = REQUIRED]; + + // If set to true, the request will create a + // [CryptoKey][google.cloud.kms.v1.CryptoKey] without any + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must + // manually call + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] + // or + // [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion] + // before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey]. + bool skip_initial_version_creation = 5; +} + +// Request message for +// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]. +message CreateCryptoKeyVersionRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the + // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with + // initial field values. + CryptoKeyVersion crypto_key_version = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. +message ImportCryptoKeyVersionRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into. + // + // The create permission is only required on this key when creating a new + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of + // an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to + // target for an import operation. If this field is not present, a new + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the + // supplied key material is created. + // + // If this field is present, the supplied key material is imported into + // the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To + // import into an existing + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of + // [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent], + // have been previously created via [ImportCryptoKeyVersion][], and be in + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED] + // or + // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED] + // state. The key material and algorithm must match the previous + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained + // key material. + string crypto_key_version = 6 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Required. The + // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + // of the key being imported. This does not need to match the + // [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into. + CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The [name][google.cloud.kms.v1.ImportJob.name] of the + // [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key + // material. + string import_job = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The incoming wrapped key material that is to be imported. + oneof wrapped_key_material { + // Wrapped key material produced with + // [RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256] + // or + // [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]. + // + // This field contains the concatenation of two wrapped keys: + //
    + //
  1. An ephemeral AES-256 wrapping key wrapped with the + // [public_key][google.cloud.kms.v1.ImportJob.public_key] using + // RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an + // empty label. + //
  2. + //
  3. The key to be imported, wrapped with the ephemeral AES-256 key + // using AES-KWP (RFC 5649). + //
  4. + //
+ // + // If importing symmetric key material, it is expected that the unwrapped + // key contains plain bytes. If importing asymmetric key material, it is + // expected that the unwrapped key is in PKCS#8-encoded DER format (the + // PrivateKeyInfo structure from RFC 5208). + // + // This format is the same as the format produced by PKCS#11 mechanism + // CKM_RSA_AES_KEY_WRAP. + bytes rsa_aes_wrapped_key = 5; + } +} + +// Request message for +// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob]. +message CreateImportJobRequest { + // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the + // [KeyRing][google.cloud.kms.v1.KeyRing] associated with the + // [ImportJobs][google.cloud.kms.v1.ImportJob]. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/KeyRing" + } + ]; + + // Required. It must be unique within a KeyRing and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string import_job_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field + // values. + ImportJob import_job = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]. +message UpdateCryptoKeyRequest { + // Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. + CryptoKey crypto_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]. +message UpdateCryptoKeyVersionRequest { + // Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with + // updated values. + CryptoKeyVersion crypto_key_version = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. +message UpdateCryptoKeyPrimaryVersionRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Required. The id of the child + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. + string crypto_key_version_id = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for +// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]. +message DestroyCryptoKeyVersionRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for +// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]. +message RestoreCryptoKeyVersionRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; +} + +// Request message for +// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. +message EncryptRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] or + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // encryption. + // + // If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server + // will use its [primary version][google.cloud.kms.v1.CryptoKey.primary]. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; + + // Required. The data to encrypt. Must be no larger than 64KiB. + // + // The maximum size depends on the key version's + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. + // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the + // plaintext must be no larger than 64KiB. For + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of + // the plaintext and additional_authenticated_data fields must be no larger + // than 8KiB. + bytes plaintext = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional data that, if specified, must also be provided during + // decryption through + // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. + // + // The maximum size depends on the key version's + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. + // For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the AAD + // must be no larger than 64KiB. For + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of + // the plaintext and additional_authenticated_data fields must be no larger + // than 8KiB. + bytes additional_authenticated_data = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]) + // is equal to + // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value plaintext_crc32c = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]) + // is equal to + // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value additional_authenticated_data_crc32c = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. +message DecryptRequest { + // Required. The resource name of the + // [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The + // server will choose the appropriate version. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Required. The encrypted data originally returned in + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + bytes ciphertext = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional data that must match the data originally supplied in + // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. + bytes additional_authenticated_data = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]) + // is equal to + // [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value ciphertext_crc32c = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]) + // is equal to + // [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value additional_authenticated_data_crc32c = 6 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. +message AsymmetricSignRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // signing. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Optional. The digest of the data to sign. The digest must be produced with + // the same digest algorithm as specified by the key version's + // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm]. + // + // This field may not be supplied if + // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] + // is supplied. + Digest digest = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]) + // is equal to + // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value digest_crc32c = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The data to sign. + // It can't be supplied if + // [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest] + // is supplied. + bytes data = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional CRC32C checksum of the + // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]) + // is equal to + // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value data_crc32c = 7 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. +message AsymmetricDecryptRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // decryption. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Required. The data encrypted with the named + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using + // OAEP. + bytes ciphertext = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional CRC32C checksum of the + // [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. + // If specified, + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // verify the integrity of the received + // [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext] + // using this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]) + // is equal to + // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value ciphertext_crc32c = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. +message MacSignRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // signing. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Required. The data to sign. The MAC tag is computed over this data field + // based on the specific algorithm. + bytes data = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional CRC32C checksum of the + // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If + // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will verify the integrity of the received + // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this + // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is + // equal to + // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value data_crc32c = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify]. +message MacVerifyRequest { + // Required. The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for + // verification. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKeyVersion" + } + ]; + + // Required. The data used previously as a + // [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate + // the MAC tag. + bytes data = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional CRC32C checksum of the + // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If + // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will verify the integrity of the received + // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using + // this checksum. + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will + // report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]) + // is equal to + // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value data_crc32c = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The signature to verify. + bytes mac = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional CRC32C checksum of the + // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If + // specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will verify the integrity of the received + // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this + // checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService] + // will report an error if the checksum verification fails. If you receive a + // checksum error, your client should verify that + // CRC32C([MacVerifyRequest.tag][]) is equal to + // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c], + // and if so, perform a limited number of retries. A persistent mismatch may + // indicate an issue in your computation of the CRC32C checksum. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value mac_crc32c = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for +// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. +message GenerateRandomBytesRequest { + // The project-specific location in which to generate random bytes. + // For example, "projects/my-project/locations/us-central1". + string location = 1; + + // The length in bytes of the amount of randomness to retrieve. Minimum 8 + // bytes, maximum 1024 bytes. + int32 length_bytes = 2; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when + // generating the random data. Currently, only + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is + // supported. + ProtectionLevel protection_level = 3; +} + +// Response message for +// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. +message EncryptResponse { + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // encryption. Check this field to verify that the intended resource was used + // for encryption. + string name = 1; + + // The encrypted data. + bytes ciphertext = 2; + + // Integrity verification field. A CRC32C checksum of the returned + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + // An integrity check of + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext] + // can be performed by computing the CRC32C checksum of + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value ciphertext_crc32c = 4; + + // Integrity verification field. A flag indicating whether + // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of + // this field indicates either that + // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_plaintext_crc32c = 5; + + // Integrity verification field. A flag indicating whether + // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A + // false value of this field indicates either that + // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_additional_authenticated_data_crc32c = 6; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // encryption. + ProtectionLevel protection_level = 7; +} + +// Response message for +// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. +message DecryptResponse { + // The decrypted data originally supplied in + // [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. + bytes plaintext = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]. + // An integrity check of + // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext] + // can be performed by computing the CRC32C checksum of + // [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: receiving this response message indicates that + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to + // successfully decrypt the + // [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This + // field is defined as int64 for reasons of compatibility across different + // languages. However, it is a non-negative integer, which will never exceed + // 2^32-1, and can be safely downconverted to uint32 in languages that support + // this type. + google.protobuf.Int64Value plaintext_crc32c = 2; + + // Whether the Decryption was performed using the primary key version. + bool used_primary = 3; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // decryption. + ProtectionLevel protection_level = 4; +} + +// Response message for +// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. +message AsymmetricSignResponse { + // The created signature. + bytes signature = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]. + // An integrity check of + // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature] + // can be performed by computing the CRC32C checksum of + // [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value signature_crc32c = 2; + + // Integrity verification field. A flag indicating whether + // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value + // of this field indicates either that + // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_digest_crc32c = 3; + + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. + // Check this field to verify that the intended resource was used for signing. + string name = 4; + + // Integrity verification field. A flag indicating whether + // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of + // this field indicates either that + // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_data_crc32c = 5; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. + ProtectionLevel protection_level = 6; +} + +// Response message for +// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. +message AsymmetricDecryptResponse { + // The decrypted data originally encrypted with the matching public key. + bytes plaintext = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]. + // An integrity check of + // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext] + // can be performed by computing the CRC32C checksum of + // [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value plaintext_crc32c = 2; + + // Integrity verification field. A flag indicating whether + // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A + // false value of this field indicates either that + // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_ciphertext_crc32c = 3; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in + // decryption. + ProtectionLevel protection_level = 4; +} + +// Response message for +// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. +message MacSignResponse { + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. + // Check this field to verify that the intended resource was used for signing. + string name = 1; + + // The created signature. + bytes mac = 2; + + // Integrity verification field. A CRC32C checksum of the returned + // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An + // integrity check of + // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be + // performed by computing the CRC32C checksum of + // [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and + // comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value mac_crc32c = 3; + + // Integrity verification field. A flag indicating whether + // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this + // field indicates either that + // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_data_crc32c = 4; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing. + ProtectionLevel protection_level = 5; +} + +// Response message for +// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify]. +message MacVerifyResponse { + // The resource name of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for + // verification. Check this field to verify that the intended resource was + // used for verification. + string name = 1; + + // This field indicates whether or not the verification operation for + // [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over + // [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was + // successful. + bool success = 2; + + // Integrity verification field. A flag indicating whether + // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this + // field indicates either that + // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_data_crc32c = 3; + + // Integrity verification field. A flag indicating whether + // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] + // was received by + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used + // for the integrity verification of the + // [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this + // field indicates either that + // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] + // was left unset or that it was not delivered to + // [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've + // set + // [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c] + // but this field is still false, discard the response and perform a limited + // number of retries. + bool verified_mac_crc32c = 4; + + // Integrity verification field. This value is used for the integrity + // verification of [MacVerifyResponse.success]. If the value of this field + // contradicts the value of [MacVerifyResponse.success], discard the response + // and perform a limited number of retries. + bool verified_success_integrity = 5; + + // The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for + // verification. + ProtectionLevel protection_level = 6; +} + +// Response message for +// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. +message GenerateRandomBytesResponse { + // The generated data. + bytes data = 1; + + // Integrity verification field. A CRC32C checksum of the returned + // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]. + // An integrity check of + // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data] + // can be performed by computing the CRC32C checksum of + // [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data] + // and comparing your results to this field. Discard the response in case of + // non-matching checksum values, and perform a limited number of retries. A + // persistent mismatch may indicate an issue in your computation of the CRC32C + // checksum. Note: This field is defined as int64 for reasons of compatibility + // across different languages. However, it is a non-negative integer, which + // will never exceed 2^32-1, and can be safely downconverted to uint32 in + // languages that support this type. + google.protobuf.Int64Value data_crc32c = 3; +} + +// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest. +message Digest { + // Required. The message digest. + oneof digest { + // A message digest produced with the SHA-256 algorithm. + bytes sha256 = 1; + + // A message digest produced with the SHA-384 algorithm. + bytes sha384 = 2; + + // A message digest produced with the SHA-512 algorithm. + bytes sha512 = 3; + } +} + +// Cloud KMS metadata for the given +// [google.cloud.location.Location][google.cloud.location.Location]. +message LocationMetadata { + // Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] + // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this + // location. + bool hsm_available = 1; + + // Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with + // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] + // [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in + // this location. + bool ekm_available = 2; +} diff --git a/packages/google-cloud-kms/protos/protos.d.ts b/packages/google-cloud-kms/protos/protos.d.ts new file mode 100644 index 00000000000..6b1a2b361e7 --- /dev/null +++ b/packages/google-cloud-kms/protos/protos.d.ts @@ -0,0 +1,12448 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); +/** Namespace google. */ +export namespace google { + + /** Namespace cloud. */ + namespace cloud { + + /** Namespace kms. */ + namespace kms { + + /** Namespace v1. */ + namespace v1 { + + /** Represents an EkmService */ + class EkmService extends $protobuf.rpc.Service { + + /** + * Constructs a new EkmService 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 EkmService 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): EkmService; + + /** + * Calls ListEkmConnections. + * @param request ListEkmConnectionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEkmConnectionsResponse + */ + public listEkmConnections(request: google.cloud.kms.v1.IListEkmConnectionsRequest, callback: google.cloud.kms.v1.EkmService.ListEkmConnectionsCallback): void; + + /** + * Calls ListEkmConnections. + * @param request ListEkmConnectionsRequest message or plain object + * @returns Promise + */ + public listEkmConnections(request: google.cloud.kms.v1.IListEkmConnectionsRequest): Promise; + + /** + * Calls GetEkmConnection. + * @param request GetEkmConnectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EkmConnection + */ + public getEkmConnection(request: google.cloud.kms.v1.IGetEkmConnectionRequest, callback: google.cloud.kms.v1.EkmService.GetEkmConnectionCallback): void; + + /** + * Calls GetEkmConnection. + * @param request GetEkmConnectionRequest message or plain object + * @returns Promise + */ + public getEkmConnection(request: google.cloud.kms.v1.IGetEkmConnectionRequest): Promise; + + /** + * Calls CreateEkmConnection. + * @param request CreateEkmConnectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EkmConnection + */ + public createEkmConnection(request: google.cloud.kms.v1.ICreateEkmConnectionRequest, callback: google.cloud.kms.v1.EkmService.CreateEkmConnectionCallback): void; + + /** + * Calls CreateEkmConnection. + * @param request CreateEkmConnectionRequest message or plain object + * @returns Promise + */ + public createEkmConnection(request: google.cloud.kms.v1.ICreateEkmConnectionRequest): Promise; + + /** + * Calls UpdateEkmConnection. + * @param request UpdateEkmConnectionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EkmConnection + */ + public updateEkmConnection(request: google.cloud.kms.v1.IUpdateEkmConnectionRequest, callback: google.cloud.kms.v1.EkmService.UpdateEkmConnectionCallback): void; + + /** + * Calls UpdateEkmConnection. + * @param request UpdateEkmConnectionRequest message or plain object + * @returns Promise + */ + public updateEkmConnection(request: google.cloud.kms.v1.IUpdateEkmConnectionRequest): Promise; + } + + namespace EkmService { + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|listEkmConnections}. + * @param error Error, if any + * @param [response] ListEkmConnectionsResponse + */ + type ListEkmConnectionsCallback = (error: (Error|null), response?: google.cloud.kms.v1.ListEkmConnectionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|getEkmConnection}. + * @param error Error, if any + * @param [response] EkmConnection + */ + type GetEkmConnectionCallback = (error: (Error|null), response?: google.cloud.kms.v1.EkmConnection) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|createEkmConnection}. + * @param error Error, if any + * @param [response] EkmConnection + */ + type CreateEkmConnectionCallback = (error: (Error|null), response?: google.cloud.kms.v1.EkmConnection) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|updateEkmConnection}. + * @param error Error, if any + * @param [response] EkmConnection + */ + type UpdateEkmConnectionCallback = (error: (Error|null), response?: google.cloud.kms.v1.EkmConnection) => void; + } + + /** Properties of a ListEkmConnectionsRequest. */ + interface IListEkmConnectionsRequest { + + /** ListEkmConnectionsRequest parent */ + parent?: (string|null); + + /** ListEkmConnectionsRequest pageSize */ + pageSize?: (number|null); + + /** ListEkmConnectionsRequest pageToken */ + pageToken?: (string|null); + + /** ListEkmConnectionsRequest filter */ + filter?: (string|null); + + /** ListEkmConnectionsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListEkmConnectionsRequest. */ + class ListEkmConnectionsRequest implements IListEkmConnectionsRequest { + + /** + * Constructs a new ListEkmConnectionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListEkmConnectionsRequest); + + /** ListEkmConnectionsRequest parent. */ + public parent: string; + + /** ListEkmConnectionsRequest pageSize. */ + public pageSize: number; + + /** ListEkmConnectionsRequest pageToken. */ + public pageToken: string; + + /** ListEkmConnectionsRequest filter. */ + public filter: string; + + /** ListEkmConnectionsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListEkmConnectionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEkmConnectionsRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IListEkmConnectionsRequest): google.cloud.kms.v1.ListEkmConnectionsRequest; + + /** + * Encodes the specified ListEkmConnectionsRequest message. Does not implicitly {@link google.cloud.kms.v1.ListEkmConnectionsRequest.verify|verify} messages. + * @param message ListEkmConnectionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListEkmConnectionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEkmConnectionsRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListEkmConnectionsRequest.verify|verify} messages. + * @param message ListEkmConnectionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListEkmConnectionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEkmConnectionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEkmConnectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListEkmConnectionsRequest; + + /** + * Decodes a ListEkmConnectionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEkmConnectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListEkmConnectionsRequest; + + /** + * Verifies a ListEkmConnectionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEkmConnectionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEkmConnectionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListEkmConnectionsRequest; + + /** + * Creates a plain object from a ListEkmConnectionsRequest message. Also converts values to other types if specified. + * @param message ListEkmConnectionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListEkmConnectionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEkmConnectionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEkmConnectionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEkmConnectionsResponse. */ + interface IListEkmConnectionsResponse { + + /** ListEkmConnectionsResponse ekmConnections */ + ekmConnections?: (google.cloud.kms.v1.IEkmConnection[]|null); + + /** ListEkmConnectionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListEkmConnectionsResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListEkmConnectionsResponse. */ + class ListEkmConnectionsResponse implements IListEkmConnectionsResponse { + + /** + * Constructs a new ListEkmConnectionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListEkmConnectionsResponse); + + /** ListEkmConnectionsResponse ekmConnections. */ + public ekmConnections: google.cloud.kms.v1.IEkmConnection[]; + + /** ListEkmConnectionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListEkmConnectionsResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListEkmConnectionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEkmConnectionsResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IListEkmConnectionsResponse): google.cloud.kms.v1.ListEkmConnectionsResponse; + + /** + * Encodes the specified ListEkmConnectionsResponse message. Does not implicitly {@link google.cloud.kms.v1.ListEkmConnectionsResponse.verify|verify} messages. + * @param message ListEkmConnectionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListEkmConnectionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEkmConnectionsResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListEkmConnectionsResponse.verify|verify} messages. + * @param message ListEkmConnectionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListEkmConnectionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEkmConnectionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEkmConnectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListEkmConnectionsResponse; + + /** + * Decodes a ListEkmConnectionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEkmConnectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListEkmConnectionsResponse; + + /** + * Verifies a ListEkmConnectionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEkmConnectionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEkmConnectionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListEkmConnectionsResponse; + + /** + * Creates a plain object from a ListEkmConnectionsResponse message. Also converts values to other types if specified. + * @param message ListEkmConnectionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListEkmConnectionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEkmConnectionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEkmConnectionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetEkmConnectionRequest. */ + interface IGetEkmConnectionRequest { + + /** GetEkmConnectionRequest name */ + name?: (string|null); + } + + /** Represents a GetEkmConnectionRequest. */ + class GetEkmConnectionRequest implements IGetEkmConnectionRequest { + + /** + * Constructs a new GetEkmConnectionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IGetEkmConnectionRequest); + + /** GetEkmConnectionRequest name. */ + public name: string; + + /** + * Creates a new GetEkmConnectionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEkmConnectionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IGetEkmConnectionRequest): google.cloud.kms.v1.GetEkmConnectionRequest; + + /** + * Encodes the specified GetEkmConnectionRequest message. Does not implicitly {@link google.cloud.kms.v1.GetEkmConnectionRequest.verify|verify} messages. + * @param message GetEkmConnectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IGetEkmConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEkmConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetEkmConnectionRequest.verify|verify} messages. + * @param message GetEkmConnectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IGetEkmConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEkmConnectionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.GetEkmConnectionRequest; + + /** + * Decodes a GetEkmConnectionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.GetEkmConnectionRequest; + + /** + * Verifies a GetEkmConnectionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetEkmConnectionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEkmConnectionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.GetEkmConnectionRequest; + + /** + * Creates a plain object from a GetEkmConnectionRequest message. Also converts values to other types if specified. + * @param message GetEkmConnectionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.GetEkmConnectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEkmConnectionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetEkmConnectionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateEkmConnectionRequest. */ + interface ICreateEkmConnectionRequest { + + /** CreateEkmConnectionRequest parent */ + parent?: (string|null); + + /** CreateEkmConnectionRequest ekmConnectionId */ + ekmConnectionId?: (string|null); + + /** CreateEkmConnectionRequest ekmConnection */ + ekmConnection?: (google.cloud.kms.v1.IEkmConnection|null); + } + + /** Represents a CreateEkmConnectionRequest. */ + class CreateEkmConnectionRequest implements ICreateEkmConnectionRequest { + + /** + * Constructs a new CreateEkmConnectionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICreateEkmConnectionRequest); + + /** CreateEkmConnectionRequest parent. */ + public parent: string; + + /** CreateEkmConnectionRequest ekmConnectionId. */ + public ekmConnectionId: string; + + /** CreateEkmConnectionRequest ekmConnection. */ + public ekmConnection?: (google.cloud.kms.v1.IEkmConnection|null); + + /** + * Creates a new CreateEkmConnectionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateEkmConnectionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.ICreateEkmConnectionRequest): google.cloud.kms.v1.CreateEkmConnectionRequest; + + /** + * Encodes the specified CreateEkmConnectionRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateEkmConnectionRequest.verify|verify} messages. + * @param message CreateEkmConnectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICreateEkmConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateEkmConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateEkmConnectionRequest.verify|verify} messages. + * @param message CreateEkmConnectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICreateEkmConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateEkmConnectionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.CreateEkmConnectionRequest; + + /** + * Decodes a CreateEkmConnectionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.CreateEkmConnectionRequest; + + /** + * Verifies a CreateEkmConnectionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateEkmConnectionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateEkmConnectionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.CreateEkmConnectionRequest; + + /** + * Creates a plain object from a CreateEkmConnectionRequest message. Also converts values to other types if specified. + * @param message CreateEkmConnectionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.CreateEkmConnectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateEkmConnectionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateEkmConnectionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateEkmConnectionRequest. */ + interface IUpdateEkmConnectionRequest { + + /** UpdateEkmConnectionRequest ekmConnection */ + ekmConnection?: (google.cloud.kms.v1.IEkmConnection|null); + + /** UpdateEkmConnectionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateEkmConnectionRequest. */ + class UpdateEkmConnectionRequest implements IUpdateEkmConnectionRequest { + + /** + * Constructs a new UpdateEkmConnectionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IUpdateEkmConnectionRequest); + + /** UpdateEkmConnectionRequest ekmConnection. */ + public ekmConnection?: (google.cloud.kms.v1.IEkmConnection|null); + + /** UpdateEkmConnectionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateEkmConnectionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateEkmConnectionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IUpdateEkmConnectionRequest): google.cloud.kms.v1.UpdateEkmConnectionRequest; + + /** + * Encodes the specified UpdateEkmConnectionRequest message. Does not implicitly {@link google.cloud.kms.v1.UpdateEkmConnectionRequest.verify|verify} messages. + * @param message UpdateEkmConnectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IUpdateEkmConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateEkmConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.UpdateEkmConnectionRequest.verify|verify} messages. + * @param message UpdateEkmConnectionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IUpdateEkmConnectionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateEkmConnectionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.UpdateEkmConnectionRequest; + + /** + * Decodes an UpdateEkmConnectionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.UpdateEkmConnectionRequest; + + /** + * Verifies an UpdateEkmConnectionRequest message. + * @param message Plain 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 UpdateEkmConnectionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateEkmConnectionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.UpdateEkmConnectionRequest; + + /** + * Creates a plain object from an UpdateEkmConnectionRequest message. Also converts values to other types if specified. + * @param message UpdateEkmConnectionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.UpdateEkmConnectionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateEkmConnectionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateEkmConnectionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Certificate. */ + interface ICertificate { + + /** Certificate rawDer */ + rawDer?: (Uint8Array|string|null); + + /** Certificate parsed */ + parsed?: (boolean|null); + + /** Certificate issuer */ + issuer?: (string|null); + + /** Certificate subject */ + subject?: (string|null); + + /** Certificate subjectAlternativeDnsNames */ + subjectAlternativeDnsNames?: (string[]|null); + + /** Certificate notBeforeTime */ + notBeforeTime?: (google.protobuf.ITimestamp|null); + + /** Certificate notAfterTime */ + notAfterTime?: (google.protobuf.ITimestamp|null); + + /** Certificate serialNumber */ + serialNumber?: (string|null); + + /** Certificate sha256Fingerprint */ + sha256Fingerprint?: (string|null); + } + + /** Represents a Certificate. */ + class Certificate implements ICertificate { + + /** + * Constructs a new Certificate. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICertificate); + + /** Certificate rawDer. */ + public rawDer: (Uint8Array|string); + + /** Certificate parsed. */ + public parsed: boolean; + + /** Certificate issuer. */ + public issuer: string; + + /** Certificate subject. */ + public subject: string; + + /** Certificate subjectAlternativeDnsNames. */ + public subjectAlternativeDnsNames: string[]; + + /** Certificate notBeforeTime. */ + public notBeforeTime?: (google.protobuf.ITimestamp|null); + + /** Certificate notAfterTime. */ + public notAfterTime?: (google.protobuf.ITimestamp|null); + + /** Certificate serialNumber. */ + public serialNumber: string; + + /** Certificate sha256Fingerprint. */ + public sha256Fingerprint: string; + + /** + * Creates a new Certificate instance using the specified properties. + * @param [properties] Properties to set + * @returns Certificate instance + */ + public static create(properties?: google.cloud.kms.v1.ICertificate): google.cloud.kms.v1.Certificate; + + /** + * Encodes the specified Certificate message. Does not implicitly {@link google.cloud.kms.v1.Certificate.verify|verify} messages. + * @param message Certificate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICertificate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Certificate message, length delimited. Does not implicitly {@link google.cloud.kms.v1.Certificate.verify|verify} messages. + * @param message Certificate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICertificate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Certificate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Certificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.Certificate; + + /** + * Decodes a Certificate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Certificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.Certificate; + + /** + * Verifies a Certificate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Certificate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Certificate + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.Certificate; + + /** + * Creates a plain object from a Certificate message. Also converts values to other types if specified. + * @param message Certificate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.Certificate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Certificate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Certificate + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EkmConnection. */ + interface IEkmConnection { + + /** EkmConnection name */ + name?: (string|null); + + /** EkmConnection createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** EkmConnection serviceResolvers */ + serviceResolvers?: (google.cloud.kms.v1.EkmConnection.IServiceResolver[]|null); + + /** EkmConnection etag */ + etag?: (string|null); + } + + /** Represents an EkmConnection. */ + class EkmConnection implements IEkmConnection { + + /** + * Constructs a new EkmConnection. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IEkmConnection); + + /** EkmConnection name. */ + public name: string; + + /** EkmConnection createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** EkmConnection serviceResolvers. */ + public serviceResolvers: google.cloud.kms.v1.EkmConnection.IServiceResolver[]; + + /** EkmConnection etag. */ + public etag: string; + + /** + * Creates a new EkmConnection instance using the specified properties. + * @param [properties] Properties to set + * @returns EkmConnection instance + */ + public static create(properties?: google.cloud.kms.v1.IEkmConnection): google.cloud.kms.v1.EkmConnection; + + /** + * Encodes the specified EkmConnection message. Does not implicitly {@link google.cloud.kms.v1.EkmConnection.verify|verify} messages. + * @param message EkmConnection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IEkmConnection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EkmConnection message, length delimited. Does not implicitly {@link google.cloud.kms.v1.EkmConnection.verify|verify} messages. + * @param message EkmConnection message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IEkmConnection, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EkmConnection message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EkmConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.EkmConnection; + + /** + * Decodes an EkmConnection message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EkmConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.EkmConnection; + + /** + * Verifies an EkmConnection message. + * @param message Plain 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 EkmConnection message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EkmConnection + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.EkmConnection; + + /** + * Creates a plain object from an EkmConnection message. Also converts values to other types if specified. + * @param message EkmConnection + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.EkmConnection, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EkmConnection to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EkmConnection + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EkmConnection { + + /** Properties of a ServiceResolver. */ + interface IServiceResolver { + + /** ServiceResolver serviceDirectoryService */ + serviceDirectoryService?: (string|null); + + /** ServiceResolver endpointFilter */ + endpointFilter?: (string|null); + + /** ServiceResolver hostname */ + hostname?: (string|null); + + /** ServiceResolver serverCertificates */ + serverCertificates?: (google.cloud.kms.v1.ICertificate[]|null); + } + + /** Represents a ServiceResolver. */ + class ServiceResolver implements IServiceResolver { + + /** + * Constructs a new ServiceResolver. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.EkmConnection.IServiceResolver); + + /** ServiceResolver serviceDirectoryService. */ + public serviceDirectoryService: string; + + /** ServiceResolver endpointFilter. */ + public endpointFilter: string; + + /** ServiceResolver hostname. */ + public hostname: string; + + /** ServiceResolver serverCertificates. */ + public serverCertificates: google.cloud.kms.v1.ICertificate[]; + + /** + * Creates a new ServiceResolver instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceResolver instance + */ + public static create(properties?: google.cloud.kms.v1.EkmConnection.IServiceResolver): google.cloud.kms.v1.EkmConnection.ServiceResolver; + + /** + * Encodes the specified ServiceResolver message. Does not implicitly {@link google.cloud.kms.v1.EkmConnection.ServiceResolver.verify|verify} messages. + * @param message ServiceResolver message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.EkmConnection.IServiceResolver, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceResolver message, length delimited. Does not implicitly {@link google.cloud.kms.v1.EkmConnection.ServiceResolver.verify|verify} messages. + * @param message ServiceResolver message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.EkmConnection.IServiceResolver, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceResolver message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceResolver + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.EkmConnection.ServiceResolver; + + /** + * Decodes a ServiceResolver message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceResolver + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.EkmConnection.ServiceResolver; + + /** + * Verifies a ServiceResolver message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceResolver message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceResolver + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.EkmConnection.ServiceResolver; + + /** + * Creates a plain object from a ServiceResolver message. Also converts values to other types if specified. + * @param message ServiceResolver + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.EkmConnection.ServiceResolver, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceResolver to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceResolver + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a KeyRing. */ + interface IKeyRing { + + /** KeyRing name */ + name?: (string|null); + + /** KeyRing createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a KeyRing. */ + class KeyRing implements IKeyRing { + + /** + * Constructs a new KeyRing. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IKeyRing); + + /** KeyRing name. */ + public name: string; + + /** KeyRing createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new KeyRing instance using the specified properties. + * @param [properties] Properties to set + * @returns KeyRing instance + */ + public static create(properties?: google.cloud.kms.v1.IKeyRing): google.cloud.kms.v1.KeyRing; + + /** + * Encodes the specified KeyRing message. Does not implicitly {@link google.cloud.kms.v1.KeyRing.verify|verify} messages. + * @param message KeyRing message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IKeyRing, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KeyRing message, length delimited. Does not implicitly {@link google.cloud.kms.v1.KeyRing.verify|verify} messages. + * @param message KeyRing message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IKeyRing, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KeyRing message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeyRing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.KeyRing; + + /** + * Decodes a KeyRing message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeyRing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.KeyRing; + + /** + * Verifies a KeyRing message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KeyRing message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeyRing + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.KeyRing; + + /** + * Creates a plain object from a KeyRing message. Also converts values to other types if specified. + * @param message KeyRing + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.KeyRing, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeyRing to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KeyRing + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CryptoKey. */ + interface ICryptoKey { + + /** CryptoKey name */ + name?: (string|null); + + /** CryptoKey primary */ + primary?: (google.cloud.kms.v1.ICryptoKeyVersion|null); + + /** CryptoKey purpose */ + purpose?: (google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose|keyof typeof google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose|null); + + /** CryptoKey createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKey nextRotationTime */ + nextRotationTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKey rotationPeriod */ + rotationPeriod?: (google.protobuf.IDuration|null); + + /** CryptoKey versionTemplate */ + versionTemplate?: (google.cloud.kms.v1.ICryptoKeyVersionTemplate|null); + + /** CryptoKey labels */ + labels?: ({ [k: string]: string }|null); + + /** CryptoKey importOnly */ + importOnly?: (boolean|null); + + /** CryptoKey destroyScheduledDuration */ + destroyScheduledDuration?: (google.protobuf.IDuration|null); + + /** CryptoKey cryptoKeyBackend */ + cryptoKeyBackend?: (string|null); + } + + /** Represents a CryptoKey. */ + class CryptoKey implements ICryptoKey { + + /** + * Constructs a new CryptoKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICryptoKey); + + /** CryptoKey name. */ + public name: string; + + /** CryptoKey primary. */ + public primary?: (google.cloud.kms.v1.ICryptoKeyVersion|null); + + /** CryptoKey purpose. */ + public purpose: (google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose|keyof typeof google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose); + + /** CryptoKey createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKey nextRotationTime. */ + public nextRotationTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKey rotationPeriod. */ + public rotationPeriod?: (google.protobuf.IDuration|null); + + /** CryptoKey versionTemplate. */ + public versionTemplate?: (google.cloud.kms.v1.ICryptoKeyVersionTemplate|null); + + /** CryptoKey labels. */ + public labels: { [k: string]: string }; + + /** CryptoKey importOnly. */ + public importOnly: boolean; + + /** CryptoKey destroyScheduledDuration. */ + public destroyScheduledDuration?: (google.protobuf.IDuration|null); + + /** CryptoKey cryptoKeyBackend. */ + public cryptoKeyBackend: string; + + /** CryptoKey rotationSchedule. */ + public rotationSchedule?: "rotationPeriod"; + + /** + * Creates a new CryptoKey instance using the specified properties. + * @param [properties] Properties to set + * @returns CryptoKey instance + */ + public static create(properties?: google.cloud.kms.v1.ICryptoKey): google.cloud.kms.v1.CryptoKey; + + /** + * Encodes the specified CryptoKey message. Does not implicitly {@link google.cloud.kms.v1.CryptoKey.verify|verify} messages. + * @param message CryptoKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICryptoKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CryptoKey message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CryptoKey.verify|verify} messages. + * @param message CryptoKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICryptoKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CryptoKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CryptoKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.CryptoKey; + + /** + * Decodes a CryptoKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CryptoKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.CryptoKey; + + /** + * Verifies a CryptoKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CryptoKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CryptoKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.CryptoKey; + + /** + * Creates a plain object from a CryptoKey message. Also converts values to other types if specified. + * @param message CryptoKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.CryptoKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CryptoKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CryptoKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CryptoKey { + + /** CryptoKeyPurpose enum. */ + enum CryptoKeyPurpose { + CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0, + ENCRYPT_DECRYPT = 1, + ASYMMETRIC_SIGN = 5, + ASYMMETRIC_DECRYPT = 6, + MAC = 9 + } + } + + /** Properties of a CryptoKeyVersionTemplate. */ + interface ICryptoKeyVersionTemplate { + + /** CryptoKeyVersionTemplate protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + + /** CryptoKeyVersionTemplate algorithm */ + algorithm?: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|null); + } + + /** Represents a CryptoKeyVersionTemplate. */ + class CryptoKeyVersionTemplate implements ICryptoKeyVersionTemplate { + + /** + * Constructs a new CryptoKeyVersionTemplate. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICryptoKeyVersionTemplate); + + /** CryptoKeyVersionTemplate protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** CryptoKeyVersionTemplate algorithm. */ + public algorithm: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm); + + /** + * Creates a new CryptoKeyVersionTemplate instance using the specified properties. + * @param [properties] Properties to set + * @returns CryptoKeyVersionTemplate instance + */ + public static create(properties?: google.cloud.kms.v1.ICryptoKeyVersionTemplate): google.cloud.kms.v1.CryptoKeyVersionTemplate; + + /** + * Encodes the specified CryptoKeyVersionTemplate message. Does not implicitly {@link google.cloud.kms.v1.CryptoKeyVersionTemplate.verify|verify} messages. + * @param message CryptoKeyVersionTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICryptoKeyVersionTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CryptoKeyVersionTemplate message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CryptoKeyVersionTemplate.verify|verify} messages. + * @param message CryptoKeyVersionTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICryptoKeyVersionTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CryptoKeyVersionTemplate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CryptoKeyVersionTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.CryptoKeyVersionTemplate; + + /** + * Decodes a CryptoKeyVersionTemplate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CryptoKeyVersionTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.CryptoKeyVersionTemplate; + + /** + * Verifies a CryptoKeyVersionTemplate message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CryptoKeyVersionTemplate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CryptoKeyVersionTemplate + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.CryptoKeyVersionTemplate; + + /** + * Creates a plain object from a CryptoKeyVersionTemplate message. Also converts values to other types if specified. + * @param message CryptoKeyVersionTemplate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.CryptoKeyVersionTemplate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CryptoKeyVersionTemplate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CryptoKeyVersionTemplate + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a KeyOperationAttestation. */ + interface IKeyOperationAttestation { + + /** KeyOperationAttestation format */ + format?: (google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat|keyof typeof google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat|null); + + /** KeyOperationAttestation content */ + content?: (Uint8Array|string|null); + + /** KeyOperationAttestation certChains */ + certChains?: (google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains|null); + } + + /** Represents a KeyOperationAttestation. */ + class KeyOperationAttestation implements IKeyOperationAttestation { + + /** + * Constructs a new KeyOperationAttestation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IKeyOperationAttestation); + + /** KeyOperationAttestation format. */ + public format: (google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat|keyof typeof google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat); + + /** KeyOperationAttestation content. */ + public content: (Uint8Array|string); + + /** KeyOperationAttestation certChains. */ + public certChains?: (google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains|null); + + /** + * Creates a new KeyOperationAttestation instance using the specified properties. + * @param [properties] Properties to set + * @returns KeyOperationAttestation instance + */ + public static create(properties?: google.cloud.kms.v1.IKeyOperationAttestation): google.cloud.kms.v1.KeyOperationAttestation; + + /** + * Encodes the specified KeyOperationAttestation message. Does not implicitly {@link google.cloud.kms.v1.KeyOperationAttestation.verify|verify} messages. + * @param message KeyOperationAttestation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IKeyOperationAttestation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KeyOperationAttestation message, length delimited. Does not implicitly {@link google.cloud.kms.v1.KeyOperationAttestation.verify|verify} messages. + * @param message KeyOperationAttestation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IKeyOperationAttestation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KeyOperationAttestation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KeyOperationAttestation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.KeyOperationAttestation; + + /** + * Decodes a KeyOperationAttestation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KeyOperationAttestation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.KeyOperationAttestation; + + /** + * Verifies a KeyOperationAttestation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KeyOperationAttestation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KeyOperationAttestation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.KeyOperationAttestation; + + /** + * Creates a plain object from a KeyOperationAttestation message. Also converts values to other types if specified. + * @param message KeyOperationAttestation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.KeyOperationAttestation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KeyOperationAttestation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KeyOperationAttestation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace KeyOperationAttestation { + + /** AttestationFormat enum. */ + enum AttestationFormat { + ATTESTATION_FORMAT_UNSPECIFIED = 0, + CAVIUM_V1_COMPRESSED = 3, + CAVIUM_V2_COMPRESSED = 4 + } + + /** Properties of a CertificateChains. */ + interface ICertificateChains { + + /** CertificateChains caviumCerts */ + caviumCerts?: (string[]|null); + + /** CertificateChains googleCardCerts */ + googleCardCerts?: (string[]|null); + + /** CertificateChains googlePartitionCerts */ + googlePartitionCerts?: (string[]|null); + } + + /** Represents a CertificateChains. */ + class CertificateChains implements ICertificateChains { + + /** + * Constructs a new CertificateChains. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains); + + /** CertificateChains caviumCerts. */ + public caviumCerts: string[]; + + /** CertificateChains googleCardCerts. */ + public googleCardCerts: string[]; + + /** CertificateChains googlePartitionCerts. */ + public googlePartitionCerts: string[]; + + /** + * Creates a new CertificateChains instance using the specified properties. + * @param [properties] Properties to set + * @returns CertificateChains instance + */ + public static create(properties?: google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains): google.cloud.kms.v1.KeyOperationAttestation.CertificateChains; + + /** + * Encodes the specified CertificateChains message. Does not implicitly {@link google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.verify|verify} messages. + * @param message CertificateChains message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CertificateChains message, length delimited. Does not implicitly {@link google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.verify|verify} messages. + * @param message CertificateChains message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CertificateChains message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CertificateChains + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.KeyOperationAttestation.CertificateChains; + + /** + * Decodes a CertificateChains message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CertificateChains + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.KeyOperationAttestation.CertificateChains; + + /** + * Verifies a CertificateChains message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CertificateChains message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CertificateChains + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.KeyOperationAttestation.CertificateChains; + + /** + * Creates a plain object from a CertificateChains message. Also converts values to other types if specified. + * @param message CertificateChains + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.KeyOperationAttestation.CertificateChains, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CertificateChains to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CertificateChains + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a CryptoKeyVersion. */ + interface ICryptoKeyVersion { + + /** CryptoKeyVersion name */ + name?: (string|null); + + /** CryptoKeyVersion state */ + state?: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState|null); + + /** CryptoKeyVersion protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + + /** CryptoKeyVersion algorithm */ + algorithm?: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|null); + + /** CryptoKeyVersion attestation */ + attestation?: (google.cloud.kms.v1.IKeyOperationAttestation|null); + + /** CryptoKeyVersion createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion generateTime */ + generateTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion destroyTime */ + destroyTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion destroyEventTime */ + destroyEventTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion importJob */ + importJob?: (string|null); + + /** CryptoKeyVersion importTime */ + importTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion importFailureReason */ + importFailureReason?: (string|null); + + /** CryptoKeyVersion externalProtectionLevelOptions */ + externalProtectionLevelOptions?: (google.cloud.kms.v1.IExternalProtectionLevelOptions|null); + + /** CryptoKeyVersion reimportEligible */ + reimportEligible?: (boolean|null); + } + + /** Represents a CryptoKeyVersion. */ + class CryptoKeyVersion implements ICryptoKeyVersion { + + /** + * Constructs a new CryptoKeyVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICryptoKeyVersion); + + /** CryptoKeyVersion name. */ + public name: string; + + /** CryptoKeyVersion state. */ + public state: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState); + + /** CryptoKeyVersion protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** CryptoKeyVersion algorithm. */ + public algorithm: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm); + + /** CryptoKeyVersion attestation. */ + public attestation?: (google.cloud.kms.v1.IKeyOperationAttestation|null); + + /** CryptoKeyVersion createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion generateTime. */ + public generateTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion destroyTime. */ + public destroyTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion destroyEventTime. */ + public destroyEventTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion importJob. */ + public importJob: string; + + /** CryptoKeyVersion importTime. */ + public importTime?: (google.protobuf.ITimestamp|null); + + /** CryptoKeyVersion importFailureReason. */ + public importFailureReason: string; + + /** CryptoKeyVersion externalProtectionLevelOptions. */ + public externalProtectionLevelOptions?: (google.cloud.kms.v1.IExternalProtectionLevelOptions|null); + + /** CryptoKeyVersion reimportEligible. */ + public reimportEligible: boolean; + + /** + * Creates a new CryptoKeyVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns CryptoKeyVersion instance + */ + public static create(properties?: google.cloud.kms.v1.ICryptoKeyVersion): google.cloud.kms.v1.CryptoKeyVersion; + + /** + * Encodes the specified CryptoKeyVersion message. Does not implicitly {@link google.cloud.kms.v1.CryptoKeyVersion.verify|verify} messages. + * @param message CryptoKeyVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICryptoKeyVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CryptoKeyVersion message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CryptoKeyVersion.verify|verify} messages. + * @param message CryptoKeyVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICryptoKeyVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CryptoKeyVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CryptoKeyVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.CryptoKeyVersion; + + /** + * Decodes a CryptoKeyVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CryptoKeyVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.CryptoKeyVersion; + + /** + * Verifies a CryptoKeyVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CryptoKeyVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CryptoKeyVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.CryptoKeyVersion; + + /** + * Creates a plain object from a CryptoKeyVersion message. Also converts values to other types if specified. + * @param message CryptoKeyVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.CryptoKeyVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CryptoKeyVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CryptoKeyVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CryptoKeyVersion { + + /** CryptoKeyVersionAlgorithm enum. */ + enum CryptoKeyVersionAlgorithm { + CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0, + GOOGLE_SYMMETRIC_ENCRYPTION = 1, + RSA_SIGN_PSS_2048_SHA256 = 2, + RSA_SIGN_PSS_3072_SHA256 = 3, + RSA_SIGN_PSS_4096_SHA256 = 4, + RSA_SIGN_PSS_4096_SHA512 = 15, + RSA_SIGN_PKCS1_2048_SHA256 = 5, + RSA_SIGN_PKCS1_3072_SHA256 = 6, + RSA_SIGN_PKCS1_4096_SHA256 = 7, + RSA_SIGN_PKCS1_4096_SHA512 = 16, + RSA_SIGN_RAW_PKCS1_2048 = 28, + RSA_SIGN_RAW_PKCS1_3072 = 29, + RSA_SIGN_RAW_PKCS1_4096 = 30, + RSA_DECRYPT_OAEP_2048_SHA256 = 8, + RSA_DECRYPT_OAEP_3072_SHA256 = 9, + RSA_DECRYPT_OAEP_4096_SHA256 = 10, + RSA_DECRYPT_OAEP_4096_SHA512 = 17, + RSA_DECRYPT_OAEP_2048_SHA1 = 37, + RSA_DECRYPT_OAEP_3072_SHA1 = 38, + RSA_DECRYPT_OAEP_4096_SHA1 = 39, + EC_SIGN_P256_SHA256 = 12, + EC_SIGN_P384_SHA384 = 13, + EC_SIGN_SECP256K1_SHA256 = 31, + HMAC_SHA256 = 32, + EXTERNAL_SYMMETRIC_ENCRYPTION = 18 + } + + /** CryptoKeyVersionState enum. */ + enum CryptoKeyVersionState { + CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0, + PENDING_GENERATION = 5, + ENABLED = 1, + DISABLED = 2, + DESTROYED = 3, + DESTROY_SCHEDULED = 4, + PENDING_IMPORT = 6, + IMPORT_FAILED = 7 + } + + /** CryptoKeyVersionView enum. */ + enum CryptoKeyVersionView { + CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0, + FULL = 1 + } + } + + /** Properties of a PublicKey. */ + interface IPublicKey { + + /** PublicKey pem */ + pem?: (string|null); + + /** PublicKey algorithm */ + algorithm?: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|null); + + /** PublicKey pemCrc32c */ + pemCrc32c?: (google.protobuf.IInt64Value|null); + + /** PublicKey name */ + name?: (string|null); + + /** PublicKey protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + } + + /** Represents a PublicKey. */ + class PublicKey implements IPublicKey { + + /** + * Constructs a new PublicKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IPublicKey); + + /** PublicKey pem. */ + public pem: string; + + /** PublicKey algorithm. */ + public algorithm: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm); + + /** PublicKey pemCrc32c. */ + public pemCrc32c?: (google.protobuf.IInt64Value|null); + + /** PublicKey name. */ + public name: string; + + /** PublicKey protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** + * Creates a new PublicKey instance using the specified properties. + * @param [properties] Properties to set + * @returns PublicKey instance + */ + public static create(properties?: google.cloud.kms.v1.IPublicKey): google.cloud.kms.v1.PublicKey; + + /** + * Encodes the specified PublicKey message. Does not implicitly {@link google.cloud.kms.v1.PublicKey.verify|verify} messages. + * @param message PublicKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IPublicKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PublicKey message, length delimited. Does not implicitly {@link google.cloud.kms.v1.PublicKey.verify|verify} messages. + * @param message PublicKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IPublicKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PublicKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.PublicKey; + + /** + * Decodes a PublicKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.PublicKey; + + /** + * Verifies a PublicKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PublicKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PublicKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.PublicKey; + + /** + * Creates a plain object from a PublicKey message. Also converts values to other types if specified. + * @param message PublicKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.PublicKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PublicKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PublicKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportJob. */ + interface IImportJob { + + /** ImportJob name */ + name?: (string|null); + + /** ImportJob importMethod */ + importMethod?: (google.cloud.kms.v1.ImportJob.ImportMethod|keyof typeof google.cloud.kms.v1.ImportJob.ImportMethod|null); + + /** ImportJob protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + + /** ImportJob createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ImportJob generateTime */ + generateTime?: (google.protobuf.ITimestamp|null); + + /** ImportJob expireTime */ + expireTime?: (google.protobuf.ITimestamp|null); + + /** ImportJob expireEventTime */ + expireEventTime?: (google.protobuf.ITimestamp|null); + + /** ImportJob state */ + state?: (google.cloud.kms.v1.ImportJob.ImportJobState|keyof typeof google.cloud.kms.v1.ImportJob.ImportJobState|null); + + /** ImportJob publicKey */ + publicKey?: (google.cloud.kms.v1.ImportJob.IWrappingPublicKey|null); + + /** ImportJob attestation */ + attestation?: (google.cloud.kms.v1.IKeyOperationAttestation|null); + } + + /** Represents an ImportJob. */ + class ImportJob implements IImportJob { + + /** + * Constructs a new ImportJob. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IImportJob); + + /** ImportJob name. */ + public name: string; + + /** ImportJob importMethod. */ + public importMethod: (google.cloud.kms.v1.ImportJob.ImportMethod|keyof typeof google.cloud.kms.v1.ImportJob.ImportMethod); + + /** ImportJob protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** ImportJob createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ImportJob generateTime. */ + public generateTime?: (google.protobuf.ITimestamp|null); + + /** ImportJob expireTime. */ + public expireTime?: (google.protobuf.ITimestamp|null); + + /** ImportJob expireEventTime. */ + public expireEventTime?: (google.protobuf.ITimestamp|null); + + /** ImportJob state. */ + public state: (google.cloud.kms.v1.ImportJob.ImportJobState|keyof typeof google.cloud.kms.v1.ImportJob.ImportJobState); + + /** ImportJob publicKey. */ + public publicKey?: (google.cloud.kms.v1.ImportJob.IWrappingPublicKey|null); + + /** ImportJob attestation. */ + public attestation?: (google.cloud.kms.v1.IKeyOperationAttestation|null); + + /** + * Creates a new ImportJob instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportJob instance + */ + public static create(properties?: google.cloud.kms.v1.IImportJob): google.cloud.kms.v1.ImportJob; + + /** + * Encodes the specified ImportJob message. Does not implicitly {@link google.cloud.kms.v1.ImportJob.verify|verify} messages. + * @param message ImportJob message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IImportJob, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportJob message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ImportJob.verify|verify} messages. + * @param message ImportJob message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IImportJob, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportJob message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportJob + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ImportJob; + + /** + * Decodes an ImportJob message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportJob + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ImportJob; + + /** + * Verifies an ImportJob message. + * @param message Plain 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 ImportJob message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportJob + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ImportJob; + + /** + * Creates a plain object from an ImportJob message. Also converts values to other types if specified. + * @param message ImportJob + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ImportJob, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportJob to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportJob + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ImportJob { + + /** ImportMethod enum. */ + enum ImportMethod { + IMPORT_METHOD_UNSPECIFIED = 0, + RSA_OAEP_3072_SHA1_AES_256 = 1, + RSA_OAEP_4096_SHA1_AES_256 = 2 + } + + /** ImportJobState enum. */ + enum ImportJobState { + IMPORT_JOB_STATE_UNSPECIFIED = 0, + PENDING_GENERATION = 1, + ACTIVE = 2, + EXPIRED = 3 + } + + /** Properties of a WrappingPublicKey. */ + interface IWrappingPublicKey { + + /** WrappingPublicKey pem */ + pem?: (string|null); + } + + /** Represents a WrappingPublicKey. */ + class WrappingPublicKey implements IWrappingPublicKey { + + /** + * Constructs a new WrappingPublicKey. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ImportJob.IWrappingPublicKey); + + /** WrappingPublicKey pem. */ + public pem: string; + + /** + * Creates a new WrappingPublicKey instance using the specified properties. + * @param [properties] Properties to set + * @returns WrappingPublicKey instance + */ + public static create(properties?: google.cloud.kms.v1.ImportJob.IWrappingPublicKey): google.cloud.kms.v1.ImportJob.WrappingPublicKey; + + /** + * Encodes the specified WrappingPublicKey message. Does not implicitly {@link google.cloud.kms.v1.ImportJob.WrappingPublicKey.verify|verify} messages. + * @param message WrappingPublicKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ImportJob.IWrappingPublicKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WrappingPublicKey message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ImportJob.WrappingPublicKey.verify|verify} messages. + * @param message WrappingPublicKey message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ImportJob.IWrappingPublicKey, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WrappingPublicKey message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WrappingPublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ImportJob.WrappingPublicKey; + + /** + * Decodes a WrappingPublicKey message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WrappingPublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ImportJob.WrappingPublicKey; + + /** + * Verifies a WrappingPublicKey message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WrappingPublicKey message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WrappingPublicKey + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ImportJob.WrappingPublicKey; + + /** + * Creates a plain object from a WrappingPublicKey message. Also converts values to other types if specified. + * @param message WrappingPublicKey + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ImportJob.WrappingPublicKey, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WrappingPublicKey to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WrappingPublicKey + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an ExternalProtectionLevelOptions. */ + interface IExternalProtectionLevelOptions { + + /** ExternalProtectionLevelOptions externalKeyUri */ + externalKeyUri?: (string|null); + + /** ExternalProtectionLevelOptions ekmConnectionKeyPath */ + ekmConnectionKeyPath?: (string|null); + } + + /** Represents an ExternalProtectionLevelOptions. */ + class ExternalProtectionLevelOptions implements IExternalProtectionLevelOptions { + + /** + * Constructs a new ExternalProtectionLevelOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IExternalProtectionLevelOptions); + + /** ExternalProtectionLevelOptions externalKeyUri. */ + public externalKeyUri: string; + + /** ExternalProtectionLevelOptions ekmConnectionKeyPath. */ + public ekmConnectionKeyPath: string; + + /** + * Creates a new ExternalProtectionLevelOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExternalProtectionLevelOptions instance + */ + public static create(properties?: google.cloud.kms.v1.IExternalProtectionLevelOptions): google.cloud.kms.v1.ExternalProtectionLevelOptions; + + /** + * Encodes the specified ExternalProtectionLevelOptions message. Does not implicitly {@link google.cloud.kms.v1.ExternalProtectionLevelOptions.verify|verify} messages. + * @param message ExternalProtectionLevelOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IExternalProtectionLevelOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExternalProtectionLevelOptions message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ExternalProtectionLevelOptions.verify|verify} messages. + * @param message ExternalProtectionLevelOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IExternalProtectionLevelOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExternalProtectionLevelOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExternalProtectionLevelOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ExternalProtectionLevelOptions; + + /** + * Decodes an ExternalProtectionLevelOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExternalProtectionLevelOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ExternalProtectionLevelOptions; + + /** + * Verifies an ExternalProtectionLevelOptions message. + * @param message Plain 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 ExternalProtectionLevelOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExternalProtectionLevelOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ExternalProtectionLevelOptions; + + /** + * Creates a plain object from an ExternalProtectionLevelOptions message. Also converts values to other types if specified. + * @param message ExternalProtectionLevelOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ExternalProtectionLevelOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExternalProtectionLevelOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExternalProtectionLevelOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** ProtectionLevel enum. */ + enum ProtectionLevel { + PROTECTION_LEVEL_UNSPECIFIED = 0, + SOFTWARE = 1, + HSM = 2, + EXTERNAL = 3, + EXTERNAL_VPC = 4 + } + + /** Represents a KeyManagementService */ + class KeyManagementService extends $protobuf.rpc.Service { + + /** + * Constructs a new KeyManagementService 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 KeyManagementService 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): KeyManagementService; + + /** + * Calls ListKeyRings. + * @param request ListKeyRingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListKeyRingsResponse + */ + public listKeyRings(request: google.cloud.kms.v1.IListKeyRingsRequest, callback: google.cloud.kms.v1.KeyManagementService.ListKeyRingsCallback): void; + + /** + * Calls ListKeyRings. + * @param request ListKeyRingsRequest message or plain object + * @returns Promise + */ + public listKeyRings(request: google.cloud.kms.v1.IListKeyRingsRequest): Promise; + + /** + * Calls ListCryptoKeys. + * @param request ListCryptoKeysRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCryptoKeysResponse + */ + public listCryptoKeys(request: google.cloud.kms.v1.IListCryptoKeysRequest, callback: google.cloud.kms.v1.KeyManagementService.ListCryptoKeysCallback): void; + + /** + * Calls ListCryptoKeys. + * @param request ListCryptoKeysRequest message or plain object + * @returns Promise + */ + public listCryptoKeys(request: google.cloud.kms.v1.IListCryptoKeysRequest): Promise; + + /** + * Calls ListCryptoKeyVersions. + * @param request ListCryptoKeyVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListCryptoKeyVersionsResponse + */ + public listCryptoKeyVersions(request: google.cloud.kms.v1.IListCryptoKeyVersionsRequest, callback: google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersionsCallback): void; + + /** + * Calls ListCryptoKeyVersions. + * @param request ListCryptoKeyVersionsRequest message or plain object + * @returns Promise + */ + public listCryptoKeyVersions(request: google.cloud.kms.v1.IListCryptoKeyVersionsRequest): Promise; + + /** + * Calls ListImportJobs. + * @param request ListImportJobsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListImportJobsResponse + */ + public listImportJobs(request: google.cloud.kms.v1.IListImportJobsRequest, callback: google.cloud.kms.v1.KeyManagementService.ListImportJobsCallback): void; + + /** + * Calls ListImportJobs. + * @param request ListImportJobsRequest message or plain object + * @returns Promise + */ + public listImportJobs(request: google.cloud.kms.v1.IListImportJobsRequest): Promise; + + /** + * Calls GetKeyRing. + * @param request GetKeyRingRequest message or plain object + * @param callback Node-style callback called with the error, if any, and KeyRing + */ + public getKeyRing(request: google.cloud.kms.v1.IGetKeyRingRequest, callback: google.cloud.kms.v1.KeyManagementService.GetKeyRingCallback): void; + + /** + * Calls GetKeyRing. + * @param request GetKeyRingRequest message or plain object + * @returns Promise + */ + public getKeyRing(request: google.cloud.kms.v1.IGetKeyRingRequest): Promise; + + /** + * Calls GetCryptoKey. + * @param request GetCryptoKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKey + */ + public getCryptoKey(request: google.cloud.kms.v1.IGetCryptoKeyRequest, callback: google.cloud.kms.v1.KeyManagementService.GetCryptoKeyCallback): void; + + /** + * Calls GetCryptoKey. + * @param request GetCryptoKeyRequest message or plain object + * @returns Promise + */ + public getCryptoKey(request: google.cloud.kms.v1.IGetCryptoKeyRequest): Promise; + + /** + * Calls GetCryptoKeyVersion. + * @param request GetCryptoKeyVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKeyVersion + */ + public getCryptoKeyVersion(request: google.cloud.kms.v1.IGetCryptoKeyVersionRequest, callback: google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersionCallback): void; + + /** + * Calls GetCryptoKeyVersion. + * @param request GetCryptoKeyVersionRequest message or plain object + * @returns Promise + */ + public getCryptoKeyVersion(request: google.cloud.kms.v1.IGetCryptoKeyVersionRequest): Promise; + + /** + * Calls GetPublicKey. + * @param request GetPublicKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PublicKey + */ + public getPublicKey(request: google.cloud.kms.v1.IGetPublicKeyRequest, callback: google.cloud.kms.v1.KeyManagementService.GetPublicKeyCallback): void; + + /** + * Calls GetPublicKey. + * @param request GetPublicKeyRequest message or plain object + * @returns Promise + */ + public getPublicKey(request: google.cloud.kms.v1.IGetPublicKeyRequest): Promise; + + /** + * Calls GetImportJob. + * @param request GetImportJobRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ImportJob + */ + public getImportJob(request: google.cloud.kms.v1.IGetImportJobRequest, callback: google.cloud.kms.v1.KeyManagementService.GetImportJobCallback): void; + + /** + * Calls GetImportJob. + * @param request GetImportJobRequest message or plain object + * @returns Promise + */ + public getImportJob(request: google.cloud.kms.v1.IGetImportJobRequest): Promise; + + /** + * Calls CreateKeyRing. + * @param request CreateKeyRingRequest message or plain object + * @param callback Node-style callback called with the error, if any, and KeyRing + */ + public createKeyRing(request: google.cloud.kms.v1.ICreateKeyRingRequest, callback: google.cloud.kms.v1.KeyManagementService.CreateKeyRingCallback): void; + + /** + * Calls CreateKeyRing. + * @param request CreateKeyRingRequest message or plain object + * @returns Promise + */ + public createKeyRing(request: google.cloud.kms.v1.ICreateKeyRingRequest): Promise; + + /** + * Calls CreateCryptoKey. + * @param request CreateCryptoKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKey + */ + public createCryptoKey(request: google.cloud.kms.v1.ICreateCryptoKeyRequest, callback: google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyCallback): void; + + /** + * Calls CreateCryptoKey. + * @param request CreateCryptoKeyRequest message or plain object + * @returns Promise + */ + public createCryptoKey(request: google.cloud.kms.v1.ICreateCryptoKeyRequest): Promise; + + /** + * Calls CreateCryptoKeyVersion. + * @param request CreateCryptoKeyVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKeyVersion + */ + public createCryptoKeyVersion(request: google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, callback: google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersionCallback): void; + + /** + * Calls CreateCryptoKeyVersion. + * @param request CreateCryptoKeyVersionRequest message or plain object + * @returns Promise + */ + public createCryptoKeyVersion(request: google.cloud.kms.v1.ICreateCryptoKeyVersionRequest): Promise; + + /** + * Calls ImportCryptoKeyVersion. + * @param request ImportCryptoKeyVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKeyVersion + */ + public importCryptoKeyVersion(request: google.cloud.kms.v1.IImportCryptoKeyVersionRequest, callback: google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersionCallback): void; + + /** + * Calls ImportCryptoKeyVersion. + * @param request ImportCryptoKeyVersionRequest message or plain object + * @returns Promise + */ + public importCryptoKeyVersion(request: google.cloud.kms.v1.IImportCryptoKeyVersionRequest): Promise; + + /** + * Calls CreateImportJob. + * @param request CreateImportJobRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ImportJob + */ + public createImportJob(request: google.cloud.kms.v1.ICreateImportJobRequest, callback: google.cloud.kms.v1.KeyManagementService.CreateImportJobCallback): void; + + /** + * Calls CreateImportJob. + * @param request CreateImportJobRequest message or plain object + * @returns Promise + */ + public createImportJob(request: google.cloud.kms.v1.ICreateImportJobRequest): Promise; + + /** + * Calls UpdateCryptoKey. + * @param request UpdateCryptoKeyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKey + */ + public updateCryptoKey(request: google.cloud.kms.v1.IUpdateCryptoKeyRequest, callback: google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyCallback): void; + + /** + * Calls UpdateCryptoKey. + * @param request UpdateCryptoKeyRequest message or plain object + * @returns Promise + */ + public updateCryptoKey(request: google.cloud.kms.v1.IUpdateCryptoKeyRequest): Promise; + + /** + * Calls UpdateCryptoKeyVersion. + * @param request UpdateCryptoKeyVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKeyVersion + */ + public updateCryptoKeyVersion(request: google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, callback: google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersionCallback): void; + + /** + * Calls UpdateCryptoKeyVersion. + * @param request UpdateCryptoKeyVersionRequest message or plain object + * @returns Promise + */ + public updateCryptoKeyVersion(request: google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest): Promise; + + /** + * Calls UpdateCryptoKeyPrimaryVersion. + * @param request UpdateCryptoKeyPrimaryVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKey + */ + public updateCryptoKeyPrimaryVersion(request: google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, callback: google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersionCallback): void; + + /** + * Calls UpdateCryptoKeyPrimaryVersion. + * @param request UpdateCryptoKeyPrimaryVersionRequest message or plain object + * @returns Promise + */ + public updateCryptoKeyPrimaryVersion(request: google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest): Promise; + + /** + * Calls DestroyCryptoKeyVersion. + * @param request DestroyCryptoKeyVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKeyVersion + */ + public destroyCryptoKeyVersion(request: google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, callback: google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersionCallback): void; + + /** + * Calls DestroyCryptoKeyVersion. + * @param request DestroyCryptoKeyVersionRequest message or plain object + * @returns Promise + */ + public destroyCryptoKeyVersion(request: google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest): Promise; + + /** + * Calls RestoreCryptoKeyVersion. + * @param request RestoreCryptoKeyVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CryptoKeyVersion + */ + public restoreCryptoKeyVersion(request: google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, callback: google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersionCallback): void; + + /** + * Calls RestoreCryptoKeyVersion. + * @param request RestoreCryptoKeyVersionRequest message or plain object + * @returns Promise + */ + public restoreCryptoKeyVersion(request: google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest): Promise; + + /** + * Calls Encrypt. + * @param request EncryptRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EncryptResponse + */ + public encrypt(request: google.cloud.kms.v1.IEncryptRequest, callback: google.cloud.kms.v1.KeyManagementService.EncryptCallback): void; + + /** + * Calls Encrypt. + * @param request EncryptRequest message or plain object + * @returns Promise + */ + public encrypt(request: google.cloud.kms.v1.IEncryptRequest): Promise; + + /** + * Calls Decrypt. + * @param request DecryptRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DecryptResponse + */ + public decrypt(request: google.cloud.kms.v1.IDecryptRequest, callback: google.cloud.kms.v1.KeyManagementService.DecryptCallback): void; + + /** + * Calls Decrypt. + * @param request DecryptRequest message or plain object + * @returns Promise + */ + public decrypt(request: google.cloud.kms.v1.IDecryptRequest): Promise; + + /** + * Calls AsymmetricSign. + * @param request AsymmetricSignRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AsymmetricSignResponse + */ + public asymmetricSign(request: google.cloud.kms.v1.IAsymmetricSignRequest, callback: google.cloud.kms.v1.KeyManagementService.AsymmetricSignCallback): void; + + /** + * Calls AsymmetricSign. + * @param request AsymmetricSignRequest message or plain object + * @returns Promise + */ + public asymmetricSign(request: google.cloud.kms.v1.IAsymmetricSignRequest): Promise; + + /** + * Calls AsymmetricDecrypt. + * @param request AsymmetricDecryptRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AsymmetricDecryptResponse + */ + public asymmetricDecrypt(request: google.cloud.kms.v1.IAsymmetricDecryptRequest, callback: google.cloud.kms.v1.KeyManagementService.AsymmetricDecryptCallback): void; + + /** + * Calls AsymmetricDecrypt. + * @param request AsymmetricDecryptRequest message or plain object + * @returns Promise + */ + public asymmetricDecrypt(request: google.cloud.kms.v1.IAsymmetricDecryptRequest): Promise; + + /** + * Calls MacSign. + * @param request MacSignRequest message or plain object + * @param callback Node-style callback called with the error, if any, and MacSignResponse + */ + public macSign(request: google.cloud.kms.v1.IMacSignRequest, callback: google.cloud.kms.v1.KeyManagementService.MacSignCallback): void; + + /** + * Calls MacSign. + * @param request MacSignRequest message or plain object + * @returns Promise + */ + public macSign(request: google.cloud.kms.v1.IMacSignRequest): Promise; + + /** + * Calls MacVerify. + * @param request MacVerifyRequest message or plain object + * @param callback Node-style callback called with the error, if any, and MacVerifyResponse + */ + public macVerify(request: google.cloud.kms.v1.IMacVerifyRequest, callback: google.cloud.kms.v1.KeyManagementService.MacVerifyCallback): void; + + /** + * Calls MacVerify. + * @param request MacVerifyRequest message or plain object + * @returns Promise + */ + public macVerify(request: google.cloud.kms.v1.IMacVerifyRequest): Promise; + + /** + * Calls GenerateRandomBytes. + * @param request GenerateRandomBytesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateRandomBytesResponse + */ + public generateRandomBytes(request: google.cloud.kms.v1.IGenerateRandomBytesRequest, callback: google.cloud.kms.v1.KeyManagementService.GenerateRandomBytesCallback): void; + + /** + * Calls GenerateRandomBytes. + * @param request GenerateRandomBytesRequest message or plain object + * @returns Promise + */ + public generateRandomBytes(request: google.cloud.kms.v1.IGenerateRandomBytesRequest): Promise; + } + + namespace KeyManagementService { + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|listKeyRings}. + * @param error Error, if any + * @param [response] ListKeyRingsResponse + */ + type ListKeyRingsCallback = (error: (Error|null), response?: google.cloud.kms.v1.ListKeyRingsResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|listCryptoKeys}. + * @param error Error, if any + * @param [response] ListCryptoKeysResponse + */ + type ListCryptoKeysCallback = (error: (Error|null), response?: google.cloud.kms.v1.ListCryptoKeysResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|listCryptoKeyVersions}. + * @param error Error, if any + * @param [response] ListCryptoKeyVersionsResponse + */ + type ListCryptoKeyVersionsCallback = (error: (Error|null), response?: google.cloud.kms.v1.ListCryptoKeyVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|listImportJobs}. + * @param error Error, if any + * @param [response] ListImportJobsResponse + */ + type ListImportJobsCallback = (error: (Error|null), response?: google.cloud.kms.v1.ListImportJobsResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getKeyRing}. + * @param error Error, if any + * @param [response] KeyRing + */ + type GetKeyRingCallback = (error: (Error|null), response?: google.cloud.kms.v1.KeyRing) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getCryptoKey}. + * @param error Error, if any + * @param [response] CryptoKey + */ + type GetCryptoKeyCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKey) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getCryptoKeyVersion}. + * @param error Error, if any + * @param [response] CryptoKeyVersion + */ + type GetCryptoKeyVersionCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKeyVersion) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getPublicKey}. + * @param error Error, if any + * @param [response] PublicKey + */ + type GetPublicKeyCallback = (error: (Error|null), response?: google.cloud.kms.v1.PublicKey) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getImportJob}. + * @param error Error, if any + * @param [response] ImportJob + */ + type GetImportJobCallback = (error: (Error|null), response?: google.cloud.kms.v1.ImportJob) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|createKeyRing}. + * @param error Error, if any + * @param [response] KeyRing + */ + type CreateKeyRingCallback = (error: (Error|null), response?: google.cloud.kms.v1.KeyRing) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|createCryptoKey}. + * @param error Error, if any + * @param [response] CryptoKey + */ + type CreateCryptoKeyCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKey) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|createCryptoKeyVersion}. + * @param error Error, if any + * @param [response] CryptoKeyVersion + */ + type CreateCryptoKeyVersionCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKeyVersion) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|importCryptoKeyVersion}. + * @param error Error, if any + * @param [response] CryptoKeyVersion + */ + type ImportCryptoKeyVersionCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKeyVersion) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|createImportJob}. + * @param error Error, if any + * @param [response] ImportJob + */ + type CreateImportJobCallback = (error: (Error|null), response?: google.cloud.kms.v1.ImportJob) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|updateCryptoKey}. + * @param error Error, if any + * @param [response] CryptoKey + */ + type UpdateCryptoKeyCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKey) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|updateCryptoKeyVersion}. + * @param error Error, if any + * @param [response] CryptoKeyVersion + */ + type UpdateCryptoKeyVersionCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKeyVersion) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|updateCryptoKeyPrimaryVersion}. + * @param error Error, if any + * @param [response] CryptoKey + */ + type UpdateCryptoKeyPrimaryVersionCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKey) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|destroyCryptoKeyVersion}. + * @param error Error, if any + * @param [response] CryptoKeyVersion + */ + type DestroyCryptoKeyVersionCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKeyVersion) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|restoreCryptoKeyVersion}. + * @param error Error, if any + * @param [response] CryptoKeyVersion + */ + type RestoreCryptoKeyVersionCallback = (error: (Error|null), response?: google.cloud.kms.v1.CryptoKeyVersion) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|encrypt}. + * @param error Error, if any + * @param [response] EncryptResponse + */ + type EncryptCallback = (error: (Error|null), response?: google.cloud.kms.v1.EncryptResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|decrypt}. + * @param error Error, if any + * @param [response] DecryptResponse + */ + type DecryptCallback = (error: (Error|null), response?: google.cloud.kms.v1.DecryptResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|asymmetricSign}. + * @param error Error, if any + * @param [response] AsymmetricSignResponse + */ + type AsymmetricSignCallback = (error: (Error|null), response?: google.cloud.kms.v1.AsymmetricSignResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|asymmetricDecrypt}. + * @param error Error, if any + * @param [response] AsymmetricDecryptResponse + */ + type AsymmetricDecryptCallback = (error: (Error|null), response?: google.cloud.kms.v1.AsymmetricDecryptResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|macSign}. + * @param error Error, if any + * @param [response] MacSignResponse + */ + type MacSignCallback = (error: (Error|null), response?: google.cloud.kms.v1.MacSignResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|macVerify}. + * @param error Error, if any + * @param [response] MacVerifyResponse + */ + type MacVerifyCallback = (error: (Error|null), response?: google.cloud.kms.v1.MacVerifyResponse) => void; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|generateRandomBytes}. + * @param error Error, if any + * @param [response] GenerateRandomBytesResponse + */ + type GenerateRandomBytesCallback = (error: (Error|null), response?: google.cloud.kms.v1.GenerateRandomBytesResponse) => void; + } + + /** Properties of a ListKeyRingsRequest. */ + interface IListKeyRingsRequest { + + /** ListKeyRingsRequest parent */ + parent?: (string|null); + + /** ListKeyRingsRequest pageSize */ + pageSize?: (number|null); + + /** ListKeyRingsRequest pageToken */ + pageToken?: (string|null); + + /** ListKeyRingsRequest filter */ + filter?: (string|null); + + /** ListKeyRingsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListKeyRingsRequest. */ + class ListKeyRingsRequest implements IListKeyRingsRequest { + + /** + * Constructs a new ListKeyRingsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListKeyRingsRequest); + + /** ListKeyRingsRequest parent. */ + public parent: string; + + /** ListKeyRingsRequest pageSize. */ + public pageSize: number; + + /** ListKeyRingsRequest pageToken. */ + public pageToken: string; + + /** ListKeyRingsRequest filter. */ + public filter: string; + + /** ListKeyRingsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListKeyRingsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKeyRingsRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IListKeyRingsRequest): google.cloud.kms.v1.ListKeyRingsRequest; + + /** + * Encodes the specified ListKeyRingsRequest message. Does not implicitly {@link google.cloud.kms.v1.ListKeyRingsRequest.verify|verify} messages. + * @param message ListKeyRingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListKeyRingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKeyRingsRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListKeyRingsRequest.verify|verify} messages. + * @param message ListKeyRingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListKeyRingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKeyRingsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKeyRingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListKeyRingsRequest; + + /** + * Decodes a ListKeyRingsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKeyRingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListKeyRingsRequest; + + /** + * Verifies a ListKeyRingsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKeyRingsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKeyRingsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListKeyRingsRequest; + + /** + * Creates a plain object from a ListKeyRingsRequest message. Also converts values to other types if specified. + * @param message ListKeyRingsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListKeyRingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKeyRingsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListKeyRingsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListCryptoKeysRequest. */ + interface IListCryptoKeysRequest { + + /** ListCryptoKeysRequest parent */ + parent?: (string|null); + + /** ListCryptoKeysRequest pageSize */ + pageSize?: (number|null); + + /** ListCryptoKeysRequest pageToken */ + pageToken?: (string|null); + + /** ListCryptoKeysRequest versionView */ + versionView?: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView|null); + + /** ListCryptoKeysRequest filter */ + filter?: (string|null); + + /** ListCryptoKeysRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListCryptoKeysRequest. */ + class ListCryptoKeysRequest implements IListCryptoKeysRequest { + + /** + * Constructs a new ListCryptoKeysRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListCryptoKeysRequest); + + /** ListCryptoKeysRequest parent. */ + public parent: string; + + /** ListCryptoKeysRequest pageSize. */ + public pageSize: number; + + /** ListCryptoKeysRequest pageToken. */ + public pageToken: string; + + /** ListCryptoKeysRequest versionView. */ + public versionView: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView); + + /** ListCryptoKeysRequest filter. */ + public filter: string; + + /** ListCryptoKeysRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListCryptoKeysRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCryptoKeysRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IListCryptoKeysRequest): google.cloud.kms.v1.ListCryptoKeysRequest; + + /** + * Encodes the specified ListCryptoKeysRequest message. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeysRequest.verify|verify} messages. + * @param message ListCryptoKeysRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListCryptoKeysRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCryptoKeysRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeysRequest.verify|verify} messages. + * @param message ListCryptoKeysRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListCryptoKeysRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCryptoKeysRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCryptoKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListCryptoKeysRequest; + + /** + * Decodes a ListCryptoKeysRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCryptoKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListCryptoKeysRequest; + + /** + * Verifies a ListCryptoKeysRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCryptoKeysRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCryptoKeysRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListCryptoKeysRequest; + + /** + * Creates a plain object from a ListCryptoKeysRequest message. Also converts values to other types if specified. + * @param message ListCryptoKeysRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListCryptoKeysRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCryptoKeysRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCryptoKeysRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListCryptoKeyVersionsRequest. */ + interface IListCryptoKeyVersionsRequest { + + /** ListCryptoKeyVersionsRequest parent */ + parent?: (string|null); + + /** ListCryptoKeyVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListCryptoKeyVersionsRequest pageToken */ + pageToken?: (string|null); + + /** ListCryptoKeyVersionsRequest view */ + view?: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView|null); + + /** ListCryptoKeyVersionsRequest filter */ + filter?: (string|null); + + /** ListCryptoKeyVersionsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListCryptoKeyVersionsRequest. */ + class ListCryptoKeyVersionsRequest implements IListCryptoKeyVersionsRequest { + + /** + * Constructs a new ListCryptoKeyVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListCryptoKeyVersionsRequest); + + /** ListCryptoKeyVersionsRequest parent. */ + public parent: string; + + /** ListCryptoKeyVersionsRequest pageSize. */ + public pageSize: number; + + /** ListCryptoKeyVersionsRequest pageToken. */ + public pageToken: string; + + /** ListCryptoKeyVersionsRequest view. */ + public view: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView); + + /** ListCryptoKeyVersionsRequest filter. */ + public filter: string; + + /** ListCryptoKeyVersionsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListCryptoKeyVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCryptoKeyVersionsRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IListCryptoKeyVersionsRequest): google.cloud.kms.v1.ListCryptoKeyVersionsRequest; + + /** + * Encodes the specified ListCryptoKeyVersionsRequest message. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeyVersionsRequest.verify|verify} messages. + * @param message ListCryptoKeyVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListCryptoKeyVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCryptoKeyVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeyVersionsRequest.verify|verify} messages. + * @param message ListCryptoKeyVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListCryptoKeyVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCryptoKeyVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCryptoKeyVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListCryptoKeyVersionsRequest; + + /** + * Decodes a ListCryptoKeyVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCryptoKeyVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListCryptoKeyVersionsRequest; + + /** + * Verifies a ListCryptoKeyVersionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCryptoKeyVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCryptoKeyVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListCryptoKeyVersionsRequest; + + /** + * Creates a plain object from a ListCryptoKeyVersionsRequest message. Also converts values to other types if specified. + * @param message ListCryptoKeyVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListCryptoKeyVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCryptoKeyVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCryptoKeyVersionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListImportJobsRequest. */ + interface IListImportJobsRequest { + + /** ListImportJobsRequest parent */ + parent?: (string|null); + + /** ListImportJobsRequest pageSize */ + pageSize?: (number|null); + + /** ListImportJobsRequest pageToken */ + pageToken?: (string|null); + + /** ListImportJobsRequest filter */ + filter?: (string|null); + + /** ListImportJobsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListImportJobsRequest. */ + class ListImportJobsRequest implements IListImportJobsRequest { + + /** + * Constructs a new ListImportJobsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListImportJobsRequest); + + /** ListImportJobsRequest parent. */ + public parent: string; + + /** ListImportJobsRequest pageSize. */ + public pageSize: number; + + /** ListImportJobsRequest pageToken. */ + public pageToken: string; + + /** ListImportJobsRequest filter. */ + public filter: string; + + /** ListImportJobsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListImportJobsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListImportJobsRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IListImportJobsRequest): google.cloud.kms.v1.ListImportJobsRequest; + + /** + * Encodes the specified ListImportJobsRequest message. Does not implicitly {@link google.cloud.kms.v1.ListImportJobsRequest.verify|verify} messages. + * @param message ListImportJobsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListImportJobsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListImportJobsRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListImportJobsRequest.verify|verify} messages. + * @param message ListImportJobsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListImportJobsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListImportJobsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListImportJobsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListImportJobsRequest; + + /** + * Decodes a ListImportJobsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListImportJobsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListImportJobsRequest; + + /** + * Verifies a ListImportJobsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListImportJobsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListImportJobsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListImportJobsRequest; + + /** + * Creates a plain object from a ListImportJobsRequest message. Also converts values to other types if specified. + * @param message ListImportJobsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListImportJobsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListImportJobsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListImportJobsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListKeyRingsResponse. */ + interface IListKeyRingsResponse { + + /** ListKeyRingsResponse keyRings */ + keyRings?: (google.cloud.kms.v1.IKeyRing[]|null); + + /** ListKeyRingsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListKeyRingsResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListKeyRingsResponse. */ + class ListKeyRingsResponse implements IListKeyRingsResponse { + + /** + * Constructs a new ListKeyRingsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListKeyRingsResponse); + + /** ListKeyRingsResponse keyRings. */ + public keyRings: google.cloud.kms.v1.IKeyRing[]; + + /** ListKeyRingsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListKeyRingsResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListKeyRingsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKeyRingsResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IListKeyRingsResponse): google.cloud.kms.v1.ListKeyRingsResponse; + + /** + * Encodes the specified ListKeyRingsResponse message. Does not implicitly {@link google.cloud.kms.v1.ListKeyRingsResponse.verify|verify} messages. + * @param message ListKeyRingsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListKeyRingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKeyRingsResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListKeyRingsResponse.verify|verify} messages. + * @param message ListKeyRingsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListKeyRingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKeyRingsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKeyRingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListKeyRingsResponse; + + /** + * Decodes a ListKeyRingsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKeyRingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListKeyRingsResponse; + + /** + * Verifies a ListKeyRingsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKeyRingsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKeyRingsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListKeyRingsResponse; + + /** + * Creates a plain object from a ListKeyRingsResponse message. Also converts values to other types if specified. + * @param message ListKeyRingsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListKeyRingsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKeyRingsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListKeyRingsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListCryptoKeysResponse. */ + interface IListCryptoKeysResponse { + + /** ListCryptoKeysResponse cryptoKeys */ + cryptoKeys?: (google.cloud.kms.v1.ICryptoKey[]|null); + + /** ListCryptoKeysResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListCryptoKeysResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListCryptoKeysResponse. */ + class ListCryptoKeysResponse implements IListCryptoKeysResponse { + + /** + * Constructs a new ListCryptoKeysResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListCryptoKeysResponse); + + /** ListCryptoKeysResponse cryptoKeys. */ + public cryptoKeys: google.cloud.kms.v1.ICryptoKey[]; + + /** ListCryptoKeysResponse nextPageToken. */ + public nextPageToken: string; + + /** ListCryptoKeysResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListCryptoKeysResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCryptoKeysResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IListCryptoKeysResponse): google.cloud.kms.v1.ListCryptoKeysResponse; + + /** + * Encodes the specified ListCryptoKeysResponse message. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeysResponse.verify|verify} messages. + * @param message ListCryptoKeysResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListCryptoKeysResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCryptoKeysResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeysResponse.verify|verify} messages. + * @param message ListCryptoKeysResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListCryptoKeysResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCryptoKeysResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCryptoKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListCryptoKeysResponse; + + /** + * Decodes a ListCryptoKeysResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCryptoKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListCryptoKeysResponse; + + /** + * Verifies a ListCryptoKeysResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCryptoKeysResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCryptoKeysResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListCryptoKeysResponse; + + /** + * Creates a plain object from a ListCryptoKeysResponse message. Also converts values to other types if specified. + * @param message ListCryptoKeysResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListCryptoKeysResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCryptoKeysResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCryptoKeysResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListCryptoKeyVersionsResponse. */ + interface IListCryptoKeyVersionsResponse { + + /** ListCryptoKeyVersionsResponse cryptoKeyVersions */ + cryptoKeyVersions?: (google.cloud.kms.v1.ICryptoKeyVersion[]|null); + + /** ListCryptoKeyVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListCryptoKeyVersionsResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListCryptoKeyVersionsResponse. */ + class ListCryptoKeyVersionsResponse implements IListCryptoKeyVersionsResponse { + + /** + * Constructs a new ListCryptoKeyVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListCryptoKeyVersionsResponse); + + /** ListCryptoKeyVersionsResponse cryptoKeyVersions. */ + public cryptoKeyVersions: google.cloud.kms.v1.ICryptoKeyVersion[]; + + /** ListCryptoKeyVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListCryptoKeyVersionsResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListCryptoKeyVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListCryptoKeyVersionsResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IListCryptoKeyVersionsResponse): google.cloud.kms.v1.ListCryptoKeyVersionsResponse; + + /** + * Encodes the specified ListCryptoKeyVersionsResponse message. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.verify|verify} messages. + * @param message ListCryptoKeyVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListCryptoKeyVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListCryptoKeyVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.verify|verify} messages. + * @param message ListCryptoKeyVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListCryptoKeyVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListCryptoKeyVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListCryptoKeyVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListCryptoKeyVersionsResponse; + + /** + * Decodes a ListCryptoKeyVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListCryptoKeyVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListCryptoKeyVersionsResponse; + + /** + * Verifies a ListCryptoKeyVersionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListCryptoKeyVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListCryptoKeyVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListCryptoKeyVersionsResponse; + + /** + * Creates a plain object from a ListCryptoKeyVersionsResponse message. Also converts values to other types if specified. + * @param message ListCryptoKeyVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListCryptoKeyVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListCryptoKeyVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListCryptoKeyVersionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListImportJobsResponse. */ + interface IListImportJobsResponse { + + /** ListImportJobsResponse importJobs */ + importJobs?: (google.cloud.kms.v1.IImportJob[]|null); + + /** ListImportJobsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListImportJobsResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListImportJobsResponse. */ + class ListImportJobsResponse implements IListImportJobsResponse { + + /** + * Constructs a new ListImportJobsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IListImportJobsResponse); + + /** ListImportJobsResponse importJobs. */ + public importJobs: google.cloud.kms.v1.IImportJob[]; + + /** ListImportJobsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListImportJobsResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListImportJobsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListImportJobsResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IListImportJobsResponse): google.cloud.kms.v1.ListImportJobsResponse; + + /** + * Encodes the specified ListImportJobsResponse message. Does not implicitly {@link google.cloud.kms.v1.ListImportJobsResponse.verify|verify} messages. + * @param message ListImportJobsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IListImportJobsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListImportJobsResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListImportJobsResponse.verify|verify} messages. + * @param message ListImportJobsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IListImportJobsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListImportJobsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListImportJobsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ListImportJobsResponse; + + /** + * Decodes a ListImportJobsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListImportJobsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ListImportJobsResponse; + + /** + * Verifies a ListImportJobsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListImportJobsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListImportJobsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ListImportJobsResponse; + + /** + * Creates a plain object from a ListImportJobsResponse message. Also converts values to other types if specified. + * @param message ListImportJobsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ListImportJobsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListImportJobsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListImportJobsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetKeyRingRequest. */ + interface IGetKeyRingRequest { + + /** GetKeyRingRequest name */ + name?: (string|null); + } + + /** Represents a GetKeyRingRequest. */ + class GetKeyRingRequest implements IGetKeyRingRequest { + + /** + * Constructs a new GetKeyRingRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IGetKeyRingRequest); + + /** GetKeyRingRequest name. */ + public name: string; + + /** + * Creates a new GetKeyRingRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetKeyRingRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IGetKeyRingRequest): google.cloud.kms.v1.GetKeyRingRequest; + + /** + * Encodes the specified GetKeyRingRequest message. Does not implicitly {@link google.cloud.kms.v1.GetKeyRingRequest.verify|verify} messages. + * @param message GetKeyRingRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IGetKeyRingRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetKeyRingRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetKeyRingRequest.verify|verify} messages. + * @param message GetKeyRingRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IGetKeyRingRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetKeyRingRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetKeyRingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.GetKeyRingRequest; + + /** + * Decodes a GetKeyRingRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetKeyRingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.GetKeyRingRequest; + + /** + * Verifies a GetKeyRingRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetKeyRingRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetKeyRingRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.GetKeyRingRequest; + + /** + * Creates a plain object from a GetKeyRingRequest message. Also converts values to other types if specified. + * @param message GetKeyRingRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.GetKeyRingRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetKeyRingRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetKeyRingRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetCryptoKeyRequest. */ + interface IGetCryptoKeyRequest { + + /** GetCryptoKeyRequest name */ + name?: (string|null); + } + + /** Represents a GetCryptoKeyRequest. */ + class GetCryptoKeyRequest implements IGetCryptoKeyRequest { + + /** + * Constructs a new GetCryptoKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IGetCryptoKeyRequest); + + /** GetCryptoKeyRequest name. */ + public name: string; + + /** + * Creates a new GetCryptoKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetCryptoKeyRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IGetCryptoKeyRequest): google.cloud.kms.v1.GetCryptoKeyRequest; + + /** + * Encodes the specified GetCryptoKeyRequest message. Does not implicitly {@link google.cloud.kms.v1.GetCryptoKeyRequest.verify|verify} messages. + * @param message GetCryptoKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IGetCryptoKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetCryptoKeyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetCryptoKeyRequest.verify|verify} messages. + * @param message GetCryptoKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IGetCryptoKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetCryptoKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.GetCryptoKeyRequest; + + /** + * Decodes a GetCryptoKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.GetCryptoKeyRequest; + + /** + * Verifies a GetCryptoKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetCryptoKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetCryptoKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.GetCryptoKeyRequest; + + /** + * Creates a plain object from a GetCryptoKeyRequest message. Also converts values to other types if specified. + * @param message GetCryptoKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.GetCryptoKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetCryptoKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetCryptoKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetCryptoKeyVersionRequest. */ + interface IGetCryptoKeyVersionRequest { + + /** GetCryptoKeyVersionRequest name */ + name?: (string|null); + } + + /** Represents a GetCryptoKeyVersionRequest. */ + class GetCryptoKeyVersionRequest implements IGetCryptoKeyVersionRequest { + + /** + * Constructs a new GetCryptoKeyVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IGetCryptoKeyVersionRequest); + + /** GetCryptoKeyVersionRequest name. */ + public name: string; + + /** + * Creates a new GetCryptoKeyVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetCryptoKeyVersionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IGetCryptoKeyVersionRequest): google.cloud.kms.v1.GetCryptoKeyVersionRequest; + + /** + * Encodes the specified GetCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.GetCryptoKeyVersionRequest.verify|verify} messages. + * @param message GetCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IGetCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetCryptoKeyVersionRequest.verify|verify} messages. + * @param message GetCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IGetCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetCryptoKeyVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.GetCryptoKeyVersionRequest; + + /** + * Decodes a GetCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.GetCryptoKeyVersionRequest; + + /** + * Verifies a GetCryptoKeyVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetCryptoKeyVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.GetCryptoKeyVersionRequest; + + /** + * Creates a plain object from a GetCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @param message GetCryptoKeyVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.GetCryptoKeyVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetCryptoKeyVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetCryptoKeyVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetPublicKeyRequest. */ + interface IGetPublicKeyRequest { + + /** GetPublicKeyRequest name */ + name?: (string|null); + } + + /** Represents a GetPublicKeyRequest. */ + class GetPublicKeyRequest implements IGetPublicKeyRequest { + + /** + * Constructs a new GetPublicKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IGetPublicKeyRequest); + + /** GetPublicKeyRequest name. */ + public name: string; + + /** + * Creates a new GetPublicKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetPublicKeyRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IGetPublicKeyRequest): google.cloud.kms.v1.GetPublicKeyRequest; + + /** + * Encodes the specified GetPublicKeyRequest message. Does not implicitly {@link google.cloud.kms.v1.GetPublicKeyRequest.verify|verify} messages. + * @param message GetPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IGetPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetPublicKeyRequest.verify|verify} messages. + * @param message GetPublicKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IGetPublicKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetPublicKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.GetPublicKeyRequest; + + /** + * Decodes a GetPublicKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.GetPublicKeyRequest; + + /** + * Verifies a GetPublicKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetPublicKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.GetPublicKeyRequest; + + /** + * Creates a plain object from a GetPublicKeyRequest message. Also converts values to other types if specified. + * @param message GetPublicKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.GetPublicKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetPublicKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetPublicKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetImportJobRequest. */ + interface IGetImportJobRequest { + + /** GetImportJobRequest name */ + name?: (string|null); + } + + /** Represents a GetImportJobRequest. */ + class GetImportJobRequest implements IGetImportJobRequest { + + /** + * Constructs a new GetImportJobRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IGetImportJobRequest); + + /** GetImportJobRequest name. */ + public name: string; + + /** + * Creates a new GetImportJobRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetImportJobRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IGetImportJobRequest): google.cloud.kms.v1.GetImportJobRequest; + + /** + * Encodes the specified GetImportJobRequest message. Does not implicitly {@link google.cloud.kms.v1.GetImportJobRequest.verify|verify} messages. + * @param message GetImportJobRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IGetImportJobRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetImportJobRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetImportJobRequest.verify|verify} messages. + * @param message GetImportJobRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IGetImportJobRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetImportJobRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetImportJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.GetImportJobRequest; + + /** + * Decodes a GetImportJobRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetImportJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.GetImportJobRequest; + + /** + * Verifies a GetImportJobRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetImportJobRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetImportJobRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.GetImportJobRequest; + + /** + * Creates a plain object from a GetImportJobRequest message. Also converts values to other types if specified. + * @param message GetImportJobRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.GetImportJobRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetImportJobRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetImportJobRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateKeyRingRequest. */ + interface ICreateKeyRingRequest { + + /** CreateKeyRingRequest parent */ + parent?: (string|null); + + /** CreateKeyRingRequest keyRingId */ + keyRingId?: (string|null); + + /** CreateKeyRingRequest keyRing */ + keyRing?: (google.cloud.kms.v1.IKeyRing|null); + } + + /** Represents a CreateKeyRingRequest. */ + class CreateKeyRingRequest implements ICreateKeyRingRequest { + + /** + * Constructs a new CreateKeyRingRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICreateKeyRingRequest); + + /** CreateKeyRingRequest parent. */ + public parent: string; + + /** CreateKeyRingRequest keyRingId. */ + public keyRingId: string; + + /** CreateKeyRingRequest keyRing. */ + public keyRing?: (google.cloud.kms.v1.IKeyRing|null); + + /** + * Creates a new CreateKeyRingRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateKeyRingRequest instance + */ + public static create(properties?: google.cloud.kms.v1.ICreateKeyRingRequest): google.cloud.kms.v1.CreateKeyRingRequest; + + /** + * Encodes the specified CreateKeyRingRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateKeyRingRequest.verify|verify} messages. + * @param message CreateKeyRingRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICreateKeyRingRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateKeyRingRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateKeyRingRequest.verify|verify} messages. + * @param message CreateKeyRingRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICreateKeyRingRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateKeyRingRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateKeyRingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.CreateKeyRingRequest; + + /** + * Decodes a CreateKeyRingRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateKeyRingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.CreateKeyRingRequest; + + /** + * Verifies a CreateKeyRingRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateKeyRingRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateKeyRingRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.CreateKeyRingRequest; + + /** + * Creates a plain object from a CreateKeyRingRequest message. Also converts values to other types if specified. + * @param message CreateKeyRingRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.CreateKeyRingRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateKeyRingRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateKeyRingRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateCryptoKeyRequest. */ + interface ICreateCryptoKeyRequest { + + /** CreateCryptoKeyRequest parent */ + parent?: (string|null); + + /** CreateCryptoKeyRequest cryptoKeyId */ + cryptoKeyId?: (string|null); + + /** CreateCryptoKeyRequest cryptoKey */ + cryptoKey?: (google.cloud.kms.v1.ICryptoKey|null); + + /** CreateCryptoKeyRequest skipInitialVersionCreation */ + skipInitialVersionCreation?: (boolean|null); + } + + /** Represents a CreateCryptoKeyRequest. */ + class CreateCryptoKeyRequest implements ICreateCryptoKeyRequest { + + /** + * Constructs a new CreateCryptoKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICreateCryptoKeyRequest); + + /** CreateCryptoKeyRequest parent. */ + public parent: string; + + /** CreateCryptoKeyRequest cryptoKeyId. */ + public cryptoKeyId: string; + + /** CreateCryptoKeyRequest cryptoKey. */ + public cryptoKey?: (google.cloud.kms.v1.ICryptoKey|null); + + /** CreateCryptoKeyRequest skipInitialVersionCreation. */ + public skipInitialVersionCreation: boolean; + + /** + * Creates a new CreateCryptoKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateCryptoKeyRequest instance + */ + public static create(properties?: google.cloud.kms.v1.ICreateCryptoKeyRequest): google.cloud.kms.v1.CreateCryptoKeyRequest; + + /** + * Encodes the specified CreateCryptoKeyRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateCryptoKeyRequest.verify|verify} messages. + * @param message CreateCryptoKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICreateCryptoKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateCryptoKeyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateCryptoKeyRequest.verify|verify} messages. + * @param message CreateCryptoKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICreateCryptoKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateCryptoKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.CreateCryptoKeyRequest; + + /** + * Decodes a CreateCryptoKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.CreateCryptoKeyRequest; + + /** + * Verifies a CreateCryptoKeyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateCryptoKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateCryptoKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.CreateCryptoKeyRequest; + + /** + * Creates a plain object from a CreateCryptoKeyRequest message. Also converts values to other types if specified. + * @param message CreateCryptoKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.CreateCryptoKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateCryptoKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateCryptoKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateCryptoKeyVersionRequest. */ + interface ICreateCryptoKeyVersionRequest { + + /** CreateCryptoKeyVersionRequest parent */ + parent?: (string|null); + + /** CreateCryptoKeyVersionRequest cryptoKeyVersion */ + cryptoKeyVersion?: (google.cloud.kms.v1.ICryptoKeyVersion|null); + } + + /** Represents a CreateCryptoKeyVersionRequest. */ + class CreateCryptoKeyVersionRequest implements ICreateCryptoKeyVersionRequest { + + /** + * Constructs a new CreateCryptoKeyVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICreateCryptoKeyVersionRequest); + + /** CreateCryptoKeyVersionRequest parent. */ + public parent: string; + + /** CreateCryptoKeyVersionRequest cryptoKeyVersion. */ + public cryptoKeyVersion?: (google.cloud.kms.v1.ICryptoKeyVersion|null); + + /** + * Creates a new CreateCryptoKeyVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateCryptoKeyVersionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.ICreateCryptoKeyVersionRequest): google.cloud.kms.v1.CreateCryptoKeyVersionRequest; + + /** + * Encodes the specified CreateCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateCryptoKeyVersionRequest.verify|verify} messages. + * @param message CreateCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateCryptoKeyVersionRequest.verify|verify} messages. + * @param message CreateCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateCryptoKeyVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.CreateCryptoKeyVersionRequest; + + /** + * Decodes a CreateCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.CreateCryptoKeyVersionRequest; + + /** + * Verifies a CreateCryptoKeyVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateCryptoKeyVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.CreateCryptoKeyVersionRequest; + + /** + * Creates a plain object from a CreateCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @param message CreateCryptoKeyVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.CreateCryptoKeyVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateCryptoKeyVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateCryptoKeyVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportCryptoKeyVersionRequest. */ + interface IImportCryptoKeyVersionRequest { + + /** ImportCryptoKeyVersionRequest parent */ + parent?: (string|null); + + /** ImportCryptoKeyVersionRequest cryptoKeyVersion */ + cryptoKeyVersion?: (string|null); + + /** ImportCryptoKeyVersionRequest algorithm */ + algorithm?: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|null); + + /** ImportCryptoKeyVersionRequest importJob */ + importJob?: (string|null); + + /** ImportCryptoKeyVersionRequest rsaAesWrappedKey */ + rsaAesWrappedKey?: (Uint8Array|string|null); + } + + /** Represents an ImportCryptoKeyVersionRequest. */ + class ImportCryptoKeyVersionRequest implements IImportCryptoKeyVersionRequest { + + /** + * Constructs a new ImportCryptoKeyVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IImportCryptoKeyVersionRequest); + + /** ImportCryptoKeyVersionRequest parent. */ + public parent: string; + + /** ImportCryptoKeyVersionRequest cryptoKeyVersion. */ + public cryptoKeyVersion: string; + + /** ImportCryptoKeyVersionRequest algorithm. */ + public algorithm: (google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|keyof typeof google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm); + + /** ImportCryptoKeyVersionRequest importJob. */ + public importJob: string; + + /** ImportCryptoKeyVersionRequest rsaAesWrappedKey. */ + public rsaAesWrappedKey?: (Uint8Array|string|null); + + /** ImportCryptoKeyVersionRequest wrappedKeyMaterial. */ + public wrappedKeyMaterial?: "rsaAesWrappedKey"; + + /** + * Creates a new ImportCryptoKeyVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportCryptoKeyVersionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IImportCryptoKeyVersionRequest): google.cloud.kms.v1.ImportCryptoKeyVersionRequest; + + /** + * Encodes the specified ImportCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.ImportCryptoKeyVersionRequest.verify|verify} messages. + * @param message ImportCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IImportCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ImportCryptoKeyVersionRequest.verify|verify} messages. + * @param message ImportCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IImportCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportCryptoKeyVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.ImportCryptoKeyVersionRequest; + + /** + * Decodes an ImportCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.ImportCryptoKeyVersionRequest; + + /** + * Verifies an ImportCryptoKeyVersionRequest message. + * @param message Plain 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 ImportCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportCryptoKeyVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.ImportCryptoKeyVersionRequest; + + /** + * Creates a plain object from an ImportCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @param message ImportCryptoKeyVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.ImportCryptoKeyVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportCryptoKeyVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportCryptoKeyVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateImportJobRequest. */ + interface ICreateImportJobRequest { + + /** CreateImportJobRequest parent */ + parent?: (string|null); + + /** CreateImportJobRequest importJobId */ + importJobId?: (string|null); + + /** CreateImportJobRequest importJob */ + importJob?: (google.cloud.kms.v1.IImportJob|null); + } + + /** Represents a CreateImportJobRequest. */ + class CreateImportJobRequest implements ICreateImportJobRequest { + + /** + * Constructs a new CreateImportJobRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ICreateImportJobRequest); + + /** CreateImportJobRequest parent. */ + public parent: string; + + /** CreateImportJobRequest importJobId. */ + public importJobId: string; + + /** CreateImportJobRequest importJob. */ + public importJob?: (google.cloud.kms.v1.IImportJob|null); + + /** + * Creates a new CreateImportJobRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateImportJobRequest instance + */ + public static create(properties?: google.cloud.kms.v1.ICreateImportJobRequest): google.cloud.kms.v1.CreateImportJobRequest; + + /** + * Encodes the specified CreateImportJobRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateImportJobRequest.verify|verify} messages. + * @param message CreateImportJobRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ICreateImportJobRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateImportJobRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateImportJobRequest.verify|verify} messages. + * @param message CreateImportJobRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ICreateImportJobRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateImportJobRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateImportJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.CreateImportJobRequest; + + /** + * Decodes a CreateImportJobRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateImportJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.CreateImportJobRequest; + + /** + * Verifies a CreateImportJobRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateImportJobRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateImportJobRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.CreateImportJobRequest; + + /** + * Creates a plain object from a CreateImportJobRequest message. Also converts values to other types if specified. + * @param message CreateImportJobRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.CreateImportJobRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateImportJobRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateImportJobRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateCryptoKeyRequest. */ + interface IUpdateCryptoKeyRequest { + + /** UpdateCryptoKeyRequest cryptoKey */ + cryptoKey?: (google.cloud.kms.v1.ICryptoKey|null); + + /** UpdateCryptoKeyRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateCryptoKeyRequest. */ + class UpdateCryptoKeyRequest implements IUpdateCryptoKeyRequest { + + /** + * Constructs a new UpdateCryptoKeyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IUpdateCryptoKeyRequest); + + /** UpdateCryptoKeyRequest cryptoKey. */ + public cryptoKey?: (google.cloud.kms.v1.ICryptoKey|null); + + /** UpdateCryptoKeyRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateCryptoKeyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCryptoKeyRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IUpdateCryptoKeyRequest): google.cloud.kms.v1.UpdateCryptoKeyRequest; + + /** + * Encodes the specified UpdateCryptoKeyRequest message. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyRequest.verify|verify} messages. + * @param message UpdateCryptoKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IUpdateCryptoKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateCryptoKeyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyRequest.verify|verify} messages. + * @param message UpdateCryptoKeyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IUpdateCryptoKeyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateCryptoKeyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.UpdateCryptoKeyRequest; + + /** + * Decodes an UpdateCryptoKeyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.UpdateCryptoKeyRequest; + + /** + * Verifies an UpdateCryptoKeyRequest message. + * @param message Plain 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 UpdateCryptoKeyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCryptoKeyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.UpdateCryptoKeyRequest; + + /** + * Creates a plain object from an UpdateCryptoKeyRequest message. Also converts values to other types if specified. + * @param message UpdateCryptoKeyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.UpdateCryptoKeyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateCryptoKeyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCryptoKeyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateCryptoKeyVersionRequest. */ + interface IUpdateCryptoKeyVersionRequest { + + /** UpdateCryptoKeyVersionRequest cryptoKeyVersion */ + cryptoKeyVersion?: (google.cloud.kms.v1.ICryptoKeyVersion|null); + + /** UpdateCryptoKeyVersionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateCryptoKeyVersionRequest. */ + class UpdateCryptoKeyVersionRequest implements IUpdateCryptoKeyVersionRequest { + + /** + * Constructs a new UpdateCryptoKeyVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest); + + /** UpdateCryptoKeyVersionRequest cryptoKeyVersion. */ + public cryptoKeyVersion?: (google.cloud.kms.v1.ICryptoKeyVersion|null); + + /** UpdateCryptoKeyVersionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateCryptoKeyVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCryptoKeyVersionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest): google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; + + /** + * Encodes the specified UpdateCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.verify|verify} messages. + * @param message UpdateCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.verify|verify} messages. + * @param message UpdateCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateCryptoKeyVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; + + /** + * Decodes an UpdateCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; + + /** + * Verifies an UpdateCryptoKeyVersionRequest message. + * @param message Plain 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 UpdateCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCryptoKeyVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; + + /** + * Creates a plain object from an UpdateCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @param message UpdateCryptoKeyVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.UpdateCryptoKeyVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateCryptoKeyVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCryptoKeyVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateCryptoKeyPrimaryVersionRequest. */ + interface IUpdateCryptoKeyPrimaryVersionRequest { + + /** UpdateCryptoKeyPrimaryVersionRequest name */ + name?: (string|null); + + /** UpdateCryptoKeyPrimaryVersionRequest cryptoKeyVersionId */ + cryptoKeyVersionId?: (string|null); + } + + /** Represents an UpdateCryptoKeyPrimaryVersionRequest. */ + class UpdateCryptoKeyPrimaryVersionRequest implements IUpdateCryptoKeyPrimaryVersionRequest { + + /** + * Constructs a new UpdateCryptoKeyPrimaryVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest); + + /** UpdateCryptoKeyPrimaryVersionRequest name. */ + public name: string; + + /** UpdateCryptoKeyPrimaryVersionRequest cryptoKeyVersionId. */ + public cryptoKeyVersionId: string; + + /** + * Creates a new UpdateCryptoKeyPrimaryVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateCryptoKeyPrimaryVersionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest): google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; + + /** + * Encodes the specified UpdateCryptoKeyPrimaryVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.verify|verify} messages. + * @param message UpdateCryptoKeyPrimaryVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateCryptoKeyPrimaryVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.verify|verify} messages. + * @param message UpdateCryptoKeyPrimaryVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateCryptoKeyPrimaryVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateCryptoKeyPrimaryVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; + + /** + * Decodes an UpdateCryptoKeyPrimaryVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateCryptoKeyPrimaryVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; + + /** + * Verifies an UpdateCryptoKeyPrimaryVersionRequest message. + * @param message Plain 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 UpdateCryptoKeyPrimaryVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateCryptoKeyPrimaryVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; + + /** + * Creates a plain object from an UpdateCryptoKeyPrimaryVersionRequest message. Also converts values to other types if specified. + * @param message UpdateCryptoKeyPrimaryVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateCryptoKeyPrimaryVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateCryptoKeyPrimaryVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DestroyCryptoKeyVersionRequest. */ + interface IDestroyCryptoKeyVersionRequest { + + /** DestroyCryptoKeyVersionRequest name */ + name?: (string|null); + } + + /** Represents a DestroyCryptoKeyVersionRequest. */ + class DestroyCryptoKeyVersionRequest implements IDestroyCryptoKeyVersionRequest { + + /** + * Constructs a new DestroyCryptoKeyVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest); + + /** DestroyCryptoKeyVersionRequest name. */ + public name: string; + + /** + * Creates a new DestroyCryptoKeyVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DestroyCryptoKeyVersionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest): google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; + + /** + * Encodes the specified DestroyCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.verify|verify} messages. + * @param message DestroyCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DestroyCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.verify|verify} messages. + * @param message DestroyCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DestroyCryptoKeyVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DestroyCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; + + /** + * Decodes a DestroyCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DestroyCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; + + /** + * Verifies a DestroyCryptoKeyVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DestroyCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DestroyCryptoKeyVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; + + /** + * Creates a plain object from a DestroyCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @param message DestroyCryptoKeyVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.DestroyCryptoKeyVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DestroyCryptoKeyVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DestroyCryptoKeyVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RestoreCryptoKeyVersionRequest. */ + interface IRestoreCryptoKeyVersionRequest { + + /** RestoreCryptoKeyVersionRequest name */ + name?: (string|null); + } + + /** Represents a RestoreCryptoKeyVersionRequest. */ + class RestoreCryptoKeyVersionRequest implements IRestoreCryptoKeyVersionRequest { + + /** + * Constructs a new RestoreCryptoKeyVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest); + + /** RestoreCryptoKeyVersionRequest name. */ + public name: string; + + /** + * Creates a new RestoreCryptoKeyVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreCryptoKeyVersionRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest): google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; + + /** + * Encodes the specified RestoreCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.verify|verify} messages. + * @param message RestoreCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.verify|verify} messages. + * @param message RestoreCryptoKeyVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreCryptoKeyVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; + + /** + * Decodes a RestoreCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; + + /** + * Verifies a RestoreCryptoKeyVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RestoreCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreCryptoKeyVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; + + /** + * Creates a plain object from a RestoreCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @param message RestoreCryptoKeyVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.RestoreCryptoKeyVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreCryptoKeyVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RestoreCryptoKeyVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EncryptRequest. */ + interface IEncryptRequest { + + /** EncryptRequest name */ + name?: (string|null); + + /** EncryptRequest plaintext */ + plaintext?: (Uint8Array|string|null); + + /** EncryptRequest additionalAuthenticatedData */ + additionalAuthenticatedData?: (Uint8Array|string|null); + + /** EncryptRequest plaintextCrc32c */ + plaintextCrc32c?: (google.protobuf.IInt64Value|null); + + /** EncryptRequest additionalAuthenticatedDataCrc32c */ + additionalAuthenticatedDataCrc32c?: (google.protobuf.IInt64Value|null); + } + + /** Represents an EncryptRequest. */ + class EncryptRequest implements IEncryptRequest { + + /** + * Constructs a new EncryptRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IEncryptRequest); + + /** EncryptRequest name. */ + public name: string; + + /** EncryptRequest plaintext. */ + public plaintext: (Uint8Array|string); + + /** EncryptRequest additionalAuthenticatedData. */ + public additionalAuthenticatedData: (Uint8Array|string); + + /** EncryptRequest plaintextCrc32c. */ + public plaintextCrc32c?: (google.protobuf.IInt64Value|null); + + /** EncryptRequest additionalAuthenticatedDataCrc32c. */ + public additionalAuthenticatedDataCrc32c?: (google.protobuf.IInt64Value|null); + + /** + * Creates a new EncryptRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns EncryptRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IEncryptRequest): google.cloud.kms.v1.EncryptRequest; + + /** + * Encodes the specified EncryptRequest message. Does not implicitly {@link google.cloud.kms.v1.EncryptRequest.verify|verify} messages. + * @param message EncryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IEncryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EncryptRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.EncryptRequest.verify|verify} messages. + * @param message EncryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IEncryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EncryptRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EncryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.EncryptRequest; + + /** + * Decodes an EncryptRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EncryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.EncryptRequest; + + /** + * Verifies an EncryptRequest message. + * @param message Plain 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 EncryptRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EncryptRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.EncryptRequest; + + /** + * Creates a plain object from an EncryptRequest message. Also converts values to other types if specified. + * @param message EncryptRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.EncryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EncryptRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EncryptRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DecryptRequest. */ + interface IDecryptRequest { + + /** DecryptRequest name */ + name?: (string|null); + + /** DecryptRequest ciphertext */ + ciphertext?: (Uint8Array|string|null); + + /** DecryptRequest additionalAuthenticatedData */ + additionalAuthenticatedData?: (Uint8Array|string|null); + + /** DecryptRequest ciphertextCrc32c */ + ciphertextCrc32c?: (google.protobuf.IInt64Value|null); + + /** DecryptRequest additionalAuthenticatedDataCrc32c */ + additionalAuthenticatedDataCrc32c?: (google.protobuf.IInt64Value|null); + } + + /** Represents a DecryptRequest. */ + class DecryptRequest implements IDecryptRequest { + + /** + * Constructs a new DecryptRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IDecryptRequest); + + /** DecryptRequest name. */ + public name: string; + + /** DecryptRequest ciphertext. */ + public ciphertext: (Uint8Array|string); + + /** DecryptRequest additionalAuthenticatedData. */ + public additionalAuthenticatedData: (Uint8Array|string); + + /** DecryptRequest ciphertextCrc32c. */ + public ciphertextCrc32c?: (google.protobuf.IInt64Value|null); + + /** DecryptRequest additionalAuthenticatedDataCrc32c. */ + public additionalAuthenticatedDataCrc32c?: (google.protobuf.IInt64Value|null); + + /** + * Creates a new DecryptRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DecryptRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IDecryptRequest): google.cloud.kms.v1.DecryptRequest; + + /** + * Encodes the specified DecryptRequest message. Does not implicitly {@link google.cloud.kms.v1.DecryptRequest.verify|verify} messages. + * @param message DecryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IDecryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DecryptRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.DecryptRequest.verify|verify} messages. + * @param message DecryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IDecryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DecryptRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DecryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.DecryptRequest; + + /** + * Decodes a DecryptRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DecryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.DecryptRequest; + + /** + * Verifies a DecryptRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DecryptRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DecryptRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.DecryptRequest; + + /** + * Creates a plain object from a DecryptRequest message. Also converts values to other types if specified. + * @param message DecryptRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.DecryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DecryptRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DecryptRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AsymmetricSignRequest. */ + interface IAsymmetricSignRequest { + + /** AsymmetricSignRequest name */ + name?: (string|null); + + /** AsymmetricSignRequest digest */ + digest?: (google.cloud.kms.v1.IDigest|null); + + /** AsymmetricSignRequest digestCrc32c */ + digestCrc32c?: (google.protobuf.IInt64Value|null); + + /** AsymmetricSignRequest data */ + data?: (Uint8Array|string|null); + + /** AsymmetricSignRequest dataCrc32c */ + dataCrc32c?: (google.protobuf.IInt64Value|null); + } + + /** Represents an AsymmetricSignRequest. */ + class AsymmetricSignRequest implements IAsymmetricSignRequest { + + /** + * Constructs a new AsymmetricSignRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IAsymmetricSignRequest); + + /** AsymmetricSignRequest name. */ + public name: string; + + /** AsymmetricSignRequest digest. */ + public digest?: (google.cloud.kms.v1.IDigest|null); + + /** AsymmetricSignRequest digestCrc32c. */ + public digestCrc32c?: (google.protobuf.IInt64Value|null); + + /** AsymmetricSignRequest data. */ + public data: (Uint8Array|string); + + /** AsymmetricSignRequest dataCrc32c. */ + public dataCrc32c?: (google.protobuf.IInt64Value|null); + + /** + * Creates a new AsymmetricSignRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AsymmetricSignRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IAsymmetricSignRequest): google.cloud.kms.v1.AsymmetricSignRequest; + + /** + * Encodes the specified AsymmetricSignRequest message. Does not implicitly {@link google.cloud.kms.v1.AsymmetricSignRequest.verify|verify} messages. + * @param message AsymmetricSignRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IAsymmetricSignRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AsymmetricSignRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.AsymmetricSignRequest.verify|verify} messages. + * @param message AsymmetricSignRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IAsymmetricSignRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AsymmetricSignRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AsymmetricSignRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.AsymmetricSignRequest; + + /** + * Decodes an AsymmetricSignRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AsymmetricSignRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.AsymmetricSignRequest; + + /** + * Verifies an AsymmetricSignRequest message. + * @param message Plain 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 AsymmetricSignRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AsymmetricSignRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.AsymmetricSignRequest; + + /** + * Creates a plain object from an AsymmetricSignRequest message. Also converts values to other types if specified. + * @param message AsymmetricSignRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.AsymmetricSignRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AsymmetricSignRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AsymmetricSignRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AsymmetricDecryptRequest. */ + interface IAsymmetricDecryptRequest { + + /** AsymmetricDecryptRequest name */ + name?: (string|null); + + /** AsymmetricDecryptRequest ciphertext */ + ciphertext?: (Uint8Array|string|null); + + /** AsymmetricDecryptRequest ciphertextCrc32c */ + ciphertextCrc32c?: (google.protobuf.IInt64Value|null); + } + + /** Represents an AsymmetricDecryptRequest. */ + class AsymmetricDecryptRequest implements IAsymmetricDecryptRequest { + + /** + * Constructs a new AsymmetricDecryptRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IAsymmetricDecryptRequest); + + /** AsymmetricDecryptRequest name. */ + public name: string; + + /** AsymmetricDecryptRequest ciphertext. */ + public ciphertext: (Uint8Array|string); + + /** AsymmetricDecryptRequest ciphertextCrc32c. */ + public ciphertextCrc32c?: (google.protobuf.IInt64Value|null); + + /** + * Creates a new AsymmetricDecryptRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AsymmetricDecryptRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IAsymmetricDecryptRequest): google.cloud.kms.v1.AsymmetricDecryptRequest; + + /** + * Encodes the specified AsymmetricDecryptRequest message. Does not implicitly {@link google.cloud.kms.v1.AsymmetricDecryptRequest.verify|verify} messages. + * @param message AsymmetricDecryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IAsymmetricDecryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AsymmetricDecryptRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.AsymmetricDecryptRequest.verify|verify} messages. + * @param message AsymmetricDecryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IAsymmetricDecryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AsymmetricDecryptRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AsymmetricDecryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.AsymmetricDecryptRequest; + + /** + * Decodes an AsymmetricDecryptRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AsymmetricDecryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.AsymmetricDecryptRequest; + + /** + * Verifies an AsymmetricDecryptRequest message. + * @param message Plain 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 AsymmetricDecryptRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AsymmetricDecryptRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.AsymmetricDecryptRequest; + + /** + * Creates a plain object from an AsymmetricDecryptRequest message. Also converts values to other types if specified. + * @param message AsymmetricDecryptRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.AsymmetricDecryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AsymmetricDecryptRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AsymmetricDecryptRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MacSignRequest. */ + interface IMacSignRequest { + + /** MacSignRequest name */ + name?: (string|null); + + /** MacSignRequest data */ + data?: (Uint8Array|string|null); + + /** MacSignRequest dataCrc32c */ + dataCrc32c?: (google.protobuf.IInt64Value|null); + } + + /** Represents a MacSignRequest. */ + class MacSignRequest implements IMacSignRequest { + + /** + * Constructs a new MacSignRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IMacSignRequest); + + /** MacSignRequest name. */ + public name: string; + + /** MacSignRequest data. */ + public data: (Uint8Array|string); + + /** MacSignRequest dataCrc32c. */ + public dataCrc32c?: (google.protobuf.IInt64Value|null); + + /** + * Creates a new MacSignRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns MacSignRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IMacSignRequest): google.cloud.kms.v1.MacSignRequest; + + /** + * Encodes the specified MacSignRequest message. Does not implicitly {@link google.cloud.kms.v1.MacSignRequest.verify|verify} messages. + * @param message MacSignRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IMacSignRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MacSignRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.MacSignRequest.verify|verify} messages. + * @param message MacSignRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IMacSignRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MacSignRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MacSignRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.MacSignRequest; + + /** + * Decodes a MacSignRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MacSignRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.MacSignRequest; + + /** + * Verifies a MacSignRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MacSignRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MacSignRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.MacSignRequest; + + /** + * Creates a plain object from a MacSignRequest message. Also converts values to other types if specified. + * @param message MacSignRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.MacSignRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MacSignRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MacSignRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MacVerifyRequest. */ + interface IMacVerifyRequest { + + /** MacVerifyRequest name */ + name?: (string|null); + + /** MacVerifyRequest data */ + data?: (Uint8Array|string|null); + + /** MacVerifyRequest dataCrc32c */ + dataCrc32c?: (google.protobuf.IInt64Value|null); + + /** MacVerifyRequest mac */ + mac?: (Uint8Array|string|null); + + /** MacVerifyRequest macCrc32c */ + macCrc32c?: (google.protobuf.IInt64Value|null); + } + + /** Represents a MacVerifyRequest. */ + class MacVerifyRequest implements IMacVerifyRequest { + + /** + * Constructs a new MacVerifyRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IMacVerifyRequest); + + /** MacVerifyRequest name. */ + public name: string; + + /** MacVerifyRequest data. */ + public data: (Uint8Array|string); + + /** MacVerifyRequest dataCrc32c. */ + public dataCrc32c?: (google.protobuf.IInt64Value|null); + + /** MacVerifyRequest mac. */ + public mac: (Uint8Array|string); + + /** MacVerifyRequest macCrc32c. */ + public macCrc32c?: (google.protobuf.IInt64Value|null); + + /** + * Creates a new MacVerifyRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns MacVerifyRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IMacVerifyRequest): google.cloud.kms.v1.MacVerifyRequest; + + /** + * Encodes the specified MacVerifyRequest message. Does not implicitly {@link google.cloud.kms.v1.MacVerifyRequest.verify|verify} messages. + * @param message MacVerifyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IMacVerifyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MacVerifyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.MacVerifyRequest.verify|verify} messages. + * @param message MacVerifyRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IMacVerifyRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MacVerifyRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MacVerifyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.MacVerifyRequest; + + /** + * Decodes a MacVerifyRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MacVerifyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.MacVerifyRequest; + + /** + * Verifies a MacVerifyRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MacVerifyRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MacVerifyRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.MacVerifyRequest; + + /** + * Creates a plain object from a MacVerifyRequest message. Also converts values to other types if specified. + * @param message MacVerifyRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.MacVerifyRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MacVerifyRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MacVerifyRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GenerateRandomBytesRequest. */ + interface IGenerateRandomBytesRequest { + + /** GenerateRandomBytesRequest location */ + location?: (string|null); + + /** GenerateRandomBytesRequest lengthBytes */ + lengthBytes?: (number|null); + + /** GenerateRandomBytesRequest protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + } + + /** Represents a GenerateRandomBytesRequest. */ + class GenerateRandomBytesRequest implements IGenerateRandomBytesRequest { + + /** + * Constructs a new GenerateRandomBytesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IGenerateRandomBytesRequest); + + /** GenerateRandomBytesRequest location. */ + public location: string; + + /** GenerateRandomBytesRequest lengthBytes. */ + public lengthBytes: number; + + /** GenerateRandomBytesRequest protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** + * Creates a new GenerateRandomBytesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateRandomBytesRequest instance + */ + public static create(properties?: google.cloud.kms.v1.IGenerateRandomBytesRequest): google.cloud.kms.v1.GenerateRandomBytesRequest; + + /** + * Encodes the specified GenerateRandomBytesRequest message. Does not implicitly {@link google.cloud.kms.v1.GenerateRandomBytesRequest.verify|verify} messages. + * @param message GenerateRandomBytesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IGenerateRandomBytesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateRandomBytesRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GenerateRandomBytesRequest.verify|verify} messages. + * @param message GenerateRandomBytesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IGenerateRandomBytesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateRandomBytesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateRandomBytesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.GenerateRandomBytesRequest; + + /** + * Decodes a GenerateRandomBytesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateRandomBytesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.GenerateRandomBytesRequest; + + /** + * Verifies a GenerateRandomBytesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateRandomBytesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateRandomBytesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.GenerateRandomBytesRequest; + + /** + * Creates a plain object from a GenerateRandomBytesRequest message. Also converts values to other types if specified. + * @param message GenerateRandomBytesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.GenerateRandomBytesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateRandomBytesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateRandomBytesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EncryptResponse. */ + interface IEncryptResponse { + + /** EncryptResponse name */ + name?: (string|null); + + /** EncryptResponse ciphertext */ + ciphertext?: (Uint8Array|string|null); + + /** EncryptResponse ciphertextCrc32c */ + ciphertextCrc32c?: (google.protobuf.IInt64Value|null); + + /** EncryptResponse verifiedPlaintextCrc32c */ + verifiedPlaintextCrc32c?: (boolean|null); + + /** EncryptResponse verifiedAdditionalAuthenticatedDataCrc32c */ + verifiedAdditionalAuthenticatedDataCrc32c?: (boolean|null); + + /** EncryptResponse protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + } + + /** Represents an EncryptResponse. */ + class EncryptResponse implements IEncryptResponse { + + /** + * Constructs a new EncryptResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IEncryptResponse); + + /** EncryptResponse name. */ + public name: string; + + /** EncryptResponse ciphertext. */ + public ciphertext: (Uint8Array|string); + + /** EncryptResponse ciphertextCrc32c. */ + public ciphertextCrc32c?: (google.protobuf.IInt64Value|null); + + /** EncryptResponse verifiedPlaintextCrc32c. */ + public verifiedPlaintextCrc32c: boolean; + + /** EncryptResponse verifiedAdditionalAuthenticatedDataCrc32c. */ + public verifiedAdditionalAuthenticatedDataCrc32c: boolean; + + /** EncryptResponse protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** + * Creates a new EncryptResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns EncryptResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IEncryptResponse): google.cloud.kms.v1.EncryptResponse; + + /** + * Encodes the specified EncryptResponse message. Does not implicitly {@link google.cloud.kms.v1.EncryptResponse.verify|verify} messages. + * @param message EncryptResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IEncryptResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EncryptResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.EncryptResponse.verify|verify} messages. + * @param message EncryptResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IEncryptResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EncryptResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EncryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.EncryptResponse; + + /** + * Decodes an EncryptResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EncryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.EncryptResponse; + + /** + * Verifies an EncryptResponse message. + * @param message Plain 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 EncryptResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EncryptResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.EncryptResponse; + + /** + * Creates a plain object from an EncryptResponse message. Also converts values to other types if specified. + * @param message EncryptResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.EncryptResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EncryptResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EncryptResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DecryptResponse. */ + interface IDecryptResponse { + + /** DecryptResponse plaintext */ + plaintext?: (Uint8Array|string|null); + + /** DecryptResponse plaintextCrc32c */ + plaintextCrc32c?: (google.protobuf.IInt64Value|null); + + /** DecryptResponse usedPrimary */ + usedPrimary?: (boolean|null); + + /** DecryptResponse protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + } + + /** Represents a DecryptResponse. */ + class DecryptResponse implements IDecryptResponse { + + /** + * Constructs a new DecryptResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IDecryptResponse); + + /** DecryptResponse plaintext. */ + public plaintext: (Uint8Array|string); + + /** DecryptResponse plaintextCrc32c. */ + public plaintextCrc32c?: (google.protobuf.IInt64Value|null); + + /** DecryptResponse usedPrimary. */ + public usedPrimary: boolean; + + /** DecryptResponse protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** + * Creates a new DecryptResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DecryptResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IDecryptResponse): google.cloud.kms.v1.DecryptResponse; + + /** + * Encodes the specified DecryptResponse message. Does not implicitly {@link google.cloud.kms.v1.DecryptResponse.verify|verify} messages. + * @param message DecryptResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IDecryptResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DecryptResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.DecryptResponse.verify|verify} messages. + * @param message DecryptResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IDecryptResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DecryptResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DecryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.DecryptResponse; + + /** + * Decodes a DecryptResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DecryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.DecryptResponse; + + /** + * Verifies a DecryptResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DecryptResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DecryptResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.DecryptResponse; + + /** + * Creates a plain object from a DecryptResponse message. Also converts values to other types if specified. + * @param message DecryptResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.DecryptResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DecryptResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DecryptResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AsymmetricSignResponse. */ + interface IAsymmetricSignResponse { + + /** AsymmetricSignResponse signature */ + signature?: (Uint8Array|string|null); + + /** AsymmetricSignResponse signatureCrc32c */ + signatureCrc32c?: (google.protobuf.IInt64Value|null); + + /** AsymmetricSignResponse verifiedDigestCrc32c */ + verifiedDigestCrc32c?: (boolean|null); + + /** AsymmetricSignResponse name */ + name?: (string|null); + + /** AsymmetricSignResponse verifiedDataCrc32c */ + verifiedDataCrc32c?: (boolean|null); + + /** AsymmetricSignResponse protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + } + + /** Represents an AsymmetricSignResponse. */ + class AsymmetricSignResponse implements IAsymmetricSignResponse { + + /** + * Constructs a new AsymmetricSignResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IAsymmetricSignResponse); + + /** AsymmetricSignResponse signature. */ + public signature: (Uint8Array|string); + + /** AsymmetricSignResponse signatureCrc32c. */ + public signatureCrc32c?: (google.protobuf.IInt64Value|null); + + /** AsymmetricSignResponse verifiedDigestCrc32c. */ + public verifiedDigestCrc32c: boolean; + + /** AsymmetricSignResponse name. */ + public name: string; + + /** AsymmetricSignResponse verifiedDataCrc32c. */ + public verifiedDataCrc32c: boolean; + + /** AsymmetricSignResponse protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** + * Creates a new AsymmetricSignResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AsymmetricSignResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IAsymmetricSignResponse): google.cloud.kms.v1.AsymmetricSignResponse; + + /** + * Encodes the specified AsymmetricSignResponse message. Does not implicitly {@link google.cloud.kms.v1.AsymmetricSignResponse.verify|verify} messages. + * @param message AsymmetricSignResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IAsymmetricSignResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AsymmetricSignResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.AsymmetricSignResponse.verify|verify} messages. + * @param message AsymmetricSignResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IAsymmetricSignResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AsymmetricSignResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AsymmetricSignResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.AsymmetricSignResponse; + + /** + * Decodes an AsymmetricSignResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AsymmetricSignResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.AsymmetricSignResponse; + + /** + * Verifies an AsymmetricSignResponse message. + * @param message Plain 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 AsymmetricSignResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AsymmetricSignResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.AsymmetricSignResponse; + + /** + * Creates a plain object from an AsymmetricSignResponse message. Also converts values to other types if specified. + * @param message AsymmetricSignResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.AsymmetricSignResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AsymmetricSignResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AsymmetricSignResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AsymmetricDecryptResponse. */ + interface IAsymmetricDecryptResponse { + + /** AsymmetricDecryptResponse plaintext */ + plaintext?: (Uint8Array|string|null); + + /** AsymmetricDecryptResponse plaintextCrc32c */ + plaintextCrc32c?: (google.protobuf.IInt64Value|null); + + /** AsymmetricDecryptResponse verifiedCiphertextCrc32c */ + verifiedCiphertextCrc32c?: (boolean|null); + + /** AsymmetricDecryptResponse protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + } + + /** Represents an AsymmetricDecryptResponse. */ + class AsymmetricDecryptResponse implements IAsymmetricDecryptResponse { + + /** + * Constructs a new AsymmetricDecryptResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IAsymmetricDecryptResponse); + + /** AsymmetricDecryptResponse plaintext. */ + public plaintext: (Uint8Array|string); + + /** AsymmetricDecryptResponse plaintextCrc32c. */ + public plaintextCrc32c?: (google.protobuf.IInt64Value|null); + + /** AsymmetricDecryptResponse verifiedCiphertextCrc32c. */ + public verifiedCiphertextCrc32c: boolean; + + /** AsymmetricDecryptResponse protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** + * Creates a new AsymmetricDecryptResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AsymmetricDecryptResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IAsymmetricDecryptResponse): google.cloud.kms.v1.AsymmetricDecryptResponse; + + /** + * Encodes the specified AsymmetricDecryptResponse message. Does not implicitly {@link google.cloud.kms.v1.AsymmetricDecryptResponse.verify|verify} messages. + * @param message AsymmetricDecryptResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IAsymmetricDecryptResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AsymmetricDecryptResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.AsymmetricDecryptResponse.verify|verify} messages. + * @param message AsymmetricDecryptResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IAsymmetricDecryptResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AsymmetricDecryptResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AsymmetricDecryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.AsymmetricDecryptResponse; + + /** + * Decodes an AsymmetricDecryptResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AsymmetricDecryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.AsymmetricDecryptResponse; + + /** + * Verifies an AsymmetricDecryptResponse message. + * @param message Plain 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 AsymmetricDecryptResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AsymmetricDecryptResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.AsymmetricDecryptResponse; + + /** + * Creates a plain object from an AsymmetricDecryptResponse message. Also converts values to other types if specified. + * @param message AsymmetricDecryptResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.AsymmetricDecryptResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AsymmetricDecryptResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AsymmetricDecryptResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MacSignResponse. */ + interface IMacSignResponse { + + /** MacSignResponse name */ + name?: (string|null); + + /** MacSignResponse mac */ + mac?: (Uint8Array|string|null); + + /** MacSignResponse macCrc32c */ + macCrc32c?: (google.protobuf.IInt64Value|null); + + /** MacSignResponse verifiedDataCrc32c */ + verifiedDataCrc32c?: (boolean|null); + + /** MacSignResponse protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + } + + /** Represents a MacSignResponse. */ + class MacSignResponse implements IMacSignResponse { + + /** + * Constructs a new MacSignResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IMacSignResponse); + + /** MacSignResponse name. */ + public name: string; + + /** MacSignResponse mac. */ + public mac: (Uint8Array|string); + + /** MacSignResponse macCrc32c. */ + public macCrc32c?: (google.protobuf.IInt64Value|null); + + /** MacSignResponse verifiedDataCrc32c. */ + public verifiedDataCrc32c: boolean; + + /** MacSignResponse protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** + * Creates a new MacSignResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns MacSignResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IMacSignResponse): google.cloud.kms.v1.MacSignResponse; + + /** + * Encodes the specified MacSignResponse message. Does not implicitly {@link google.cloud.kms.v1.MacSignResponse.verify|verify} messages. + * @param message MacSignResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IMacSignResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MacSignResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.MacSignResponse.verify|verify} messages. + * @param message MacSignResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IMacSignResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MacSignResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MacSignResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.MacSignResponse; + + /** + * Decodes a MacSignResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MacSignResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.MacSignResponse; + + /** + * Verifies a MacSignResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MacSignResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MacSignResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.MacSignResponse; + + /** + * Creates a plain object from a MacSignResponse message. Also converts values to other types if specified. + * @param message MacSignResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.MacSignResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MacSignResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MacSignResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MacVerifyResponse. */ + interface IMacVerifyResponse { + + /** MacVerifyResponse name */ + name?: (string|null); + + /** MacVerifyResponse success */ + success?: (boolean|null); + + /** MacVerifyResponse verifiedDataCrc32c */ + verifiedDataCrc32c?: (boolean|null); + + /** MacVerifyResponse verifiedMacCrc32c */ + verifiedMacCrc32c?: (boolean|null); + + /** MacVerifyResponse verifiedSuccessIntegrity */ + verifiedSuccessIntegrity?: (boolean|null); + + /** MacVerifyResponse protectionLevel */ + protectionLevel?: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel|null); + } + + /** Represents a MacVerifyResponse. */ + class MacVerifyResponse implements IMacVerifyResponse { + + /** + * Constructs a new MacVerifyResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IMacVerifyResponse); + + /** MacVerifyResponse name. */ + public name: string; + + /** MacVerifyResponse success. */ + public success: boolean; + + /** MacVerifyResponse verifiedDataCrc32c. */ + public verifiedDataCrc32c: boolean; + + /** MacVerifyResponse verifiedMacCrc32c. */ + public verifiedMacCrc32c: boolean; + + /** MacVerifyResponse verifiedSuccessIntegrity. */ + public verifiedSuccessIntegrity: boolean; + + /** MacVerifyResponse protectionLevel. */ + public protectionLevel: (google.cloud.kms.v1.ProtectionLevel|keyof typeof google.cloud.kms.v1.ProtectionLevel); + + /** + * Creates a new MacVerifyResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns MacVerifyResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IMacVerifyResponse): google.cloud.kms.v1.MacVerifyResponse; + + /** + * Encodes the specified MacVerifyResponse message. Does not implicitly {@link google.cloud.kms.v1.MacVerifyResponse.verify|verify} messages. + * @param message MacVerifyResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IMacVerifyResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MacVerifyResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.MacVerifyResponse.verify|verify} messages. + * @param message MacVerifyResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IMacVerifyResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MacVerifyResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MacVerifyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.MacVerifyResponse; + + /** + * Decodes a MacVerifyResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MacVerifyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.MacVerifyResponse; + + /** + * Verifies a MacVerifyResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MacVerifyResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MacVerifyResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.MacVerifyResponse; + + /** + * Creates a plain object from a MacVerifyResponse message. Also converts values to other types if specified. + * @param message MacVerifyResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.MacVerifyResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MacVerifyResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MacVerifyResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GenerateRandomBytesResponse. */ + interface IGenerateRandomBytesResponse { + + /** GenerateRandomBytesResponse data */ + data?: (Uint8Array|string|null); + + /** GenerateRandomBytesResponse dataCrc32c */ + dataCrc32c?: (google.protobuf.IInt64Value|null); + } + + /** Represents a GenerateRandomBytesResponse. */ + class GenerateRandomBytesResponse implements IGenerateRandomBytesResponse { + + /** + * Constructs a new GenerateRandomBytesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IGenerateRandomBytesResponse); + + /** GenerateRandomBytesResponse data. */ + public data: (Uint8Array|string); + + /** GenerateRandomBytesResponse dataCrc32c. */ + public dataCrc32c?: (google.protobuf.IInt64Value|null); + + /** + * Creates a new GenerateRandomBytesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateRandomBytesResponse instance + */ + public static create(properties?: google.cloud.kms.v1.IGenerateRandomBytesResponse): google.cloud.kms.v1.GenerateRandomBytesResponse; + + /** + * Encodes the specified GenerateRandomBytesResponse message. Does not implicitly {@link google.cloud.kms.v1.GenerateRandomBytesResponse.verify|verify} messages. + * @param message GenerateRandomBytesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IGenerateRandomBytesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateRandomBytesResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GenerateRandomBytesResponse.verify|verify} messages. + * @param message GenerateRandomBytesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IGenerateRandomBytesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateRandomBytesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateRandomBytesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.GenerateRandomBytesResponse; + + /** + * Decodes a GenerateRandomBytesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateRandomBytesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.GenerateRandomBytesResponse; + + /** + * Verifies a GenerateRandomBytesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateRandomBytesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateRandomBytesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.GenerateRandomBytesResponse; + + /** + * Creates a plain object from a GenerateRandomBytesResponse message. Also converts values to other types if specified. + * @param message GenerateRandomBytesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.GenerateRandomBytesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateRandomBytesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateRandomBytesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Digest. */ + interface IDigest { + + /** Digest sha256 */ + sha256?: (Uint8Array|string|null); + + /** Digest sha384 */ + sha384?: (Uint8Array|string|null); + + /** Digest sha512 */ + sha512?: (Uint8Array|string|null); + } + + /** Represents a Digest. */ + class Digest implements IDigest { + + /** + * Constructs a new Digest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.IDigest); + + /** Digest sha256. */ + public sha256?: (Uint8Array|string|null); + + /** Digest sha384. */ + public sha384?: (Uint8Array|string|null); + + /** Digest sha512. */ + public sha512?: (Uint8Array|string|null); + + /** Digest digest. */ + public digest?: ("sha256"|"sha384"|"sha512"); + + /** + * Creates a new Digest instance using the specified properties. + * @param [properties] Properties to set + * @returns Digest instance + */ + public static create(properties?: google.cloud.kms.v1.IDigest): google.cloud.kms.v1.Digest; + + /** + * Encodes the specified Digest message. Does not implicitly {@link google.cloud.kms.v1.Digest.verify|verify} messages. + * @param message Digest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.IDigest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Digest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.Digest.verify|verify} messages. + * @param message Digest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.IDigest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Digest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Digest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.Digest; + + /** + * Decodes a Digest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Digest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.Digest; + + /** + * Verifies a Digest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Digest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Digest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.Digest; + + /** + * Creates a plain object from a Digest message. Also converts values to other types if specified. + * @param message Digest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.Digest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Digest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Digest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LocationMetadata. */ + interface ILocationMetadata { + + /** LocationMetadata hsmAvailable */ + hsmAvailable?: (boolean|null); + + /** LocationMetadata ekmAvailable */ + ekmAvailable?: (boolean|null); + } + + /** Represents a LocationMetadata. */ + class LocationMetadata implements ILocationMetadata { + + /** + * Constructs a new LocationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.kms.v1.ILocationMetadata); + + /** LocationMetadata hsmAvailable. */ + public hsmAvailable: boolean; + + /** LocationMetadata ekmAvailable. */ + public ekmAvailable: boolean; + + /** + * Creates a new LocationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns LocationMetadata instance + */ + public static create(properties?: google.cloud.kms.v1.ILocationMetadata): google.cloud.kms.v1.LocationMetadata; + + /** + * Encodes the specified LocationMetadata message. Does not implicitly {@link google.cloud.kms.v1.LocationMetadata.verify|verify} messages. + * @param message LocationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.kms.v1.ILocationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocationMetadata message, length delimited. Does not implicitly {@link google.cloud.kms.v1.LocationMetadata.verify|verify} messages. + * @param message LocationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.kms.v1.ILocationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.kms.v1.LocationMetadata; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.kms.v1.LocationMetadata; + + /** + * Verifies a LocationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.kms.v1.LocationMetadata; + + /** + * Creates a plain object from a LocationMetadata message. Also converts values to other types if specified. + * @param message LocationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.kms.v1.LocationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: (google.api.IHttpRule[]|null); + + /** Http fullyDecodeReservedExpansion */ + fullyDecodeReservedExpansion?: (boolean|null); + } + + /** Represents a Http. */ + class Http implements IHttp { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** Http fullyDecodeReservedExpansion. */ + public fullyDecodeReservedExpansion: boolean; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Http + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HttpRule. */ + interface IHttpRule { + + /** HttpRule selector */ + selector?: (string|null); + + /** HttpRule get */ + get?: (string|null); + + /** HttpRule put */ + put?: (string|null); + + /** HttpRule post */ + post?: (string|null); + + /** HttpRule delete */ + "delete"?: (string|null); + + /** HttpRule patch */ + patch?: (string|null); + + /** HttpRule custom */ + custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body */ + body?: (string|null); + + /** HttpRule responseBody */ + responseBody?: (string|null); + + /** HttpRule additionalBindings */ + additionalBindings?: (google.api.IHttpRule[]|null); + } + + /** Represents a HttpRule. */ + class HttpRule implements IHttpRule { + + /** + * Constructs a new HttpRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpRule); + + /** HttpRule selector. */ + public selector: string; + + /** HttpRule get. */ + public get?: (string|null); + + /** HttpRule put. */ + public put?: (string|null); + + /** HttpRule post. */ + public post?: (string|null); + + /** HttpRule delete. */ + public delete?: (string|null); + + /** HttpRule patch. */ + public patch?: (string|null); + + /** HttpRule custom. */ + public custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body. */ + public body: string; + + /** HttpRule responseBody. */ + public responseBody: string; + + /** HttpRule additionalBindings. */ + public additionalBindings: google.api.IHttpRule[]; + + /** HttpRule pattern. */ + public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); + + /** + * Creates a new HttpRule instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpRule instance + */ + public static create(properties?: google.api.IHttpRule): google.api.HttpRule; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; + + /** + * Verifies a HttpRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpRule + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpRule; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @param message HttpRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CustomHttpPattern. */ + interface ICustomHttpPattern { + + /** CustomHttpPattern kind */ + kind?: (string|null); + + /** CustomHttpPattern path */ + path?: (string|null); + } + + /** Represents a CustomHttpPattern. */ + class CustomHttpPattern implements ICustomHttpPattern { + + /** + * Constructs a new CustomHttpPattern. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICustomHttpPattern); + + /** CustomHttpPattern kind. */ + public kind: string; + + /** CustomHttpPattern path. */ + public path: string; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomHttpPattern instance + */ + public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; + + /** + * Verifies a CustomHttpPattern message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomHttpPattern + */ + public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @param message CustomHttpPattern + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomHttpPattern to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomHttpPattern + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace protobuf. */ + namespace protobuf { + + /** Properties of a FileDescriptorSet. */ + interface IFileDescriptorSet { + + /** FileDescriptorSet file */ + file?: (google.protobuf.IFileDescriptorProto[]|null); + } + + /** Represents a FileDescriptorSet. */ + class FileDescriptorSet implements IFileDescriptorSet { + + /** + * Constructs a new FileDescriptorSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorSet); + + /** FileDescriptorSet file. */ + public file: google.protobuf.IFileDescriptorProto[]; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorSet instance + */ + public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + + /** + * Verifies a FileDescriptorSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @param message FileDescriptorSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FileDescriptorProto. */ + interface IFileDescriptorProto { + + /** FileDescriptorProto name */ + name?: (string|null); + + /** FileDescriptorProto package */ + "package"?: (string|null); + + /** FileDescriptorProto dependency */ + dependency?: (string[]|null); + + /** FileDescriptorProto publicDependency */ + publicDependency?: (number[]|null); + + /** FileDescriptorProto weakDependency */ + weakDependency?: (number[]|null); + + /** FileDescriptorProto messageType */ + messageType?: (google.protobuf.IDescriptorProto[]|null); + + /** FileDescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** FileDescriptorProto service */ + service?: (google.protobuf.IServiceDescriptorProto[]|null); + + /** FileDescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** FileDescriptorProto options */ + options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo */ + sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax */ + syntax?: (string|null); + + /** FileDescriptorProto edition */ + edition?: (string|null); + } + + /** Represents a FileDescriptorProto. */ + class FileDescriptorProto implements IFileDescriptorProto { + + /** + * Constructs a new FileDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorProto); + + /** FileDescriptorProto name. */ + public name: string; + + /** FileDescriptorProto package. */ + public package: string; + + /** FileDescriptorProto dependency. */ + public dependency: string[]; + + /** FileDescriptorProto publicDependency. */ + public publicDependency: number[]; + + /** FileDescriptorProto weakDependency. */ + public weakDependency: number[]; + + /** FileDescriptorProto messageType. */ + public messageType: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service. */ + public service: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options. */ + public options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo. */ + public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax. */ + public syntax: string; + + /** FileDescriptorProto edition. */ + public edition: string; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + + /** + * Verifies a FileDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @param message FileDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DescriptorProto. */ + interface IDescriptorProto { + + /** DescriptorProto name */ + name?: (string|null); + + /** DescriptorProto field */ + field?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto nestedType */ + nestedType?: (google.protobuf.IDescriptorProto[]|null); + + /** DescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** DescriptorProto extensionRange */ + extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); + + /** DescriptorProto oneofDecl */ + oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); + + /** DescriptorProto options */ + options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange */ + reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); + + /** DescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents a DescriptorProto. */ + class DescriptorProto implements IDescriptorProto { + + /** + * Constructs a new DescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDescriptorProto); + + /** DescriptorProto name. */ + public name: string; + + /** DescriptorProto field. */ + public field: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType. */ + public nestedType: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange. */ + public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl. */ + public oneofDecl: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options. */ + public options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange. */ + public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns DescriptorProto instance + */ + public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + + /** + * Verifies a DescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @param message DescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DescriptorProto { + + /** Properties of an ExtensionRange. */ + interface IExtensionRange { + + /** ExtensionRange start */ + start?: (number|null); + + /** ExtensionRange end */ + end?: (number|null); + + /** ExtensionRange options */ + options?: (google.protobuf.IExtensionRangeOptions|null); + } + + /** Represents an ExtensionRange. */ + class ExtensionRange implements IExtensionRange { + + /** + * Constructs a new ExtensionRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); + + /** ExtensionRange start. */ + public start: number; + + /** ExtensionRange end. */ + public end: number; + + /** ExtensionRange options. */ + public options?: (google.protobuf.IExtensionRangeOptions|null); + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Verifies an ExtensionRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @param message ExtensionRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReservedRange. */ + interface IReservedRange { + + /** ReservedRange start */ + start?: (number|null); + + /** ReservedRange end */ + end?: (number|null); + } + + /** Represents a ReservedRange. */ + class ReservedRange implements IReservedRange { + + /** + * Constructs a new ReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); + + /** ReservedRange start. */ + public start: number; + + /** ReservedRange end. */ + public end: number; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ReservedRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Verifies a ReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @param message ReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an ExtensionRangeOptions. */ + interface IExtensionRangeOptions { + + /** ExtensionRangeOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an ExtensionRangeOptions. */ + class ExtensionRangeOptions implements IExtensionRangeOptions { + + /** + * Constructs a new ExtensionRangeOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IExtensionRangeOptions); + + /** ExtensionRangeOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRangeOptions instance + */ + public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions; + + /** + * Verifies an ExtensionRangeOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRangeOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @param message ExtensionRangeOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldDescriptorProto. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: (string|null); + + /** FieldDescriptorProto number */ + number?: (number|null); + + /** FieldDescriptorProto label */ + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + + /** FieldDescriptorProto type */ + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + + /** FieldDescriptorProto typeName */ + typeName?: (string|null); + + /** FieldDescriptorProto extendee */ + extendee?: (string|null); + + /** FieldDescriptorProto defaultValue */ + defaultValue?: (string|null); + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: (number|null); + + /** FieldDescriptorProto jsonName */ + jsonName?: (string|null); + + /** FieldDescriptorProto options */ + options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); + } + + /** Represents a FieldDescriptorProto. */ + class FieldDescriptorProto implements IFieldDescriptorProto { + + /** + * Constructs a new FieldDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldDescriptorProto); + + /** FieldDescriptorProto name. */ + public name: string; + + /** FieldDescriptorProto number. */ + public number: number; + + /** FieldDescriptorProto label. */ + public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); + + /** FieldDescriptorProto type. */ + public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); + + /** FieldDescriptorProto typeName. */ + public typeName: string; + + /** FieldDescriptorProto extendee. */ + public extendee: string; + + /** FieldDescriptorProto defaultValue. */ + public defaultValue: string; + + /** FieldDescriptorProto oneofIndex. */ + public oneofIndex: number; + + /** FieldDescriptorProto jsonName. */ + public jsonName: string; + + /** FieldDescriptorProto options. */ + public options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional. */ + public proto3Optional: boolean; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldDescriptorProto { + + /** Type enum. */ + enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18 + } + + /** Label enum. */ + enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3 + } + } + + /** Properties of an OneofDescriptorProto. */ + interface IOneofDescriptorProto { + + /** OneofDescriptorProto name */ + name?: (string|null); + + /** OneofDescriptorProto options */ + options?: (google.protobuf.IOneofOptions|null); + } + + /** Represents an OneofDescriptorProto. */ + class OneofDescriptorProto implements IOneofDescriptorProto { + + /** + * Constructs a new OneofDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofDescriptorProto); + + /** OneofDescriptorProto name. */ + public name: string; + + /** OneofDescriptorProto options. */ + public options?: (google.protobuf.IOneofOptions|null); + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofDescriptorProto instance + */ + public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + + /** + * Verifies an OneofDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @param message OneofDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumDescriptorProto. */ + interface IEnumDescriptorProto { + + /** EnumDescriptorProto name */ + name?: (string|null); + + /** EnumDescriptorProto value */ + value?: (google.protobuf.IEnumValueDescriptorProto[]|null); + + /** EnumDescriptorProto options */ + options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange */ + reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); + + /** EnumDescriptorProto reservedName */ + reservedName?: (string[]|null); + } + + /** Represents an EnumDescriptorProto. */ + class EnumDescriptorProto implements IEnumDescriptorProto { + + /** + * Constructs a new EnumDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumDescriptorProto); + + /** EnumDescriptorProto name. */ + public name: string; + + /** EnumDescriptorProto value. */ + public value: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options. */ + public options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange. */ + public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; + + /** EnumDescriptorProto reservedName. */ + public reservedName: string[]; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + + /** + * Verifies an EnumDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @param message EnumDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EnumDescriptorProto { + + /** Properties of an EnumReservedRange. */ + interface IEnumReservedRange { + + /** EnumReservedRange start */ + start?: (number|null); + + /** EnumReservedRange end */ + end?: (number|null); + } + + /** Represents an EnumReservedRange. */ + class EnumReservedRange implements IEnumReservedRange { + + /** + * Constructs a new EnumReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); + + /** EnumReservedRange start. */ + public start: number; + + /** EnumReservedRange end. */ + public end: number; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumReservedRange instance + */ + public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Verifies an EnumReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @param message EnumReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an EnumValueDescriptorProto. */ + interface IEnumValueDescriptorProto { + + /** EnumValueDescriptorProto name */ + name?: (string|null); + + /** EnumValueDescriptorProto number */ + number?: (number|null); + + /** EnumValueDescriptorProto options */ + options?: (google.protobuf.IEnumValueOptions|null); + } + + /** Represents an EnumValueDescriptorProto. */ + class EnumValueDescriptorProto implements IEnumValueDescriptorProto { + + /** + * Constructs a new EnumValueDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueDescriptorProto); + + /** EnumValueDescriptorProto name. */ + public name: string; + + /** EnumValueDescriptorProto number. */ + public number: number; + + /** EnumValueDescriptorProto options. */ + public options?: (google.protobuf.IEnumValueOptions|null); + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + + /** + * Verifies an EnumValueDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @param message EnumValueDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceDescriptorProto. */ + interface IServiceDescriptorProto { + + /** ServiceDescriptorProto name */ + name?: (string|null); + + /** ServiceDescriptorProto method */ + method?: (google.protobuf.IMethodDescriptorProto[]|null); + + /** ServiceDescriptorProto options */ + options?: (google.protobuf.IServiceOptions|null); + } + + /** Represents a ServiceDescriptorProto. */ + class ServiceDescriptorProto implements IServiceDescriptorProto { + + /** + * Constructs a new ServiceDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceDescriptorProto); + + /** ServiceDescriptorProto name. */ + public name: string; + + /** ServiceDescriptorProto method. */ + public method: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options. */ + public options?: (google.protobuf.IServiceOptions|null); + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceDescriptorProto instance + */ + public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + + /** + * Verifies a ServiceDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @param message ServiceDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodDescriptorProto. */ + interface IMethodDescriptorProto { + + /** MethodDescriptorProto name */ + name?: (string|null); + + /** MethodDescriptorProto inputType */ + inputType?: (string|null); + + /** MethodDescriptorProto outputType */ + outputType?: (string|null); + + /** MethodDescriptorProto options */ + options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming */ + clientStreaming?: (boolean|null); + + /** MethodDescriptorProto serverStreaming */ + serverStreaming?: (boolean|null); + } + + /** Represents a MethodDescriptorProto. */ + class MethodDescriptorProto implements IMethodDescriptorProto { + + /** + * Constructs a new MethodDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodDescriptorProto); + + /** MethodDescriptorProto name. */ + public name: string; + + /** MethodDescriptorProto inputType. */ + public inputType: string; + + /** MethodDescriptorProto outputType. */ + public outputType: string; + + /** MethodDescriptorProto options. */ + public options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming. */ + public clientStreaming: boolean; + + /** MethodDescriptorProto serverStreaming. */ + public serverStreaming: boolean; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodDescriptorProto instance + */ + public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + + /** + * Verifies a MethodDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @param message MethodDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FileOptions. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: (string|null); + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: (string|null); + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: (boolean|null); + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: (boolean|null); + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: (boolean|null); + + /** FileOptions optimizeFor */ + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + + /** FileOptions goPackage */ + goPackage?: (string|null); + + /** FileOptions ccGenericServices */ + ccGenericServices?: (boolean|null); + + /** FileOptions javaGenericServices */ + javaGenericServices?: (boolean|null); + + /** FileOptions pyGenericServices */ + pyGenericServices?: (boolean|null); + + /** FileOptions phpGenericServices */ + phpGenericServices?: (boolean|null); + + /** FileOptions deprecated */ + deprecated?: (boolean|null); + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: (boolean|null); + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: (string|null); + + /** FileOptions csharpNamespace */ + csharpNamespace?: (string|null); + + /** FileOptions swiftPrefix */ + swiftPrefix?: (string|null); + + /** FileOptions phpClassPrefix */ + phpClassPrefix?: (string|null); + + /** FileOptions phpNamespace */ + phpNamespace?: (string|null); + + /** FileOptions phpMetadataNamespace */ + phpMetadataNamespace?: (string|null); + + /** FileOptions rubyPackage */ + rubyPackage?: (string|null); + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); + } + + /** Represents a FileOptions. */ + class FileOptions implements IFileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions phpGenericServices. */ + public phpGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions swiftPrefix. */ + public swiftPrefix: string; + + /** FileOptions phpClassPrefix. */ + public phpClassPrefix: string; + + /** FileOptions phpNamespace. */ + public phpNamespace: string; + + /** FileOptions phpMetadataNamespace. */ + public phpMetadataNamespace: string; + + /** FileOptions rubyPackage. */ + public rubyPackage: string; + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FileOptions { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: (boolean|null); + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: (boolean|null); + + /** MessageOptions deprecated */ + deprecated?: (boolean|null); + + /** MessageOptions mapEntry */ + mapEntry?: (boolean|null); + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); + } + + /** Represents a MessageOptions. */ + class MessageOptions implements IMessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldOptions. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + + /** FieldOptions lazy */ + lazy?: (boolean|null); + + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + + /** FieldOptions deprecated */ + deprecated?: (boolean|null); + + /** FieldOptions weak */ + weak?: (boolean|null); + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FieldOptions .google.api.fieldBehavior */ + ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); + } + + /** Represents a FieldOptions. */ + class FieldOptions implements IFieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + + /** FieldOptions deprecated. */ + public deprecated: boolean; + + /** FieldOptions weak. */ + public weak: boolean; + + /** FieldOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOptions instance + */ + public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + + /** + * Verifies a FieldOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @param message FieldOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldOptions { + + /** CType enum. */ + enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2 + } + + /** JSType enum. */ + enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2 + } + } + + /** Properties of an OneofOptions. */ + interface IOneofOptions { + + /** OneofOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an OneofOptions. */ + class OneofOptions implements IOneofOptions { + + /** + * Constructs a new OneofOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofOptions); + + /** OneofOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofOptions instance + */ + public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + + /** + * Verifies an OneofOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @param message OneofOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumOptions. */ + interface IEnumOptions { + + /** EnumOptions allowAlias */ + allowAlias?: (boolean|null); + + /** EnumOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumOptions. */ + class EnumOptions implements IEnumOptions { + + /** + * Constructs a new EnumOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumOptions); + + /** EnumOptions allowAlias. */ + public allowAlias: boolean; + + /** EnumOptions deprecated. */ + public deprecated: boolean; + + /** EnumOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumOptions instance + */ + public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + + /** + * Verifies an EnumOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @param message EnumOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumValueOptions. */ + interface IEnumValueOptions { + + /** EnumValueOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumValueOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumValueOptions. */ + class EnumValueOptions implements IEnumValueOptions { + + /** + * Constructs a new EnumValueOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueOptions); + + /** EnumValueOptions deprecated. */ + public deprecated: boolean; + + /** EnumValueOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueOptions instance + */ + public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + + /** + * Verifies an EnumValueOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @param message EnumValueOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceOptions. */ + interface IServiceOptions { + + /** ServiceOptions deprecated */ + deprecated?: (boolean|null); + + /** ServiceOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ServiceOptions .google.api.defaultHost */ + ".google.api.defaultHost"?: (string|null); + + /** ServiceOptions .google.api.oauthScopes */ + ".google.api.oauthScopes"?: (string|null); + } + + /** Represents a ServiceOptions. */ + class ServiceOptions implements IServiceOptions { + + /** + * Constructs a new ServiceOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceOptions); + + /** ServiceOptions deprecated. */ + public deprecated: boolean; + + /** ServiceOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceOptions instance + */ + public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + + /** + * Verifies a ServiceOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @param message ServiceOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodOptions. */ + interface IMethodOptions { + + /** MethodOptions deprecated */ + deprecated?: (boolean|null); + + /** MethodOptions idempotencyLevel */ + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + + /** MethodOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MethodOptions .google.api.http */ + ".google.api.http"?: (google.api.IHttpRule|null); + + /** MethodOptions .google.api.methodSignature */ + ".google.api.methodSignature"?: (string[]|null); + } + + /** Represents a MethodOptions. */ + class MethodOptions implements IMethodOptions { + + /** + * Constructs a new MethodOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodOptions); + + /** MethodOptions deprecated. */ + public deprecated: boolean; + + /** MethodOptions idempotencyLevel. */ + public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); + + /** MethodOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodOptions instance + */ + public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + + /** + * Verifies a MethodOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @param message MethodOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MethodOptions { + + /** IdempotencyLevel enum. */ + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2 + } + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + + /** UninterpretedOption identifierValue */ + identifierValue?: (string|null); + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long|string|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|string|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|string|null); + + /** UninterpretedOption aggregateValue */ + aggregateValue?: (string|null); + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption implements IUninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long|string); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long|string); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: (Uint8Array|string); + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UninterpretedOption + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UninterpretedOption { + + /** Properties of a NamePart. */ + interface INamePart { + + /** NamePart namePart */ + namePart: string; + + /** NamePart isExtension */ + isExtension: boolean; + } + + /** Represents a NamePart. */ + class NamePart implements INamePart { + + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + + /** NamePart namePart. */ + public namePart: string; + + /** NamePart isExtension. */ + public isExtension: boolean; + + /** + * Creates a new NamePart instance using the specified properties. + * @param [properties] Properties to set + * @returns NamePart instance + */ + public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + + /** + * Verifies a NamePart message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NamePart + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @param message NamePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NamePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NamePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo implements ISourceCodeInfo { + + /** + * Constructs a new SourceCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ISourceCodeInfo); + + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceCodeInfo instance + */ + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + + /** + * Verifies a SourceCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @param message SourceCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SourceCodeInfo { + + /** Properties of a Location. */ + interface ILocation { + + /** Location path */ + path?: (number[]|null); + + /** Location span */ + span?: (number[]|null); + + /** Location leadingComments */ + leadingComments?: (string|null); + + /** Location trailingComments */ + trailingComments?: (string|null); + + /** Location leadingDetachedComments */ + leadingDetachedComments?: (string[]|null); + } + + /** Represents a Location. */ + class Location implements ILocation { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + + /** Location path. */ + public path: number[]; + + /** Location span. */ + public span: number[]; + + /** Location leadingComments. */ + public leadingComments: string; + + /** Location trailingComments. */ + public trailingComments: string; + + /** Location leadingDetachedComments. */ + public leadingDetachedComments: string[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Location + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { + + /** GeneratedCodeInfo annotation */ + annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); + } + + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo implements IGeneratedCodeInfo { + + /** + * Constructs a new GeneratedCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IGeneratedCodeInfo); + + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratedCodeInfo instance + */ + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + + /** + * Verifies a GeneratedCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratedCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @param message GeneratedCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace GeneratedCodeInfo { + + /** Properties of an Annotation. */ + interface IAnnotation { + + /** Annotation path */ + path?: (number[]|null); + + /** Annotation sourceFile */ + sourceFile?: (string|null); + + /** Annotation begin */ + begin?: (number|null); + + /** Annotation end */ + end?: (number|null); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); + } + + /** Represents an Annotation. */ + class Annotation implements IAnnotation { + + /** + * Constructs a new Annotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + + /** Annotation path. */ + public path: number[]; + + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; + + /** Annotation semantic. */ + public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); + + /** + * Creates a new Annotation instance using the specified properties. + * @param [properties] Properties to set + * @returns Annotation instance + */ + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Verifies an Annotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Annotation + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @param message Annotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Annotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Annotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Annotation { + + /** Semantic enum. */ + enum Semantic { + NONE = 0, + SET = 1, + ALIAS = 2 + } + } + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of 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; + } + } +} diff --git a/packages/google-cloud-kms/protos/protos.js b/packages/google-cloud-kms/protos/protos.js new file mode 100644 index 00000000000..0bf83f9066c --- /dev/null +++ b/packages/google-cloud-kms/protos/protos.js @@ -0,0 +1,32080 @@ +// 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_kms_protos || ($protobuf.roots._google_cloud_kms_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.kms = (function() { + + /** + * Namespace kms. + * @memberof google.cloud + * @namespace + */ + var kms = {}; + + kms.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.kms + * @namespace + */ + var v1 = {}; + + v1.EkmService = (function() { + + /** + * Constructs a new EkmService service. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an EkmService + * @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 EkmService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (EkmService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = EkmService; + + /** + * Creates new EkmService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.kms.v1.EkmService + * @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 {EkmService} RPC service. Useful where requests and/or responses are streamed. + */ + EkmService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|listEkmConnections}. + * @memberof google.cloud.kms.v1.EkmService + * @typedef ListEkmConnectionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.ListEkmConnectionsResponse} [response] ListEkmConnectionsResponse + */ + + /** + * Calls ListEkmConnections. + * @function listEkmConnections + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.IListEkmConnectionsRequest} request ListEkmConnectionsRequest message or plain object + * @param {google.cloud.kms.v1.EkmService.ListEkmConnectionsCallback} callback Node-style callback called with the error, if any, and ListEkmConnectionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EkmService.prototype.listEkmConnections = function listEkmConnections(request, callback) { + return this.rpcCall(listEkmConnections, $root.google.cloud.kms.v1.ListEkmConnectionsRequest, $root.google.cloud.kms.v1.ListEkmConnectionsResponse, request, callback); + }, "name", { value: "ListEkmConnections" }); + + /** + * Calls ListEkmConnections. + * @function listEkmConnections + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.IListEkmConnectionsRequest} request ListEkmConnectionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|getEkmConnection}. + * @memberof google.cloud.kms.v1.EkmService + * @typedef GetEkmConnectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.EkmConnection} [response] EkmConnection + */ + + /** + * Calls GetEkmConnection. + * @function getEkmConnection + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.IGetEkmConnectionRequest} request GetEkmConnectionRequest message or plain object + * @param {google.cloud.kms.v1.EkmService.GetEkmConnectionCallback} callback Node-style callback called with the error, if any, and EkmConnection + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EkmService.prototype.getEkmConnection = function getEkmConnection(request, callback) { + return this.rpcCall(getEkmConnection, $root.google.cloud.kms.v1.GetEkmConnectionRequest, $root.google.cloud.kms.v1.EkmConnection, request, callback); + }, "name", { value: "GetEkmConnection" }); + + /** + * Calls GetEkmConnection. + * @function getEkmConnection + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.IGetEkmConnectionRequest} request GetEkmConnectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|createEkmConnection}. + * @memberof google.cloud.kms.v1.EkmService + * @typedef CreateEkmConnectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.EkmConnection} [response] EkmConnection + */ + + /** + * Calls CreateEkmConnection. + * @function createEkmConnection + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.ICreateEkmConnectionRequest} request CreateEkmConnectionRequest message or plain object + * @param {google.cloud.kms.v1.EkmService.CreateEkmConnectionCallback} callback Node-style callback called with the error, if any, and EkmConnection + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EkmService.prototype.createEkmConnection = function createEkmConnection(request, callback) { + return this.rpcCall(createEkmConnection, $root.google.cloud.kms.v1.CreateEkmConnectionRequest, $root.google.cloud.kms.v1.EkmConnection, request, callback); + }, "name", { value: "CreateEkmConnection" }); + + /** + * Calls CreateEkmConnection. + * @function createEkmConnection + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.ICreateEkmConnectionRequest} request CreateEkmConnectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.EkmService|updateEkmConnection}. + * @memberof google.cloud.kms.v1.EkmService + * @typedef UpdateEkmConnectionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.EkmConnection} [response] EkmConnection + */ + + /** + * Calls UpdateEkmConnection. + * @function updateEkmConnection + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.IUpdateEkmConnectionRequest} request UpdateEkmConnectionRequest message or plain object + * @param {google.cloud.kms.v1.EkmService.UpdateEkmConnectionCallback} callback Node-style callback called with the error, if any, and EkmConnection + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EkmService.prototype.updateEkmConnection = function updateEkmConnection(request, callback) { + return this.rpcCall(updateEkmConnection, $root.google.cloud.kms.v1.UpdateEkmConnectionRequest, $root.google.cloud.kms.v1.EkmConnection, request, callback); + }, "name", { value: "UpdateEkmConnection" }); + + /** + * Calls UpdateEkmConnection. + * @function updateEkmConnection + * @memberof google.cloud.kms.v1.EkmService + * @instance + * @param {google.cloud.kms.v1.IUpdateEkmConnectionRequest} request UpdateEkmConnectionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return EkmService; + })(); + + v1.ListEkmConnectionsRequest = (function() { + + /** + * Properties of a ListEkmConnectionsRequest. + * @memberof google.cloud.kms.v1 + * @interface IListEkmConnectionsRequest + * @property {string|null} [parent] ListEkmConnectionsRequest parent + * @property {number|null} [pageSize] ListEkmConnectionsRequest pageSize + * @property {string|null} [pageToken] ListEkmConnectionsRequest pageToken + * @property {string|null} [filter] ListEkmConnectionsRequest filter + * @property {string|null} [orderBy] ListEkmConnectionsRequest orderBy + */ + + /** + * Constructs a new ListEkmConnectionsRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListEkmConnectionsRequest. + * @implements IListEkmConnectionsRequest + * @constructor + * @param {google.cloud.kms.v1.IListEkmConnectionsRequest=} [properties] Properties to set + */ + function ListEkmConnectionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEkmConnectionsRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @instance + */ + ListEkmConnectionsRequest.prototype.parent = ""; + + /** + * ListEkmConnectionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @instance + */ + ListEkmConnectionsRequest.prototype.pageSize = 0; + + /** + * ListEkmConnectionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @instance + */ + ListEkmConnectionsRequest.prototype.pageToken = ""; + + /** + * ListEkmConnectionsRequest filter. + * @member {string} filter + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @instance + */ + ListEkmConnectionsRequest.prototype.filter = ""; + + /** + * ListEkmConnectionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @instance + */ + ListEkmConnectionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListEkmConnectionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {google.cloud.kms.v1.IListEkmConnectionsRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListEkmConnectionsRequest} ListEkmConnectionsRequest instance + */ + ListEkmConnectionsRequest.create = function create(properties) { + return new ListEkmConnectionsRequest(properties); + }; + + /** + * Encodes the specified ListEkmConnectionsRequest message. Does not implicitly {@link google.cloud.kms.v1.ListEkmConnectionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {google.cloud.kms.v1.IListEkmConnectionsRequest} message ListEkmConnectionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEkmConnectionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListEkmConnectionsRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListEkmConnectionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {google.cloud.kms.v1.IListEkmConnectionsRequest} message ListEkmConnectionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEkmConnectionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEkmConnectionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListEkmConnectionsRequest} ListEkmConnectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEkmConnectionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListEkmConnectionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEkmConnectionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListEkmConnectionsRequest} ListEkmConnectionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEkmConnectionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEkmConnectionsRequest message. + * @function verify + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEkmConnectionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListEkmConnectionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListEkmConnectionsRequest} ListEkmConnectionsRequest + */ + ListEkmConnectionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListEkmConnectionsRequest) + return object; + var message = new $root.google.cloud.kms.v1.ListEkmConnectionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListEkmConnectionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {google.cloud.kms.v1.ListEkmConnectionsRequest} message ListEkmConnectionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEkmConnectionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListEkmConnectionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListEkmConnectionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEkmConnectionsRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListEkmConnectionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEkmConnectionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListEkmConnectionsRequest"; + }; + + return ListEkmConnectionsRequest; + })(); + + v1.ListEkmConnectionsResponse = (function() { + + /** + * Properties of a ListEkmConnectionsResponse. + * @memberof google.cloud.kms.v1 + * @interface IListEkmConnectionsResponse + * @property {Array.|null} [ekmConnections] ListEkmConnectionsResponse ekmConnections + * @property {string|null} [nextPageToken] ListEkmConnectionsResponse nextPageToken + * @property {number|null} [totalSize] ListEkmConnectionsResponse totalSize + */ + + /** + * Constructs a new ListEkmConnectionsResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListEkmConnectionsResponse. + * @implements IListEkmConnectionsResponse + * @constructor + * @param {google.cloud.kms.v1.IListEkmConnectionsResponse=} [properties] Properties to set + */ + function ListEkmConnectionsResponse(properties) { + this.ekmConnections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEkmConnectionsResponse ekmConnections. + * @member {Array.} ekmConnections + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @instance + */ + ListEkmConnectionsResponse.prototype.ekmConnections = $util.emptyArray; + + /** + * ListEkmConnectionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @instance + */ + ListEkmConnectionsResponse.prototype.nextPageToken = ""; + + /** + * ListEkmConnectionsResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @instance + */ + ListEkmConnectionsResponse.prototype.totalSize = 0; + + /** + * Creates a new ListEkmConnectionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {google.cloud.kms.v1.IListEkmConnectionsResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListEkmConnectionsResponse} ListEkmConnectionsResponse instance + */ + ListEkmConnectionsResponse.create = function create(properties) { + return new ListEkmConnectionsResponse(properties); + }; + + /** + * Encodes the specified ListEkmConnectionsResponse message. Does not implicitly {@link google.cloud.kms.v1.ListEkmConnectionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {google.cloud.kms.v1.IListEkmConnectionsResponse} message ListEkmConnectionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEkmConnectionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ekmConnections != null && message.ekmConnections.length) + for (var i = 0; i < message.ekmConnections.length; ++i) + $root.google.cloud.kms.v1.EkmConnection.encode(message.ekmConnections[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 ListEkmConnectionsResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListEkmConnectionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {google.cloud.kms.v1.IListEkmConnectionsResponse} message ListEkmConnectionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEkmConnectionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEkmConnectionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListEkmConnectionsResponse} ListEkmConnectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEkmConnectionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListEkmConnectionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.ekmConnections && message.ekmConnections.length)) + message.ekmConnections = []; + message.ekmConnections.push($root.google.cloud.kms.v1.EkmConnection.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 ListEkmConnectionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListEkmConnectionsResponse} ListEkmConnectionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEkmConnectionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEkmConnectionsResponse message. + * @function verify + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEkmConnectionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ekmConnections != null && message.hasOwnProperty("ekmConnections")) { + if (!Array.isArray(message.ekmConnections)) + return "ekmConnections: array expected"; + for (var i = 0; i < message.ekmConnections.length; ++i) { + var error = $root.google.cloud.kms.v1.EkmConnection.verify(message.ekmConnections[i]); + if (error) + return "ekmConnections." + 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 ListEkmConnectionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListEkmConnectionsResponse} ListEkmConnectionsResponse + */ + ListEkmConnectionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListEkmConnectionsResponse) + return object; + var message = new $root.google.cloud.kms.v1.ListEkmConnectionsResponse(); + if (object.ekmConnections) { + if (!Array.isArray(object.ekmConnections)) + throw TypeError(".google.cloud.kms.v1.ListEkmConnectionsResponse.ekmConnections: array expected"); + message.ekmConnections = []; + for (var i = 0; i < object.ekmConnections.length; ++i) { + if (typeof object.ekmConnections[i] !== "object") + throw TypeError(".google.cloud.kms.v1.ListEkmConnectionsResponse.ekmConnections: object expected"); + message.ekmConnections[i] = $root.google.cloud.kms.v1.EkmConnection.fromObject(object.ekmConnections[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 ListEkmConnectionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {google.cloud.kms.v1.ListEkmConnectionsResponse} message ListEkmConnectionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEkmConnectionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.ekmConnections = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.ekmConnections && message.ekmConnections.length) { + object.ekmConnections = []; + for (var j = 0; j < message.ekmConnections.length; ++j) + object.ekmConnections[j] = $root.google.cloud.kms.v1.EkmConnection.toObject(message.ekmConnections[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 ListEkmConnectionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListEkmConnectionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEkmConnectionsResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListEkmConnectionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEkmConnectionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListEkmConnectionsResponse"; + }; + + return ListEkmConnectionsResponse; + })(); + + v1.GetEkmConnectionRequest = (function() { + + /** + * Properties of a GetEkmConnectionRequest. + * @memberof google.cloud.kms.v1 + * @interface IGetEkmConnectionRequest + * @property {string|null} [name] GetEkmConnectionRequest name + */ + + /** + * Constructs a new GetEkmConnectionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a GetEkmConnectionRequest. + * @implements IGetEkmConnectionRequest + * @constructor + * @param {google.cloud.kms.v1.IGetEkmConnectionRequest=} [properties] Properties to set + */ + function GetEkmConnectionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEkmConnectionRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @instance + */ + GetEkmConnectionRequest.prototype.name = ""; + + /** + * Creates a new GetEkmConnectionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.IGetEkmConnectionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.GetEkmConnectionRequest} GetEkmConnectionRequest instance + */ + GetEkmConnectionRequest.create = function create(properties) { + return new GetEkmConnectionRequest(properties); + }; + + /** + * Encodes the specified GetEkmConnectionRequest message. Does not implicitly {@link google.cloud.kms.v1.GetEkmConnectionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.IGetEkmConnectionRequest} message GetEkmConnectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEkmConnectionRequest.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 GetEkmConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetEkmConnectionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.IGetEkmConnectionRequest} message GetEkmConnectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEkmConnectionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEkmConnectionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.GetEkmConnectionRequest} GetEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEkmConnectionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.GetEkmConnectionRequest(); + 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 GetEkmConnectionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.GetEkmConnectionRequest} GetEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEkmConnectionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEkmConnectionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEkmConnectionRequest.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 GetEkmConnectionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.GetEkmConnectionRequest} GetEkmConnectionRequest + */ + GetEkmConnectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.GetEkmConnectionRequest) + return object; + var message = new $root.google.cloud.kms.v1.GetEkmConnectionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetEkmConnectionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.GetEkmConnectionRequest} message GetEkmConnectionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEkmConnectionRequest.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 GetEkmConnectionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @instance + * @returns {Object.} JSON object + */ + GetEkmConnectionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetEkmConnectionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.GetEkmConnectionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetEkmConnectionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.GetEkmConnectionRequest"; + }; + + return GetEkmConnectionRequest; + })(); + + v1.CreateEkmConnectionRequest = (function() { + + /** + * Properties of a CreateEkmConnectionRequest. + * @memberof google.cloud.kms.v1 + * @interface ICreateEkmConnectionRequest + * @property {string|null} [parent] CreateEkmConnectionRequest parent + * @property {string|null} [ekmConnectionId] CreateEkmConnectionRequest ekmConnectionId + * @property {google.cloud.kms.v1.IEkmConnection|null} [ekmConnection] CreateEkmConnectionRequest ekmConnection + */ + + /** + * Constructs a new CreateEkmConnectionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a CreateEkmConnectionRequest. + * @implements ICreateEkmConnectionRequest + * @constructor + * @param {google.cloud.kms.v1.ICreateEkmConnectionRequest=} [properties] Properties to set + */ + function CreateEkmConnectionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateEkmConnectionRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @instance + */ + CreateEkmConnectionRequest.prototype.parent = ""; + + /** + * CreateEkmConnectionRequest ekmConnectionId. + * @member {string} ekmConnectionId + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @instance + */ + CreateEkmConnectionRequest.prototype.ekmConnectionId = ""; + + /** + * CreateEkmConnectionRequest ekmConnection. + * @member {google.cloud.kms.v1.IEkmConnection|null|undefined} ekmConnection + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @instance + */ + CreateEkmConnectionRequest.prototype.ekmConnection = null; + + /** + * Creates a new CreateEkmConnectionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.ICreateEkmConnectionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.CreateEkmConnectionRequest} CreateEkmConnectionRequest instance + */ + CreateEkmConnectionRequest.create = function create(properties) { + return new CreateEkmConnectionRequest(properties); + }; + + /** + * Encodes the specified CreateEkmConnectionRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateEkmConnectionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.ICreateEkmConnectionRequest} message CreateEkmConnectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEkmConnectionRequest.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.ekmConnectionId != null && Object.hasOwnProperty.call(message, "ekmConnectionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ekmConnectionId); + if (message.ekmConnection != null && Object.hasOwnProperty.call(message, "ekmConnection")) + $root.google.cloud.kms.v1.EkmConnection.encode(message.ekmConnection, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateEkmConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateEkmConnectionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.ICreateEkmConnectionRequest} message CreateEkmConnectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEkmConnectionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateEkmConnectionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.CreateEkmConnectionRequest} CreateEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEkmConnectionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.CreateEkmConnectionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.ekmConnectionId = reader.string(); + break; + } + case 3: { + message.ekmConnection = $root.google.cloud.kms.v1.EkmConnection.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateEkmConnectionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.CreateEkmConnectionRequest} CreateEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEkmConnectionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateEkmConnectionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateEkmConnectionRequest.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.ekmConnectionId != null && message.hasOwnProperty("ekmConnectionId")) + if (!$util.isString(message.ekmConnectionId)) + return "ekmConnectionId: string expected"; + if (message.ekmConnection != null && message.hasOwnProperty("ekmConnection")) { + var error = $root.google.cloud.kms.v1.EkmConnection.verify(message.ekmConnection); + if (error) + return "ekmConnection." + error; + } + return null; + }; + + /** + * Creates a CreateEkmConnectionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.CreateEkmConnectionRequest} CreateEkmConnectionRequest + */ + CreateEkmConnectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.CreateEkmConnectionRequest) + return object; + var message = new $root.google.cloud.kms.v1.CreateEkmConnectionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.ekmConnectionId != null) + message.ekmConnectionId = String(object.ekmConnectionId); + if (object.ekmConnection != null) { + if (typeof object.ekmConnection !== "object") + throw TypeError(".google.cloud.kms.v1.CreateEkmConnectionRequest.ekmConnection: object expected"); + message.ekmConnection = $root.google.cloud.kms.v1.EkmConnection.fromObject(object.ekmConnection); + } + return message; + }; + + /** + * Creates a plain object from a CreateEkmConnectionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.CreateEkmConnectionRequest} message CreateEkmConnectionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateEkmConnectionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.ekmConnectionId = ""; + object.ekmConnection = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.ekmConnectionId != null && message.hasOwnProperty("ekmConnectionId")) + object.ekmConnectionId = message.ekmConnectionId; + if (message.ekmConnection != null && message.hasOwnProperty("ekmConnection")) + object.ekmConnection = $root.google.cloud.kms.v1.EkmConnection.toObject(message.ekmConnection, options); + return object; + }; + + /** + * Converts this CreateEkmConnectionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateEkmConnectionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateEkmConnectionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.CreateEkmConnectionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateEkmConnectionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.CreateEkmConnectionRequest"; + }; + + return CreateEkmConnectionRequest; + })(); + + v1.UpdateEkmConnectionRequest = (function() { + + /** + * Properties of an UpdateEkmConnectionRequest. + * @memberof google.cloud.kms.v1 + * @interface IUpdateEkmConnectionRequest + * @property {google.cloud.kms.v1.IEkmConnection|null} [ekmConnection] UpdateEkmConnectionRequest ekmConnection + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateEkmConnectionRequest updateMask + */ + + /** + * Constructs a new UpdateEkmConnectionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an UpdateEkmConnectionRequest. + * @implements IUpdateEkmConnectionRequest + * @constructor + * @param {google.cloud.kms.v1.IUpdateEkmConnectionRequest=} [properties] Properties to set + */ + function UpdateEkmConnectionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateEkmConnectionRequest ekmConnection. + * @member {google.cloud.kms.v1.IEkmConnection|null|undefined} ekmConnection + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @instance + */ + UpdateEkmConnectionRequest.prototype.ekmConnection = null; + + /** + * UpdateEkmConnectionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @instance + */ + UpdateEkmConnectionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateEkmConnectionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateEkmConnectionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.UpdateEkmConnectionRequest} UpdateEkmConnectionRequest instance + */ + UpdateEkmConnectionRequest.create = function create(properties) { + return new UpdateEkmConnectionRequest(properties); + }; + + /** + * Encodes the specified UpdateEkmConnectionRequest message. Does not implicitly {@link google.cloud.kms.v1.UpdateEkmConnectionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateEkmConnectionRequest} message UpdateEkmConnectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEkmConnectionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ekmConnection != null && Object.hasOwnProperty.call(message, "ekmConnection")) + $root.google.cloud.kms.v1.EkmConnection.encode(message.ekmConnection, 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 UpdateEkmConnectionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.UpdateEkmConnectionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateEkmConnectionRequest} message UpdateEkmConnectionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEkmConnectionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateEkmConnectionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.UpdateEkmConnectionRequest} UpdateEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEkmConnectionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.UpdateEkmConnectionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.ekmConnection = $root.google.cloud.kms.v1.EkmConnection.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 UpdateEkmConnectionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.UpdateEkmConnectionRequest} UpdateEkmConnectionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEkmConnectionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateEkmConnectionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateEkmConnectionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ekmConnection != null && message.hasOwnProperty("ekmConnection")) { + var error = $root.google.cloud.kms.v1.EkmConnection.verify(message.ekmConnection); + if (error) + return "ekmConnection." + 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 UpdateEkmConnectionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.UpdateEkmConnectionRequest} UpdateEkmConnectionRequest + */ + UpdateEkmConnectionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.UpdateEkmConnectionRequest) + return object; + var message = new $root.google.cloud.kms.v1.UpdateEkmConnectionRequest(); + if (object.ekmConnection != null) { + if (typeof object.ekmConnection !== "object") + throw TypeError(".google.cloud.kms.v1.UpdateEkmConnectionRequest.ekmConnection: object expected"); + message.ekmConnection = $root.google.cloud.kms.v1.EkmConnection.fromObject(object.ekmConnection); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.kms.v1.UpdateEkmConnectionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateEkmConnectionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {google.cloud.kms.v1.UpdateEkmConnectionRequest} message UpdateEkmConnectionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateEkmConnectionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ekmConnection = null; + object.updateMask = null; + } + if (message.ekmConnection != null && message.hasOwnProperty("ekmConnection")) + object.ekmConnection = $root.google.cloud.kms.v1.EkmConnection.toObject(message.ekmConnection, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateEkmConnectionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateEkmConnectionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateEkmConnectionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.UpdateEkmConnectionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateEkmConnectionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.UpdateEkmConnectionRequest"; + }; + + return UpdateEkmConnectionRequest; + })(); + + v1.Certificate = (function() { + + /** + * Properties of a Certificate. + * @memberof google.cloud.kms.v1 + * @interface ICertificate + * @property {Uint8Array|null} [rawDer] Certificate rawDer + * @property {boolean|null} [parsed] Certificate parsed + * @property {string|null} [issuer] Certificate issuer + * @property {string|null} [subject] Certificate subject + * @property {Array.|null} [subjectAlternativeDnsNames] Certificate subjectAlternativeDnsNames + * @property {google.protobuf.ITimestamp|null} [notBeforeTime] Certificate notBeforeTime + * @property {google.protobuf.ITimestamp|null} [notAfterTime] Certificate notAfterTime + * @property {string|null} [serialNumber] Certificate serialNumber + * @property {string|null} [sha256Fingerprint] Certificate sha256Fingerprint + */ + + /** + * Constructs a new Certificate. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a Certificate. + * @implements ICertificate + * @constructor + * @param {google.cloud.kms.v1.ICertificate=} [properties] Properties to set + */ + function Certificate(properties) { + this.subjectAlternativeDnsNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Certificate rawDer. + * @member {Uint8Array} rawDer + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.rawDer = $util.newBuffer([]); + + /** + * Certificate parsed. + * @member {boolean} parsed + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.parsed = false; + + /** + * Certificate issuer. + * @member {string} issuer + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.issuer = ""; + + /** + * Certificate subject. + * @member {string} subject + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.subject = ""; + + /** + * Certificate subjectAlternativeDnsNames. + * @member {Array.} subjectAlternativeDnsNames + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.subjectAlternativeDnsNames = $util.emptyArray; + + /** + * Certificate notBeforeTime. + * @member {google.protobuf.ITimestamp|null|undefined} notBeforeTime + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.notBeforeTime = null; + + /** + * Certificate notAfterTime. + * @member {google.protobuf.ITimestamp|null|undefined} notAfterTime + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.notAfterTime = null; + + /** + * Certificate serialNumber. + * @member {string} serialNumber + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.serialNumber = ""; + + /** + * Certificate sha256Fingerprint. + * @member {string} sha256Fingerprint + * @memberof google.cloud.kms.v1.Certificate + * @instance + */ + Certificate.prototype.sha256Fingerprint = ""; + + /** + * Creates a new Certificate instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {google.cloud.kms.v1.ICertificate=} [properties] Properties to set + * @returns {google.cloud.kms.v1.Certificate} Certificate instance + */ + Certificate.create = function create(properties) { + return new Certificate(properties); + }; + + /** + * Encodes the specified Certificate message. Does not implicitly {@link google.cloud.kms.v1.Certificate.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {google.cloud.kms.v1.ICertificate} message Certificate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Certificate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rawDer != null && Object.hasOwnProperty.call(message, "rawDer")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.rawDer); + if (message.parsed != null && Object.hasOwnProperty.call(message, "parsed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.parsed); + if (message.issuer != null && Object.hasOwnProperty.call(message, "issuer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.issuer); + if (message.subject != null && Object.hasOwnProperty.call(message, "subject")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.subject); + if (message.subjectAlternativeDnsNames != null && message.subjectAlternativeDnsNames.length) + for (var i = 0; i < message.subjectAlternativeDnsNames.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.subjectAlternativeDnsNames[i]); + if (message.notBeforeTime != null && Object.hasOwnProperty.call(message, "notBeforeTime")) + $root.google.protobuf.Timestamp.encode(message.notBeforeTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.notAfterTime != null && Object.hasOwnProperty.call(message, "notAfterTime")) + $root.google.protobuf.Timestamp.encode(message.notAfterTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.serialNumber != null && Object.hasOwnProperty.call(message, "serialNumber")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.serialNumber); + if (message.sha256Fingerprint != null && Object.hasOwnProperty.call(message, "sha256Fingerprint")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.sha256Fingerprint); + return writer; + }; + + /** + * Encodes the specified Certificate message, length delimited. Does not implicitly {@link google.cloud.kms.v1.Certificate.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {google.cloud.kms.v1.ICertificate} message Certificate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Certificate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Certificate message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.Certificate} Certificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Certificate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.Certificate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.rawDer = reader.bytes(); + break; + } + case 2: { + message.parsed = reader.bool(); + break; + } + case 3: { + message.issuer = reader.string(); + break; + } + case 4: { + message.subject = reader.string(); + break; + } + case 5: { + if (!(message.subjectAlternativeDnsNames && message.subjectAlternativeDnsNames.length)) + message.subjectAlternativeDnsNames = []; + message.subjectAlternativeDnsNames.push(reader.string()); + break; + } + case 6: { + message.notBeforeTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.notAfterTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.serialNumber = reader.string(); + break; + } + case 9: { + message.sha256Fingerprint = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Certificate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.Certificate} Certificate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Certificate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Certificate message. + * @function verify + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Certificate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rawDer != null && message.hasOwnProperty("rawDer")) + if (!(message.rawDer && typeof message.rawDer.length === "number" || $util.isString(message.rawDer))) + return "rawDer: buffer expected"; + if (message.parsed != null && message.hasOwnProperty("parsed")) + if (typeof message.parsed !== "boolean") + return "parsed: boolean expected"; + if (message.issuer != null && message.hasOwnProperty("issuer")) + if (!$util.isString(message.issuer)) + return "issuer: string expected"; + if (message.subject != null && message.hasOwnProperty("subject")) + if (!$util.isString(message.subject)) + return "subject: string expected"; + if (message.subjectAlternativeDnsNames != null && message.hasOwnProperty("subjectAlternativeDnsNames")) { + if (!Array.isArray(message.subjectAlternativeDnsNames)) + return "subjectAlternativeDnsNames: array expected"; + for (var i = 0; i < message.subjectAlternativeDnsNames.length; ++i) + if (!$util.isString(message.subjectAlternativeDnsNames[i])) + return "subjectAlternativeDnsNames: string[] expected"; + } + if (message.notBeforeTime != null && message.hasOwnProperty("notBeforeTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.notBeforeTime); + if (error) + return "notBeforeTime." + error; + } + if (message.notAfterTime != null && message.hasOwnProperty("notAfterTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.notAfterTime); + if (error) + return "notAfterTime." + error; + } + if (message.serialNumber != null && message.hasOwnProperty("serialNumber")) + if (!$util.isString(message.serialNumber)) + return "serialNumber: string expected"; + if (message.sha256Fingerprint != null && message.hasOwnProperty("sha256Fingerprint")) + if (!$util.isString(message.sha256Fingerprint)) + return "sha256Fingerprint: string expected"; + return null; + }; + + /** + * Creates a Certificate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.Certificate} Certificate + */ + Certificate.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.Certificate) + return object; + var message = new $root.google.cloud.kms.v1.Certificate(); + if (object.rawDer != null) + if (typeof object.rawDer === "string") + $util.base64.decode(object.rawDer, message.rawDer = $util.newBuffer($util.base64.length(object.rawDer)), 0); + else if (object.rawDer.length >= 0) + message.rawDer = object.rawDer; + if (object.parsed != null) + message.parsed = Boolean(object.parsed); + if (object.issuer != null) + message.issuer = String(object.issuer); + if (object.subject != null) + message.subject = String(object.subject); + if (object.subjectAlternativeDnsNames) { + if (!Array.isArray(object.subjectAlternativeDnsNames)) + throw TypeError(".google.cloud.kms.v1.Certificate.subjectAlternativeDnsNames: array expected"); + message.subjectAlternativeDnsNames = []; + for (var i = 0; i < object.subjectAlternativeDnsNames.length; ++i) + message.subjectAlternativeDnsNames[i] = String(object.subjectAlternativeDnsNames[i]); + } + if (object.notBeforeTime != null) { + if (typeof object.notBeforeTime !== "object") + throw TypeError(".google.cloud.kms.v1.Certificate.notBeforeTime: object expected"); + message.notBeforeTime = $root.google.protobuf.Timestamp.fromObject(object.notBeforeTime); + } + if (object.notAfterTime != null) { + if (typeof object.notAfterTime !== "object") + throw TypeError(".google.cloud.kms.v1.Certificate.notAfterTime: object expected"); + message.notAfterTime = $root.google.protobuf.Timestamp.fromObject(object.notAfterTime); + } + if (object.serialNumber != null) + message.serialNumber = String(object.serialNumber); + if (object.sha256Fingerprint != null) + message.sha256Fingerprint = String(object.sha256Fingerprint); + return message; + }; + + /** + * Creates a plain object from a Certificate message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {google.cloud.kms.v1.Certificate} message Certificate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Certificate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.subjectAlternativeDnsNames = []; + if (options.defaults) { + if (options.bytes === String) + object.rawDer = ""; + else { + object.rawDer = []; + if (options.bytes !== Array) + object.rawDer = $util.newBuffer(object.rawDer); + } + object.parsed = false; + object.issuer = ""; + object.subject = ""; + object.notBeforeTime = null; + object.notAfterTime = null; + object.serialNumber = ""; + object.sha256Fingerprint = ""; + } + if (message.rawDer != null && message.hasOwnProperty("rawDer")) + object.rawDer = options.bytes === String ? $util.base64.encode(message.rawDer, 0, message.rawDer.length) : options.bytes === Array ? Array.prototype.slice.call(message.rawDer) : message.rawDer; + if (message.parsed != null && message.hasOwnProperty("parsed")) + object.parsed = message.parsed; + if (message.issuer != null && message.hasOwnProperty("issuer")) + object.issuer = message.issuer; + if (message.subject != null && message.hasOwnProperty("subject")) + object.subject = message.subject; + if (message.subjectAlternativeDnsNames && message.subjectAlternativeDnsNames.length) { + object.subjectAlternativeDnsNames = []; + for (var j = 0; j < message.subjectAlternativeDnsNames.length; ++j) + object.subjectAlternativeDnsNames[j] = message.subjectAlternativeDnsNames[j]; + } + if (message.notBeforeTime != null && message.hasOwnProperty("notBeforeTime")) + object.notBeforeTime = $root.google.protobuf.Timestamp.toObject(message.notBeforeTime, options); + if (message.notAfterTime != null && message.hasOwnProperty("notAfterTime")) + object.notAfterTime = $root.google.protobuf.Timestamp.toObject(message.notAfterTime, options); + if (message.serialNumber != null && message.hasOwnProperty("serialNumber")) + object.serialNumber = message.serialNumber; + if (message.sha256Fingerprint != null && message.hasOwnProperty("sha256Fingerprint")) + object.sha256Fingerprint = message.sha256Fingerprint; + return object; + }; + + /** + * Converts this Certificate to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.Certificate + * @instance + * @returns {Object.} JSON object + */ + Certificate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Certificate + * @function getTypeUrl + * @memberof google.cloud.kms.v1.Certificate + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Certificate.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.Certificate"; + }; + + return Certificate; + })(); + + v1.EkmConnection = (function() { + + /** + * Properties of an EkmConnection. + * @memberof google.cloud.kms.v1 + * @interface IEkmConnection + * @property {string|null} [name] EkmConnection name + * @property {google.protobuf.ITimestamp|null} [createTime] EkmConnection createTime + * @property {Array.|null} [serviceResolvers] EkmConnection serviceResolvers + * @property {string|null} [etag] EkmConnection etag + */ + + /** + * Constructs a new EkmConnection. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an EkmConnection. + * @implements IEkmConnection + * @constructor + * @param {google.cloud.kms.v1.IEkmConnection=} [properties] Properties to set + */ + function EkmConnection(properties) { + this.serviceResolvers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EkmConnection name. + * @member {string} name + * @memberof google.cloud.kms.v1.EkmConnection + * @instance + */ + EkmConnection.prototype.name = ""; + + /** + * EkmConnection createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.kms.v1.EkmConnection + * @instance + */ + EkmConnection.prototype.createTime = null; + + /** + * EkmConnection serviceResolvers. + * @member {Array.} serviceResolvers + * @memberof google.cloud.kms.v1.EkmConnection + * @instance + */ + EkmConnection.prototype.serviceResolvers = $util.emptyArray; + + /** + * EkmConnection etag. + * @member {string} etag + * @memberof google.cloud.kms.v1.EkmConnection + * @instance + */ + EkmConnection.prototype.etag = ""; + + /** + * Creates a new EkmConnection instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {google.cloud.kms.v1.IEkmConnection=} [properties] Properties to set + * @returns {google.cloud.kms.v1.EkmConnection} EkmConnection instance + */ + EkmConnection.create = function create(properties) { + return new EkmConnection(properties); + }; + + /** + * Encodes the specified EkmConnection message. Does not implicitly {@link google.cloud.kms.v1.EkmConnection.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {google.cloud.kms.v1.IEkmConnection} message EkmConnection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EkmConnection.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.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.serviceResolvers != null && message.serviceResolvers.length) + for (var i = 0; i < message.serviceResolvers.length; ++i) + $root.google.cloud.kms.v1.EkmConnection.ServiceResolver.encode(message.serviceResolvers[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.etag); + return writer; + }; + + /** + * Encodes the specified EkmConnection message, length delimited. Does not implicitly {@link google.cloud.kms.v1.EkmConnection.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {google.cloud.kms.v1.IEkmConnection} message EkmConnection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EkmConnection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EkmConnection message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.EkmConnection} EkmConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EkmConnection.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.EkmConnection(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.serviceResolvers && message.serviceResolvers.length)) + message.serviceResolvers = []; + message.serviceResolvers.push($root.google.cloud.kms.v1.EkmConnection.ServiceResolver.decode(reader, reader.uint32())); + break; + } + case 5: { + message.etag = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EkmConnection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.EkmConnection} EkmConnection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EkmConnection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EkmConnection message. + * @function verify + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EkmConnection.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.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.serviceResolvers != null && message.hasOwnProperty("serviceResolvers")) { + if (!Array.isArray(message.serviceResolvers)) + return "serviceResolvers: array expected"; + for (var i = 0; i < message.serviceResolvers.length; ++i) { + var error = $root.google.cloud.kms.v1.EkmConnection.ServiceResolver.verify(message.serviceResolvers[i]); + if (error) + return "serviceResolvers." + error; + } + } + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + return null; + }; + + /** + * Creates an EkmConnection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.EkmConnection} EkmConnection + */ + EkmConnection.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.EkmConnection) + return object; + var message = new $root.google.cloud.kms.v1.EkmConnection(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.kms.v1.EkmConnection.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.serviceResolvers) { + if (!Array.isArray(object.serviceResolvers)) + throw TypeError(".google.cloud.kms.v1.EkmConnection.serviceResolvers: array expected"); + message.serviceResolvers = []; + for (var i = 0; i < object.serviceResolvers.length; ++i) { + if (typeof object.serviceResolvers[i] !== "object") + throw TypeError(".google.cloud.kms.v1.EkmConnection.serviceResolvers: object expected"); + message.serviceResolvers[i] = $root.google.cloud.kms.v1.EkmConnection.ServiceResolver.fromObject(object.serviceResolvers[i]); + } + } + if (object.etag != null) + message.etag = String(object.etag); + return message; + }; + + /** + * Creates a plain object from an EkmConnection message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {google.cloud.kms.v1.EkmConnection} message EkmConnection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EkmConnection.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.serviceResolvers = []; + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.etag = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.serviceResolvers && message.serviceResolvers.length) { + object.serviceResolvers = []; + for (var j = 0; j < message.serviceResolvers.length; ++j) + object.serviceResolvers[j] = $root.google.cloud.kms.v1.EkmConnection.ServiceResolver.toObject(message.serviceResolvers[j], options); + } + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + return object; + }; + + /** + * Converts this EkmConnection to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.EkmConnection + * @instance + * @returns {Object.} JSON object + */ + EkmConnection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EkmConnection + * @function getTypeUrl + * @memberof google.cloud.kms.v1.EkmConnection + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EkmConnection.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.EkmConnection"; + }; + + EkmConnection.ServiceResolver = (function() { + + /** + * Properties of a ServiceResolver. + * @memberof google.cloud.kms.v1.EkmConnection + * @interface IServiceResolver + * @property {string|null} [serviceDirectoryService] ServiceResolver serviceDirectoryService + * @property {string|null} [endpointFilter] ServiceResolver endpointFilter + * @property {string|null} [hostname] ServiceResolver hostname + * @property {Array.|null} [serverCertificates] ServiceResolver serverCertificates + */ + + /** + * Constructs a new ServiceResolver. + * @memberof google.cloud.kms.v1.EkmConnection + * @classdesc Represents a ServiceResolver. + * @implements IServiceResolver + * @constructor + * @param {google.cloud.kms.v1.EkmConnection.IServiceResolver=} [properties] Properties to set + */ + function ServiceResolver(properties) { + this.serverCertificates = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceResolver serviceDirectoryService. + * @member {string} serviceDirectoryService + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @instance + */ + ServiceResolver.prototype.serviceDirectoryService = ""; + + /** + * ServiceResolver endpointFilter. + * @member {string} endpointFilter + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @instance + */ + ServiceResolver.prototype.endpointFilter = ""; + + /** + * ServiceResolver hostname. + * @member {string} hostname + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @instance + */ + ServiceResolver.prototype.hostname = ""; + + /** + * ServiceResolver serverCertificates. + * @member {Array.} serverCertificates + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @instance + */ + ServiceResolver.prototype.serverCertificates = $util.emptyArray; + + /** + * Creates a new ServiceResolver instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {google.cloud.kms.v1.EkmConnection.IServiceResolver=} [properties] Properties to set + * @returns {google.cloud.kms.v1.EkmConnection.ServiceResolver} ServiceResolver instance + */ + ServiceResolver.create = function create(properties) { + return new ServiceResolver(properties); + }; + + /** + * Encodes the specified ServiceResolver message. Does not implicitly {@link google.cloud.kms.v1.EkmConnection.ServiceResolver.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {google.cloud.kms.v1.EkmConnection.IServiceResolver} message ServiceResolver message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceResolver.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.serviceDirectoryService != null && Object.hasOwnProperty.call(message, "serviceDirectoryService")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.serviceDirectoryService); + if (message.endpointFilter != null && Object.hasOwnProperty.call(message, "endpointFilter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.endpointFilter); + if (message.hostname != null && Object.hasOwnProperty.call(message, "hostname")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.hostname); + if (message.serverCertificates != null && message.serverCertificates.length) + for (var i = 0; i < message.serverCertificates.length; ++i) + $root.google.cloud.kms.v1.Certificate.encode(message.serverCertificates[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceResolver message, length delimited. Does not implicitly {@link google.cloud.kms.v1.EkmConnection.ServiceResolver.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {google.cloud.kms.v1.EkmConnection.IServiceResolver} message ServiceResolver message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceResolver.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceResolver message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.EkmConnection.ServiceResolver} ServiceResolver + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceResolver.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.EkmConnection.ServiceResolver(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.serviceDirectoryService = reader.string(); + break; + } + case 2: { + message.endpointFilter = reader.string(); + break; + } + case 3: { + message.hostname = reader.string(); + break; + } + case 4: { + if (!(message.serverCertificates && message.serverCertificates.length)) + message.serverCertificates = []; + message.serverCertificates.push($root.google.cloud.kms.v1.Certificate.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceResolver message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.EkmConnection.ServiceResolver} ServiceResolver + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceResolver.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceResolver message. + * @function verify + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceResolver.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.serviceDirectoryService != null && message.hasOwnProperty("serviceDirectoryService")) + if (!$util.isString(message.serviceDirectoryService)) + return "serviceDirectoryService: string expected"; + if (message.endpointFilter != null && message.hasOwnProperty("endpointFilter")) + if (!$util.isString(message.endpointFilter)) + return "endpointFilter: string expected"; + if (message.hostname != null && message.hasOwnProperty("hostname")) + if (!$util.isString(message.hostname)) + return "hostname: string expected"; + if (message.serverCertificates != null && message.hasOwnProperty("serverCertificates")) { + if (!Array.isArray(message.serverCertificates)) + return "serverCertificates: array expected"; + for (var i = 0; i < message.serverCertificates.length; ++i) { + var error = $root.google.cloud.kms.v1.Certificate.verify(message.serverCertificates[i]); + if (error) + return "serverCertificates." + error; + } + } + return null; + }; + + /** + * Creates a ServiceResolver message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.EkmConnection.ServiceResolver} ServiceResolver + */ + ServiceResolver.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.EkmConnection.ServiceResolver) + return object; + var message = new $root.google.cloud.kms.v1.EkmConnection.ServiceResolver(); + if (object.serviceDirectoryService != null) + message.serviceDirectoryService = String(object.serviceDirectoryService); + if (object.endpointFilter != null) + message.endpointFilter = String(object.endpointFilter); + if (object.hostname != null) + message.hostname = String(object.hostname); + if (object.serverCertificates) { + if (!Array.isArray(object.serverCertificates)) + throw TypeError(".google.cloud.kms.v1.EkmConnection.ServiceResolver.serverCertificates: array expected"); + message.serverCertificates = []; + for (var i = 0; i < object.serverCertificates.length; ++i) { + if (typeof object.serverCertificates[i] !== "object") + throw TypeError(".google.cloud.kms.v1.EkmConnection.ServiceResolver.serverCertificates: object expected"); + message.serverCertificates[i] = $root.google.cloud.kms.v1.Certificate.fromObject(object.serverCertificates[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ServiceResolver message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {google.cloud.kms.v1.EkmConnection.ServiceResolver} message ServiceResolver + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceResolver.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.serverCertificates = []; + if (options.defaults) { + object.serviceDirectoryService = ""; + object.endpointFilter = ""; + object.hostname = ""; + } + if (message.serviceDirectoryService != null && message.hasOwnProperty("serviceDirectoryService")) + object.serviceDirectoryService = message.serviceDirectoryService; + if (message.endpointFilter != null && message.hasOwnProperty("endpointFilter")) + object.endpointFilter = message.endpointFilter; + if (message.hostname != null && message.hasOwnProperty("hostname")) + object.hostname = message.hostname; + if (message.serverCertificates && message.serverCertificates.length) { + object.serverCertificates = []; + for (var j = 0; j < message.serverCertificates.length; ++j) + object.serverCertificates[j] = $root.google.cloud.kms.v1.Certificate.toObject(message.serverCertificates[j], options); + } + return object; + }; + + /** + * Converts this ServiceResolver to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @instance + * @returns {Object.} JSON object + */ + ServiceResolver.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceResolver + * @function getTypeUrl + * @memberof google.cloud.kms.v1.EkmConnection.ServiceResolver + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceResolver.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.EkmConnection.ServiceResolver"; + }; + + return ServiceResolver; + })(); + + return EkmConnection; + })(); + + v1.KeyRing = (function() { + + /** + * Properties of a KeyRing. + * @memberof google.cloud.kms.v1 + * @interface IKeyRing + * @property {string|null} [name] KeyRing name + * @property {google.protobuf.ITimestamp|null} [createTime] KeyRing createTime + */ + + /** + * Constructs a new KeyRing. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a KeyRing. + * @implements IKeyRing + * @constructor + * @param {google.cloud.kms.v1.IKeyRing=} [properties] Properties to set + */ + function KeyRing(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeyRing name. + * @member {string} name + * @memberof google.cloud.kms.v1.KeyRing + * @instance + */ + KeyRing.prototype.name = ""; + + /** + * KeyRing createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.kms.v1.KeyRing + * @instance + */ + KeyRing.prototype.createTime = null; + + /** + * Creates a new KeyRing instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {google.cloud.kms.v1.IKeyRing=} [properties] Properties to set + * @returns {google.cloud.kms.v1.KeyRing} KeyRing instance + */ + KeyRing.create = function create(properties) { + return new KeyRing(properties); + }; + + /** + * Encodes the specified KeyRing message. Does not implicitly {@link google.cloud.kms.v1.KeyRing.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {google.cloud.kms.v1.IKeyRing} message KeyRing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyRing.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.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified KeyRing message, length delimited. Does not implicitly {@link google.cloud.kms.v1.KeyRing.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {google.cloud.kms.v1.IKeyRing} message KeyRing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyRing.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeyRing message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.KeyRing} KeyRing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyRing.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.KeyRing(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeyRing message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.KeyRing} KeyRing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyRing.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeyRing message. + * @function verify + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeyRing.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.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a KeyRing message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.KeyRing} KeyRing + */ + KeyRing.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.KeyRing) + return object; + var message = new $root.google.cloud.kms.v1.KeyRing(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.kms.v1.KeyRing.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a KeyRing message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {google.cloud.kms.v1.KeyRing} message KeyRing + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeyRing.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.createTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this KeyRing to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.KeyRing + * @instance + * @returns {Object.} JSON object + */ + KeyRing.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KeyRing + * @function getTypeUrl + * @memberof google.cloud.kms.v1.KeyRing + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KeyRing.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.KeyRing"; + }; + + return KeyRing; + })(); + + v1.CryptoKey = (function() { + + /** + * Properties of a CryptoKey. + * @memberof google.cloud.kms.v1 + * @interface ICryptoKey + * @property {string|null} [name] CryptoKey name + * @property {google.cloud.kms.v1.ICryptoKeyVersion|null} [primary] CryptoKey primary + * @property {google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose|null} [purpose] CryptoKey purpose + * @property {google.protobuf.ITimestamp|null} [createTime] CryptoKey createTime + * @property {google.protobuf.ITimestamp|null} [nextRotationTime] CryptoKey nextRotationTime + * @property {google.protobuf.IDuration|null} [rotationPeriod] CryptoKey rotationPeriod + * @property {google.cloud.kms.v1.ICryptoKeyVersionTemplate|null} [versionTemplate] CryptoKey versionTemplate + * @property {Object.|null} [labels] CryptoKey labels + * @property {boolean|null} [importOnly] CryptoKey importOnly + * @property {google.protobuf.IDuration|null} [destroyScheduledDuration] CryptoKey destroyScheduledDuration + * @property {string|null} [cryptoKeyBackend] CryptoKey cryptoKeyBackend + */ + + /** + * Constructs a new CryptoKey. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a CryptoKey. + * @implements ICryptoKey + * @constructor + * @param {google.cloud.kms.v1.ICryptoKey=} [properties] Properties to set + */ + function CryptoKey(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]]; + } + + /** + * CryptoKey name. + * @member {string} name + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.name = ""; + + /** + * CryptoKey primary. + * @member {google.cloud.kms.v1.ICryptoKeyVersion|null|undefined} primary + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.primary = null; + + /** + * CryptoKey purpose. + * @member {google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose} purpose + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.purpose = 0; + + /** + * CryptoKey createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.createTime = null; + + /** + * CryptoKey nextRotationTime. + * @member {google.protobuf.ITimestamp|null|undefined} nextRotationTime + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.nextRotationTime = null; + + /** + * CryptoKey rotationPeriod. + * @member {google.protobuf.IDuration|null|undefined} rotationPeriod + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.rotationPeriod = null; + + /** + * CryptoKey versionTemplate. + * @member {google.cloud.kms.v1.ICryptoKeyVersionTemplate|null|undefined} versionTemplate + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.versionTemplate = null; + + /** + * CryptoKey labels. + * @member {Object.} labels + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.labels = $util.emptyObject; + + /** + * CryptoKey importOnly. + * @member {boolean} importOnly + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.importOnly = false; + + /** + * CryptoKey destroyScheduledDuration. + * @member {google.protobuf.IDuration|null|undefined} destroyScheduledDuration + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.destroyScheduledDuration = null; + + /** + * CryptoKey cryptoKeyBackend. + * @member {string} cryptoKeyBackend + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + CryptoKey.prototype.cryptoKeyBackend = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * CryptoKey rotationSchedule. + * @member {"rotationPeriod"|undefined} rotationSchedule + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + */ + Object.defineProperty(CryptoKey.prototype, "rotationSchedule", { + get: $util.oneOfGetter($oneOfFields = ["rotationPeriod"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CryptoKey instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {google.cloud.kms.v1.ICryptoKey=} [properties] Properties to set + * @returns {google.cloud.kms.v1.CryptoKey} CryptoKey instance + */ + CryptoKey.create = function create(properties) { + return new CryptoKey(properties); + }; + + /** + * Encodes the specified CryptoKey message. Does not implicitly {@link google.cloud.kms.v1.CryptoKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {google.cloud.kms.v1.ICryptoKey} message CryptoKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CryptoKey.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.primary != null && Object.hasOwnProperty.call(message, "primary")) + $root.google.cloud.kms.v1.CryptoKeyVersion.encode(message.primary, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.purpose != null && Object.hasOwnProperty.call(message, "purpose")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.purpose); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.nextRotationTime != null && Object.hasOwnProperty.call(message, "nextRotationTime")) + $root.google.protobuf.Timestamp.encode(message.nextRotationTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.rotationPeriod != null && Object.hasOwnProperty.call(message, "rotationPeriod")) + $root.google.protobuf.Duration.encode(message.rotationPeriod, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.versionTemplate != null && Object.hasOwnProperty.call(message, "versionTemplate")) + $root.google.cloud.kms.v1.CryptoKeyVersionTemplate.encode(message.versionTemplate, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.importOnly != null && Object.hasOwnProperty.call(message, "importOnly")) + writer.uint32(/* id 13, wireType 0 =*/104).bool(message.importOnly); + if (message.destroyScheduledDuration != null && Object.hasOwnProperty.call(message, "destroyScheduledDuration")) + $root.google.protobuf.Duration.encode(message.destroyScheduledDuration, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.cryptoKeyBackend != null && Object.hasOwnProperty.call(message, "cryptoKeyBackend")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.cryptoKeyBackend); + return writer; + }; + + /** + * Encodes the specified CryptoKey message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CryptoKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {google.cloud.kms.v1.ICryptoKey} message CryptoKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CryptoKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CryptoKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.CryptoKey} CryptoKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CryptoKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.CryptoKey(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.primary = $root.google.cloud.kms.v1.CryptoKeyVersion.decode(reader, reader.uint32()); + break; + } + case 3: { + message.purpose = reader.int32(); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.nextRotationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.rotationPeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 11: { + message.versionTemplate = $root.google.cloud.kms.v1.CryptoKeyVersionTemplate.decode(reader, reader.uint32()); + break; + } + case 10: { + 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 13: { + message.importOnly = reader.bool(); + break; + } + case 14: { + message.destroyScheduledDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 15: { + message.cryptoKeyBackend = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CryptoKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.CryptoKey} CryptoKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CryptoKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CryptoKey message. + * @function verify + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CryptoKey.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.primary != null && message.hasOwnProperty("primary")) { + var error = $root.google.cloud.kms.v1.CryptoKeyVersion.verify(message.primary); + if (error) + return "primary." + error; + } + if (message.purpose != null && message.hasOwnProperty("purpose")) + switch (message.purpose) { + default: + return "purpose: enum value expected"; + case 0: + case 1: + case 5: + case 6: + case 9: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.nextRotationTime != null && message.hasOwnProperty("nextRotationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.nextRotationTime); + if (error) + return "nextRotationTime." + error; + } + if (message.rotationPeriod != null && message.hasOwnProperty("rotationPeriod")) { + properties.rotationSchedule = 1; + { + var error = $root.google.protobuf.Duration.verify(message.rotationPeriod); + if (error) + return "rotationPeriod." + error; + } + } + if (message.versionTemplate != null && message.hasOwnProperty("versionTemplate")) { + var error = $root.google.cloud.kms.v1.CryptoKeyVersionTemplate.verify(message.versionTemplate); + if (error) + return "versionTemplate." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.importOnly != null && message.hasOwnProperty("importOnly")) + if (typeof message.importOnly !== "boolean") + return "importOnly: boolean expected"; + if (message.destroyScheduledDuration != null && message.hasOwnProperty("destroyScheduledDuration")) { + var error = $root.google.protobuf.Duration.verify(message.destroyScheduledDuration); + if (error) + return "destroyScheduledDuration." + error; + } + if (message.cryptoKeyBackend != null && message.hasOwnProperty("cryptoKeyBackend")) + if (!$util.isString(message.cryptoKeyBackend)) + return "cryptoKeyBackend: string expected"; + return null; + }; + + /** + * Creates a CryptoKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.CryptoKey} CryptoKey + */ + CryptoKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.CryptoKey) + return object; + var message = new $root.google.cloud.kms.v1.CryptoKey(); + if (object.name != null) + message.name = String(object.name); + if (object.primary != null) { + if (typeof object.primary !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKey.primary: object expected"); + message.primary = $root.google.cloud.kms.v1.CryptoKeyVersion.fromObject(object.primary); + } + switch (object.purpose) { + default: + if (typeof object.purpose === "number") { + message.purpose = object.purpose; + break; + } + break; + case "CRYPTO_KEY_PURPOSE_UNSPECIFIED": + case 0: + message.purpose = 0; + break; + case "ENCRYPT_DECRYPT": + case 1: + message.purpose = 1; + break; + case "ASYMMETRIC_SIGN": + case 5: + message.purpose = 5; + break; + case "ASYMMETRIC_DECRYPT": + case 6: + message.purpose = 6; + break; + case "MAC": + case 9: + message.purpose = 9; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKey.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.nextRotationTime != null) { + if (typeof object.nextRotationTime !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKey.nextRotationTime: object expected"); + message.nextRotationTime = $root.google.protobuf.Timestamp.fromObject(object.nextRotationTime); + } + if (object.rotationPeriod != null) { + if (typeof object.rotationPeriod !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKey.rotationPeriod: object expected"); + message.rotationPeriod = $root.google.protobuf.Duration.fromObject(object.rotationPeriod); + } + if (object.versionTemplate != null) { + if (typeof object.versionTemplate !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKey.versionTemplate: object expected"); + message.versionTemplate = $root.google.cloud.kms.v1.CryptoKeyVersionTemplate.fromObject(object.versionTemplate); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKey.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.importOnly != null) + message.importOnly = Boolean(object.importOnly); + if (object.destroyScheduledDuration != null) { + if (typeof object.destroyScheduledDuration !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKey.destroyScheduledDuration: object expected"); + message.destroyScheduledDuration = $root.google.protobuf.Duration.fromObject(object.destroyScheduledDuration); + } + if (object.cryptoKeyBackend != null) + message.cryptoKeyBackend = String(object.cryptoKeyBackend); + return message; + }; + + /** + * Creates a plain object from a CryptoKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {google.cloud.kms.v1.CryptoKey} message CryptoKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CryptoKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.primary = null; + object.purpose = options.enums === String ? "CRYPTO_KEY_PURPOSE_UNSPECIFIED" : 0; + object.createTime = null; + object.nextRotationTime = null; + object.versionTemplate = null; + object.importOnly = false; + object.destroyScheduledDuration = null; + object.cryptoKeyBackend = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.primary != null && message.hasOwnProperty("primary")) + object.primary = $root.google.cloud.kms.v1.CryptoKeyVersion.toObject(message.primary, options); + if (message.purpose != null && message.hasOwnProperty("purpose")) + object.purpose = options.enums === String ? $root.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose[message.purpose] === undefined ? message.purpose : $root.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose[message.purpose] : message.purpose; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.nextRotationTime != null && message.hasOwnProperty("nextRotationTime")) + object.nextRotationTime = $root.google.protobuf.Timestamp.toObject(message.nextRotationTime, options); + if (message.rotationPeriod != null && message.hasOwnProperty("rotationPeriod")) { + object.rotationPeriod = $root.google.protobuf.Duration.toObject(message.rotationPeriod, options); + if (options.oneofs) + object.rotationSchedule = "rotationPeriod"; + } + 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.versionTemplate != null && message.hasOwnProperty("versionTemplate")) + object.versionTemplate = $root.google.cloud.kms.v1.CryptoKeyVersionTemplate.toObject(message.versionTemplate, options); + if (message.importOnly != null && message.hasOwnProperty("importOnly")) + object.importOnly = message.importOnly; + if (message.destroyScheduledDuration != null && message.hasOwnProperty("destroyScheduledDuration")) + object.destroyScheduledDuration = $root.google.protobuf.Duration.toObject(message.destroyScheduledDuration, options); + if (message.cryptoKeyBackend != null && message.hasOwnProperty("cryptoKeyBackend")) + object.cryptoKeyBackend = message.cryptoKeyBackend; + return object; + }; + + /** + * Converts this CryptoKey to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.CryptoKey + * @instance + * @returns {Object.} JSON object + */ + CryptoKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CryptoKey + * @function getTypeUrl + * @memberof google.cloud.kms.v1.CryptoKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CryptoKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.CryptoKey"; + }; + + /** + * CryptoKeyPurpose enum. + * @name google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose + * @enum {number} + * @property {number} CRYPTO_KEY_PURPOSE_UNSPECIFIED=0 CRYPTO_KEY_PURPOSE_UNSPECIFIED value + * @property {number} ENCRYPT_DECRYPT=1 ENCRYPT_DECRYPT value + * @property {number} ASYMMETRIC_SIGN=5 ASYMMETRIC_SIGN value + * @property {number} ASYMMETRIC_DECRYPT=6 ASYMMETRIC_DECRYPT value + * @property {number} MAC=9 MAC value + */ + CryptoKey.CryptoKeyPurpose = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CRYPTO_KEY_PURPOSE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENCRYPT_DECRYPT"] = 1; + values[valuesById[5] = "ASYMMETRIC_SIGN"] = 5; + values[valuesById[6] = "ASYMMETRIC_DECRYPT"] = 6; + values[valuesById[9] = "MAC"] = 9; + return values; + })(); + + return CryptoKey; + })(); + + v1.CryptoKeyVersionTemplate = (function() { + + /** + * Properties of a CryptoKeyVersionTemplate. + * @memberof google.cloud.kms.v1 + * @interface ICryptoKeyVersionTemplate + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] CryptoKeyVersionTemplate protectionLevel + * @property {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|null} [algorithm] CryptoKeyVersionTemplate algorithm + */ + + /** + * Constructs a new CryptoKeyVersionTemplate. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a CryptoKeyVersionTemplate. + * @implements ICryptoKeyVersionTemplate + * @constructor + * @param {google.cloud.kms.v1.ICryptoKeyVersionTemplate=} [properties] Properties to set + */ + function CryptoKeyVersionTemplate(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CryptoKeyVersionTemplate protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @instance + */ + CryptoKeyVersionTemplate.prototype.protectionLevel = 0; + + /** + * CryptoKeyVersionTemplate algorithm. + * @member {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} algorithm + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @instance + */ + CryptoKeyVersionTemplate.prototype.algorithm = 0; + + /** + * Creates a new CryptoKeyVersionTemplate instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {google.cloud.kms.v1.ICryptoKeyVersionTemplate=} [properties] Properties to set + * @returns {google.cloud.kms.v1.CryptoKeyVersionTemplate} CryptoKeyVersionTemplate instance + */ + CryptoKeyVersionTemplate.create = function create(properties) { + return new CryptoKeyVersionTemplate(properties); + }; + + /** + * Encodes the specified CryptoKeyVersionTemplate message. Does not implicitly {@link google.cloud.kms.v1.CryptoKeyVersionTemplate.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {google.cloud.kms.v1.ICryptoKeyVersionTemplate} message CryptoKeyVersionTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CryptoKeyVersionTemplate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.protectionLevel); + if (message.algorithm != null && Object.hasOwnProperty.call(message, "algorithm")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.algorithm); + return writer; + }; + + /** + * Encodes the specified CryptoKeyVersionTemplate message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CryptoKeyVersionTemplate.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {google.cloud.kms.v1.ICryptoKeyVersionTemplate} message CryptoKeyVersionTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CryptoKeyVersionTemplate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CryptoKeyVersionTemplate message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.CryptoKeyVersionTemplate} CryptoKeyVersionTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CryptoKeyVersionTemplate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.CryptoKeyVersionTemplate(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.protectionLevel = reader.int32(); + break; + } + case 3: { + message.algorithm = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CryptoKeyVersionTemplate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.CryptoKeyVersionTemplate} CryptoKeyVersionTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CryptoKeyVersionTemplate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CryptoKeyVersionTemplate message. + * @function verify + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CryptoKeyVersionTemplate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.algorithm != null && message.hasOwnProperty("algorithm")) + switch (message.algorithm) { + default: + return "algorithm: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 15: + case 5: + case 6: + case 7: + case 16: + case 28: + case 29: + case 30: + case 8: + case 9: + case 10: + case 17: + case 37: + case 38: + case 39: + case 12: + case 13: + case 31: + case 32: + case 18: + break; + } + return null; + }; + + /** + * Creates a CryptoKeyVersionTemplate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.CryptoKeyVersionTemplate} CryptoKeyVersionTemplate + */ + CryptoKeyVersionTemplate.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.CryptoKeyVersionTemplate) + return object; + var message = new $root.google.cloud.kms.v1.CryptoKeyVersionTemplate(); + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + switch (object.algorithm) { + default: + if (typeof object.algorithm === "number") { + message.algorithm = object.algorithm; + break; + } + break; + case "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED": + case 0: + message.algorithm = 0; + break; + case "GOOGLE_SYMMETRIC_ENCRYPTION": + case 1: + message.algorithm = 1; + break; + case "RSA_SIGN_PSS_2048_SHA256": + case 2: + message.algorithm = 2; + break; + case "RSA_SIGN_PSS_3072_SHA256": + case 3: + message.algorithm = 3; + break; + case "RSA_SIGN_PSS_4096_SHA256": + case 4: + message.algorithm = 4; + break; + case "RSA_SIGN_PSS_4096_SHA512": + case 15: + message.algorithm = 15; + break; + case "RSA_SIGN_PKCS1_2048_SHA256": + case 5: + message.algorithm = 5; + break; + case "RSA_SIGN_PKCS1_3072_SHA256": + case 6: + message.algorithm = 6; + break; + case "RSA_SIGN_PKCS1_4096_SHA256": + case 7: + message.algorithm = 7; + break; + case "RSA_SIGN_PKCS1_4096_SHA512": + case 16: + message.algorithm = 16; + break; + case "RSA_SIGN_RAW_PKCS1_2048": + case 28: + message.algorithm = 28; + break; + case "RSA_SIGN_RAW_PKCS1_3072": + case 29: + message.algorithm = 29; + break; + case "RSA_SIGN_RAW_PKCS1_4096": + case 30: + message.algorithm = 30; + break; + case "RSA_DECRYPT_OAEP_2048_SHA256": + case 8: + message.algorithm = 8; + break; + case "RSA_DECRYPT_OAEP_3072_SHA256": + case 9: + message.algorithm = 9; + break; + case "RSA_DECRYPT_OAEP_4096_SHA256": + case 10: + message.algorithm = 10; + break; + case "RSA_DECRYPT_OAEP_4096_SHA512": + case 17: + message.algorithm = 17; + break; + case "RSA_DECRYPT_OAEP_2048_SHA1": + case 37: + message.algorithm = 37; + break; + case "RSA_DECRYPT_OAEP_3072_SHA1": + case 38: + message.algorithm = 38; + break; + case "RSA_DECRYPT_OAEP_4096_SHA1": + case 39: + message.algorithm = 39; + break; + case "EC_SIGN_P256_SHA256": + case 12: + message.algorithm = 12; + break; + case "EC_SIGN_P384_SHA384": + case 13: + message.algorithm = 13; + break; + case "EC_SIGN_SECP256K1_SHA256": + case 31: + message.algorithm = 31; + break; + case "HMAC_SHA256": + case 32: + message.algorithm = 32; + break; + case "EXTERNAL_SYMMETRIC_ENCRYPTION": + case 18: + message.algorithm = 18; + break; + } + return message; + }; + + /** + * Creates a plain object from a CryptoKeyVersionTemplate message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {google.cloud.kms.v1.CryptoKeyVersionTemplate} message CryptoKeyVersionTemplate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CryptoKeyVersionTemplate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + object.algorithm = options.enums === String ? "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" : 0; + } + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + if (message.algorithm != null && message.hasOwnProperty("algorithm")) + object.algorithm = options.enums === String ? $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm[message.algorithm] === undefined ? message.algorithm : $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm[message.algorithm] : message.algorithm; + return object; + }; + + /** + * Converts this CryptoKeyVersionTemplate to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @instance + * @returns {Object.} JSON object + */ + CryptoKeyVersionTemplate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CryptoKeyVersionTemplate + * @function getTypeUrl + * @memberof google.cloud.kms.v1.CryptoKeyVersionTemplate + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CryptoKeyVersionTemplate.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.CryptoKeyVersionTemplate"; + }; + + return CryptoKeyVersionTemplate; + })(); + + v1.KeyOperationAttestation = (function() { + + /** + * Properties of a KeyOperationAttestation. + * @memberof google.cloud.kms.v1 + * @interface IKeyOperationAttestation + * @property {google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat|null} [format] KeyOperationAttestation format + * @property {Uint8Array|null} [content] KeyOperationAttestation content + * @property {google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains|null} [certChains] KeyOperationAttestation certChains + */ + + /** + * Constructs a new KeyOperationAttestation. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a KeyOperationAttestation. + * @implements IKeyOperationAttestation + * @constructor + * @param {google.cloud.kms.v1.IKeyOperationAttestation=} [properties] Properties to set + */ + function KeyOperationAttestation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KeyOperationAttestation format. + * @member {google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat} format + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @instance + */ + KeyOperationAttestation.prototype.format = 0; + + /** + * KeyOperationAttestation content. + * @member {Uint8Array} content + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @instance + */ + KeyOperationAttestation.prototype.content = $util.newBuffer([]); + + /** + * KeyOperationAttestation certChains. + * @member {google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains|null|undefined} certChains + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @instance + */ + KeyOperationAttestation.prototype.certChains = null; + + /** + * Creates a new KeyOperationAttestation instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {google.cloud.kms.v1.IKeyOperationAttestation=} [properties] Properties to set + * @returns {google.cloud.kms.v1.KeyOperationAttestation} KeyOperationAttestation instance + */ + KeyOperationAttestation.create = function create(properties) { + return new KeyOperationAttestation(properties); + }; + + /** + * Encodes the specified KeyOperationAttestation message. Does not implicitly {@link google.cloud.kms.v1.KeyOperationAttestation.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {google.cloud.kms.v1.IKeyOperationAttestation} message KeyOperationAttestation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyOperationAttestation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.format); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.content); + if (message.certChains != null && Object.hasOwnProperty.call(message, "certChains")) + $root.google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.encode(message.certChains, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified KeyOperationAttestation message, length delimited. Does not implicitly {@link google.cloud.kms.v1.KeyOperationAttestation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {google.cloud.kms.v1.IKeyOperationAttestation} message KeyOperationAttestation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KeyOperationAttestation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KeyOperationAttestation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.KeyOperationAttestation} KeyOperationAttestation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyOperationAttestation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.KeyOperationAttestation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.format = reader.int32(); + break; + } + case 5: { + message.content = reader.bytes(); + break; + } + case 6: { + message.certChains = $root.google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KeyOperationAttestation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.KeyOperationAttestation} KeyOperationAttestation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KeyOperationAttestation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KeyOperationAttestation message. + * @function verify + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KeyOperationAttestation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.format != null && message.hasOwnProperty("format")) + switch (message.format) { + default: + return "format: enum value expected"; + case 0: + case 3: + case 4: + break; + } + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.certChains != null && message.hasOwnProperty("certChains")) { + var error = $root.google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.verify(message.certChains); + if (error) + return "certChains." + error; + } + return null; + }; + + /** + * Creates a KeyOperationAttestation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.KeyOperationAttestation} KeyOperationAttestation + */ + KeyOperationAttestation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.KeyOperationAttestation) + return object; + var message = new $root.google.cloud.kms.v1.KeyOperationAttestation(); + switch (object.format) { + default: + if (typeof object.format === "number") { + message.format = object.format; + break; + } + break; + case "ATTESTATION_FORMAT_UNSPECIFIED": + case 0: + message.format = 0; + break; + case "CAVIUM_V1_COMPRESSED": + case 3: + message.format = 3; + break; + case "CAVIUM_V2_COMPRESSED": + case 4: + message.format = 4; + break; + } + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length >= 0) + message.content = object.content; + if (object.certChains != null) { + if (typeof object.certChains !== "object") + throw TypeError(".google.cloud.kms.v1.KeyOperationAttestation.certChains: object expected"); + message.certChains = $root.google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.fromObject(object.certChains); + } + return message; + }; + + /** + * Creates a plain object from a KeyOperationAttestation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {google.cloud.kms.v1.KeyOperationAttestation} message KeyOperationAttestation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KeyOperationAttestation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.format = options.enums === String ? "ATTESTATION_FORMAT_UNSPECIFIED" : 0; + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.certChains = null; + } + if (message.format != null && message.hasOwnProperty("format")) + object.format = options.enums === String ? $root.google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat[message.format] === undefined ? message.format : $root.google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat[message.format] : message.format; + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.certChains != null && message.hasOwnProperty("certChains")) + object.certChains = $root.google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.toObject(message.certChains, options); + return object; + }; + + /** + * Converts this KeyOperationAttestation to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @instance + * @returns {Object.} JSON object + */ + KeyOperationAttestation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KeyOperationAttestation + * @function getTypeUrl + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KeyOperationAttestation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.KeyOperationAttestation"; + }; + + /** + * AttestationFormat enum. + * @name google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat + * @enum {number} + * @property {number} ATTESTATION_FORMAT_UNSPECIFIED=0 ATTESTATION_FORMAT_UNSPECIFIED value + * @property {number} CAVIUM_V1_COMPRESSED=3 CAVIUM_V1_COMPRESSED value + * @property {number} CAVIUM_V2_COMPRESSED=4 CAVIUM_V2_COMPRESSED value + */ + KeyOperationAttestation.AttestationFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ATTESTATION_FORMAT_UNSPECIFIED"] = 0; + values[valuesById[3] = "CAVIUM_V1_COMPRESSED"] = 3; + values[valuesById[4] = "CAVIUM_V2_COMPRESSED"] = 4; + return values; + })(); + + KeyOperationAttestation.CertificateChains = (function() { + + /** + * Properties of a CertificateChains. + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @interface ICertificateChains + * @property {Array.|null} [caviumCerts] CertificateChains caviumCerts + * @property {Array.|null} [googleCardCerts] CertificateChains googleCardCerts + * @property {Array.|null} [googlePartitionCerts] CertificateChains googlePartitionCerts + */ + + /** + * Constructs a new CertificateChains. + * @memberof google.cloud.kms.v1.KeyOperationAttestation + * @classdesc Represents a CertificateChains. + * @implements ICertificateChains + * @constructor + * @param {google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains=} [properties] Properties to set + */ + function CertificateChains(properties) { + this.caviumCerts = []; + this.googleCardCerts = []; + this.googlePartitionCerts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CertificateChains caviumCerts. + * @member {Array.} caviumCerts + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @instance + */ + CertificateChains.prototype.caviumCerts = $util.emptyArray; + + /** + * CertificateChains googleCardCerts. + * @member {Array.} googleCardCerts + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @instance + */ + CertificateChains.prototype.googleCardCerts = $util.emptyArray; + + /** + * CertificateChains googlePartitionCerts. + * @member {Array.} googlePartitionCerts + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @instance + */ + CertificateChains.prototype.googlePartitionCerts = $util.emptyArray; + + /** + * Creates a new CertificateChains instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains=} [properties] Properties to set + * @returns {google.cloud.kms.v1.KeyOperationAttestation.CertificateChains} CertificateChains instance + */ + CertificateChains.create = function create(properties) { + return new CertificateChains(properties); + }; + + /** + * Encodes the specified CertificateChains message. Does not implicitly {@link google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains} message CertificateChains message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertificateChains.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.caviumCerts != null && message.caviumCerts.length) + for (var i = 0; i < message.caviumCerts.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.caviumCerts[i]); + if (message.googleCardCerts != null && message.googleCardCerts.length) + for (var i = 0; i < message.googleCardCerts.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.googleCardCerts[i]); + if (message.googlePartitionCerts != null && message.googlePartitionCerts.length) + for (var i = 0; i < message.googlePartitionCerts.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.googlePartitionCerts[i]); + return writer; + }; + + /** + * Encodes the specified CertificateChains message, length delimited. Does not implicitly {@link google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {google.cloud.kms.v1.KeyOperationAttestation.ICertificateChains} message CertificateChains message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertificateChains.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CertificateChains message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.KeyOperationAttestation.CertificateChains} CertificateChains + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertificateChains.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.KeyOperationAttestation.CertificateChains(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.caviumCerts && message.caviumCerts.length)) + message.caviumCerts = []; + message.caviumCerts.push(reader.string()); + break; + } + case 2: { + if (!(message.googleCardCerts && message.googleCardCerts.length)) + message.googleCardCerts = []; + message.googleCardCerts.push(reader.string()); + break; + } + case 3: { + if (!(message.googlePartitionCerts && message.googlePartitionCerts.length)) + message.googlePartitionCerts = []; + message.googlePartitionCerts.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CertificateChains message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.KeyOperationAttestation.CertificateChains} CertificateChains + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertificateChains.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CertificateChains message. + * @function verify + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CertificateChains.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.caviumCerts != null && message.hasOwnProperty("caviumCerts")) { + if (!Array.isArray(message.caviumCerts)) + return "caviumCerts: array expected"; + for (var i = 0; i < message.caviumCerts.length; ++i) + if (!$util.isString(message.caviumCerts[i])) + return "caviumCerts: string[] expected"; + } + if (message.googleCardCerts != null && message.hasOwnProperty("googleCardCerts")) { + if (!Array.isArray(message.googleCardCerts)) + return "googleCardCerts: array expected"; + for (var i = 0; i < message.googleCardCerts.length; ++i) + if (!$util.isString(message.googleCardCerts[i])) + return "googleCardCerts: string[] expected"; + } + if (message.googlePartitionCerts != null && message.hasOwnProperty("googlePartitionCerts")) { + if (!Array.isArray(message.googlePartitionCerts)) + return "googlePartitionCerts: array expected"; + for (var i = 0; i < message.googlePartitionCerts.length; ++i) + if (!$util.isString(message.googlePartitionCerts[i])) + return "googlePartitionCerts: string[] expected"; + } + return null; + }; + + /** + * Creates a CertificateChains message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.KeyOperationAttestation.CertificateChains} CertificateChains + */ + CertificateChains.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.KeyOperationAttestation.CertificateChains) + return object; + var message = new $root.google.cloud.kms.v1.KeyOperationAttestation.CertificateChains(); + if (object.caviumCerts) { + if (!Array.isArray(object.caviumCerts)) + throw TypeError(".google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.caviumCerts: array expected"); + message.caviumCerts = []; + for (var i = 0; i < object.caviumCerts.length; ++i) + message.caviumCerts[i] = String(object.caviumCerts[i]); + } + if (object.googleCardCerts) { + if (!Array.isArray(object.googleCardCerts)) + throw TypeError(".google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.googleCardCerts: array expected"); + message.googleCardCerts = []; + for (var i = 0; i < object.googleCardCerts.length; ++i) + message.googleCardCerts[i] = String(object.googleCardCerts[i]); + } + if (object.googlePartitionCerts) { + if (!Array.isArray(object.googlePartitionCerts)) + throw TypeError(".google.cloud.kms.v1.KeyOperationAttestation.CertificateChains.googlePartitionCerts: array expected"); + message.googlePartitionCerts = []; + for (var i = 0; i < object.googlePartitionCerts.length; ++i) + message.googlePartitionCerts[i] = String(object.googlePartitionCerts[i]); + } + return message; + }; + + /** + * Creates a plain object from a CertificateChains message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {google.cloud.kms.v1.KeyOperationAttestation.CertificateChains} message CertificateChains + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CertificateChains.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.caviumCerts = []; + object.googleCardCerts = []; + object.googlePartitionCerts = []; + } + if (message.caviumCerts && message.caviumCerts.length) { + object.caviumCerts = []; + for (var j = 0; j < message.caviumCerts.length; ++j) + object.caviumCerts[j] = message.caviumCerts[j]; + } + if (message.googleCardCerts && message.googleCardCerts.length) { + object.googleCardCerts = []; + for (var j = 0; j < message.googleCardCerts.length; ++j) + object.googleCardCerts[j] = message.googleCardCerts[j]; + } + if (message.googlePartitionCerts && message.googlePartitionCerts.length) { + object.googlePartitionCerts = []; + for (var j = 0; j < message.googlePartitionCerts.length; ++j) + object.googlePartitionCerts[j] = message.googlePartitionCerts[j]; + } + return object; + }; + + /** + * Converts this CertificateChains to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @instance + * @returns {Object.} JSON object + */ + CertificateChains.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CertificateChains + * @function getTypeUrl + * @memberof google.cloud.kms.v1.KeyOperationAttestation.CertificateChains + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CertificateChains.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"; + }; + + return CertificateChains; + })(); + + return KeyOperationAttestation; + })(); + + v1.CryptoKeyVersion = (function() { + + /** + * Properties of a CryptoKeyVersion. + * @memberof google.cloud.kms.v1 + * @interface ICryptoKeyVersion + * @property {string|null} [name] CryptoKeyVersion name + * @property {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState|null} [state] CryptoKeyVersion state + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] CryptoKeyVersion protectionLevel + * @property {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|null} [algorithm] CryptoKeyVersion algorithm + * @property {google.cloud.kms.v1.IKeyOperationAttestation|null} [attestation] CryptoKeyVersion attestation + * @property {google.protobuf.ITimestamp|null} [createTime] CryptoKeyVersion createTime + * @property {google.protobuf.ITimestamp|null} [generateTime] CryptoKeyVersion generateTime + * @property {google.protobuf.ITimestamp|null} [destroyTime] CryptoKeyVersion destroyTime + * @property {google.protobuf.ITimestamp|null} [destroyEventTime] CryptoKeyVersion destroyEventTime + * @property {string|null} [importJob] CryptoKeyVersion importJob + * @property {google.protobuf.ITimestamp|null} [importTime] CryptoKeyVersion importTime + * @property {string|null} [importFailureReason] CryptoKeyVersion importFailureReason + * @property {google.cloud.kms.v1.IExternalProtectionLevelOptions|null} [externalProtectionLevelOptions] CryptoKeyVersion externalProtectionLevelOptions + * @property {boolean|null} [reimportEligible] CryptoKeyVersion reimportEligible + */ + + /** + * Constructs a new CryptoKeyVersion. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a CryptoKeyVersion. + * @implements ICryptoKeyVersion + * @constructor + * @param {google.cloud.kms.v1.ICryptoKeyVersion=} [properties] Properties to set + */ + function CryptoKeyVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CryptoKeyVersion name. + * @member {string} name + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.name = ""; + + /** + * CryptoKeyVersion state. + * @member {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState} state + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.state = 0; + + /** + * CryptoKeyVersion protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.protectionLevel = 0; + + /** + * CryptoKeyVersion algorithm. + * @member {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} algorithm + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.algorithm = 0; + + /** + * CryptoKeyVersion attestation. + * @member {google.cloud.kms.v1.IKeyOperationAttestation|null|undefined} attestation + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.attestation = null; + + /** + * CryptoKeyVersion createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.createTime = null; + + /** + * CryptoKeyVersion generateTime. + * @member {google.protobuf.ITimestamp|null|undefined} generateTime + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.generateTime = null; + + /** + * CryptoKeyVersion destroyTime. + * @member {google.protobuf.ITimestamp|null|undefined} destroyTime + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.destroyTime = null; + + /** + * CryptoKeyVersion destroyEventTime. + * @member {google.protobuf.ITimestamp|null|undefined} destroyEventTime + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.destroyEventTime = null; + + /** + * CryptoKeyVersion importJob. + * @member {string} importJob + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.importJob = ""; + + /** + * CryptoKeyVersion importTime. + * @member {google.protobuf.ITimestamp|null|undefined} importTime + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.importTime = null; + + /** + * CryptoKeyVersion importFailureReason. + * @member {string} importFailureReason + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.importFailureReason = ""; + + /** + * CryptoKeyVersion externalProtectionLevelOptions. + * @member {google.cloud.kms.v1.IExternalProtectionLevelOptions|null|undefined} externalProtectionLevelOptions + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.externalProtectionLevelOptions = null; + + /** + * CryptoKeyVersion reimportEligible. + * @member {boolean} reimportEligible + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + */ + CryptoKeyVersion.prototype.reimportEligible = false; + + /** + * Creates a new CryptoKeyVersion instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {google.cloud.kms.v1.ICryptoKeyVersion=} [properties] Properties to set + * @returns {google.cloud.kms.v1.CryptoKeyVersion} CryptoKeyVersion instance + */ + CryptoKeyVersion.create = function create(properties) { + return new CryptoKeyVersion(properties); + }; + + /** + * Encodes the specified CryptoKeyVersion message. Does not implicitly {@link google.cloud.kms.v1.CryptoKeyVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {google.cloud.kms.v1.ICryptoKeyVersion} message CryptoKeyVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CryptoKeyVersion.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.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.destroyTime != null && Object.hasOwnProperty.call(message, "destroyTime")) + $root.google.protobuf.Timestamp.encode(message.destroyTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.destroyEventTime != null && Object.hasOwnProperty.call(message, "destroyEventTime")) + $root.google.protobuf.Timestamp.encode(message.destroyEventTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.protectionLevel); + if (message.attestation != null && Object.hasOwnProperty.call(message, "attestation")) + $root.google.cloud.kms.v1.KeyOperationAttestation.encode(message.attestation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.algorithm != null && Object.hasOwnProperty.call(message, "algorithm")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.algorithm); + if (message.generateTime != null && Object.hasOwnProperty.call(message, "generateTime")) + $root.google.protobuf.Timestamp.encode(message.generateTime, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.importJob != null && Object.hasOwnProperty.call(message, "importJob")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.importJob); + if (message.importTime != null && Object.hasOwnProperty.call(message, "importTime")) + $root.google.protobuf.Timestamp.encode(message.importTime, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.importFailureReason != null && Object.hasOwnProperty.call(message, "importFailureReason")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.importFailureReason); + if (message.externalProtectionLevelOptions != null && Object.hasOwnProperty.call(message, "externalProtectionLevelOptions")) + $root.google.cloud.kms.v1.ExternalProtectionLevelOptions.encode(message.externalProtectionLevelOptions, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.reimportEligible != null && Object.hasOwnProperty.call(message, "reimportEligible")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.reimportEligible); + return writer; + }; + + /** + * Encodes the specified CryptoKeyVersion message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CryptoKeyVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {google.cloud.kms.v1.ICryptoKeyVersion} message CryptoKeyVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CryptoKeyVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CryptoKeyVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.CryptoKeyVersion} CryptoKeyVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CryptoKeyVersion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.CryptoKeyVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 7: { + message.protectionLevel = reader.int32(); + break; + } + case 10: { + message.algorithm = reader.int32(); + break; + } + case 8: { + message.attestation = $root.google.cloud.kms.v1.KeyOperationAttestation.decode(reader, reader.uint32()); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 11: { + message.generateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.destroyTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.destroyEventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 14: { + message.importJob = reader.string(); + break; + } + case 15: { + message.importTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 16: { + message.importFailureReason = reader.string(); + break; + } + case 17: { + message.externalProtectionLevelOptions = $root.google.cloud.kms.v1.ExternalProtectionLevelOptions.decode(reader, reader.uint32()); + break; + } + case 18: { + message.reimportEligible = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CryptoKeyVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.CryptoKeyVersion} CryptoKeyVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CryptoKeyVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CryptoKeyVersion message. + * @function verify + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CryptoKeyVersion.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.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 5: + case 1: + case 2: + case 3: + case 4: + case 6: + case 7: + break; + } + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.algorithm != null && message.hasOwnProperty("algorithm")) + switch (message.algorithm) { + default: + return "algorithm: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 15: + case 5: + case 6: + case 7: + case 16: + case 28: + case 29: + case 30: + case 8: + case 9: + case 10: + case 17: + case 37: + case 38: + case 39: + case 12: + case 13: + case 31: + case 32: + case 18: + break; + } + if (message.attestation != null && message.hasOwnProperty("attestation")) { + var error = $root.google.cloud.kms.v1.KeyOperationAttestation.verify(message.attestation); + if (error) + return "attestation." + error; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.generateTime != null && message.hasOwnProperty("generateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.generateTime); + if (error) + return "generateTime." + error; + } + if (message.destroyTime != null && message.hasOwnProperty("destroyTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.destroyTime); + if (error) + return "destroyTime." + error; + } + if (message.destroyEventTime != null && message.hasOwnProperty("destroyEventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.destroyEventTime); + if (error) + return "destroyEventTime." + error; + } + if (message.importJob != null && message.hasOwnProperty("importJob")) + if (!$util.isString(message.importJob)) + return "importJob: string expected"; + if (message.importTime != null && message.hasOwnProperty("importTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.importTime); + if (error) + return "importTime." + error; + } + if (message.importFailureReason != null && message.hasOwnProperty("importFailureReason")) + if (!$util.isString(message.importFailureReason)) + return "importFailureReason: string expected"; + if (message.externalProtectionLevelOptions != null && message.hasOwnProperty("externalProtectionLevelOptions")) { + var error = $root.google.cloud.kms.v1.ExternalProtectionLevelOptions.verify(message.externalProtectionLevelOptions); + if (error) + return "externalProtectionLevelOptions." + error; + } + if (message.reimportEligible != null && message.hasOwnProperty("reimportEligible")) + if (typeof message.reimportEligible !== "boolean") + return "reimportEligible: boolean expected"; + return null; + }; + + /** + * Creates a CryptoKeyVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.CryptoKeyVersion} CryptoKeyVersion + */ + CryptoKeyVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.CryptoKeyVersion) + return object; + var message = new $root.google.cloud.kms.v1.CryptoKeyVersion(); + if (object.name != null) + message.name = String(object.name); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "PENDING_GENERATION": + case 5: + message.state = 5; + break; + case "ENABLED": + case 1: + message.state = 1; + break; + case "DISABLED": + case 2: + message.state = 2; + break; + case "DESTROYED": + case 3: + message.state = 3; + break; + case "DESTROY_SCHEDULED": + case 4: + message.state = 4; + break; + case "PENDING_IMPORT": + case 6: + message.state = 6; + break; + case "IMPORT_FAILED": + case 7: + message.state = 7; + break; + } + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + switch (object.algorithm) { + default: + if (typeof object.algorithm === "number") { + message.algorithm = object.algorithm; + break; + } + break; + case "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED": + case 0: + message.algorithm = 0; + break; + case "GOOGLE_SYMMETRIC_ENCRYPTION": + case 1: + message.algorithm = 1; + break; + case "RSA_SIGN_PSS_2048_SHA256": + case 2: + message.algorithm = 2; + break; + case "RSA_SIGN_PSS_3072_SHA256": + case 3: + message.algorithm = 3; + break; + case "RSA_SIGN_PSS_4096_SHA256": + case 4: + message.algorithm = 4; + break; + case "RSA_SIGN_PSS_4096_SHA512": + case 15: + message.algorithm = 15; + break; + case "RSA_SIGN_PKCS1_2048_SHA256": + case 5: + message.algorithm = 5; + break; + case "RSA_SIGN_PKCS1_3072_SHA256": + case 6: + message.algorithm = 6; + break; + case "RSA_SIGN_PKCS1_4096_SHA256": + case 7: + message.algorithm = 7; + break; + case "RSA_SIGN_PKCS1_4096_SHA512": + case 16: + message.algorithm = 16; + break; + case "RSA_SIGN_RAW_PKCS1_2048": + case 28: + message.algorithm = 28; + break; + case "RSA_SIGN_RAW_PKCS1_3072": + case 29: + message.algorithm = 29; + break; + case "RSA_SIGN_RAW_PKCS1_4096": + case 30: + message.algorithm = 30; + break; + case "RSA_DECRYPT_OAEP_2048_SHA256": + case 8: + message.algorithm = 8; + break; + case "RSA_DECRYPT_OAEP_3072_SHA256": + case 9: + message.algorithm = 9; + break; + case "RSA_DECRYPT_OAEP_4096_SHA256": + case 10: + message.algorithm = 10; + break; + case "RSA_DECRYPT_OAEP_4096_SHA512": + case 17: + message.algorithm = 17; + break; + case "RSA_DECRYPT_OAEP_2048_SHA1": + case 37: + message.algorithm = 37; + break; + case "RSA_DECRYPT_OAEP_3072_SHA1": + case 38: + message.algorithm = 38; + break; + case "RSA_DECRYPT_OAEP_4096_SHA1": + case 39: + message.algorithm = 39; + break; + case "EC_SIGN_P256_SHA256": + case 12: + message.algorithm = 12; + break; + case "EC_SIGN_P384_SHA384": + case 13: + message.algorithm = 13; + break; + case "EC_SIGN_SECP256K1_SHA256": + case 31: + message.algorithm = 31; + break; + case "HMAC_SHA256": + case 32: + message.algorithm = 32; + break; + case "EXTERNAL_SYMMETRIC_ENCRYPTION": + case 18: + message.algorithm = 18; + break; + } + if (object.attestation != null) { + if (typeof object.attestation !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKeyVersion.attestation: object expected"); + message.attestation = $root.google.cloud.kms.v1.KeyOperationAttestation.fromObject(object.attestation); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKeyVersion.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.generateTime != null) { + if (typeof object.generateTime !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKeyVersion.generateTime: object expected"); + message.generateTime = $root.google.protobuf.Timestamp.fromObject(object.generateTime); + } + if (object.destroyTime != null) { + if (typeof object.destroyTime !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKeyVersion.destroyTime: object expected"); + message.destroyTime = $root.google.protobuf.Timestamp.fromObject(object.destroyTime); + } + if (object.destroyEventTime != null) { + if (typeof object.destroyEventTime !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKeyVersion.destroyEventTime: object expected"); + message.destroyEventTime = $root.google.protobuf.Timestamp.fromObject(object.destroyEventTime); + } + if (object.importJob != null) + message.importJob = String(object.importJob); + if (object.importTime != null) { + if (typeof object.importTime !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKeyVersion.importTime: object expected"); + message.importTime = $root.google.protobuf.Timestamp.fromObject(object.importTime); + } + if (object.importFailureReason != null) + message.importFailureReason = String(object.importFailureReason); + if (object.externalProtectionLevelOptions != null) { + if (typeof object.externalProtectionLevelOptions !== "object") + throw TypeError(".google.cloud.kms.v1.CryptoKeyVersion.externalProtectionLevelOptions: object expected"); + message.externalProtectionLevelOptions = $root.google.cloud.kms.v1.ExternalProtectionLevelOptions.fromObject(object.externalProtectionLevelOptions); + } + if (object.reimportEligible != null) + message.reimportEligible = Boolean(object.reimportEligible); + return message; + }; + + /** + * Creates a plain object from a CryptoKeyVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {google.cloud.kms.v1.CryptoKeyVersion} message CryptoKeyVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CryptoKeyVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.state = options.enums === String ? "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.destroyTime = null; + object.destroyEventTime = null; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + object.attestation = null; + object.algorithm = options.enums === String ? "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" : 0; + object.generateTime = null; + object.importJob = ""; + object.importTime = null; + object.importFailureReason = ""; + object.externalProtectionLevelOptions = null; + object.reimportEligible = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState[message.state] === undefined ? message.state : $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.destroyTime != null && message.hasOwnProperty("destroyTime")) + object.destroyTime = $root.google.protobuf.Timestamp.toObject(message.destroyTime, options); + if (message.destroyEventTime != null && message.hasOwnProperty("destroyEventTime")) + object.destroyEventTime = $root.google.protobuf.Timestamp.toObject(message.destroyEventTime, options); + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + if (message.attestation != null && message.hasOwnProperty("attestation")) + object.attestation = $root.google.cloud.kms.v1.KeyOperationAttestation.toObject(message.attestation, options); + if (message.algorithm != null && message.hasOwnProperty("algorithm")) + object.algorithm = options.enums === String ? $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm[message.algorithm] === undefined ? message.algorithm : $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm[message.algorithm] : message.algorithm; + if (message.generateTime != null && message.hasOwnProperty("generateTime")) + object.generateTime = $root.google.protobuf.Timestamp.toObject(message.generateTime, options); + if (message.importJob != null && message.hasOwnProperty("importJob")) + object.importJob = message.importJob; + if (message.importTime != null && message.hasOwnProperty("importTime")) + object.importTime = $root.google.protobuf.Timestamp.toObject(message.importTime, options); + if (message.importFailureReason != null && message.hasOwnProperty("importFailureReason")) + object.importFailureReason = message.importFailureReason; + if (message.externalProtectionLevelOptions != null && message.hasOwnProperty("externalProtectionLevelOptions")) + object.externalProtectionLevelOptions = $root.google.cloud.kms.v1.ExternalProtectionLevelOptions.toObject(message.externalProtectionLevelOptions, options); + if (message.reimportEligible != null && message.hasOwnProperty("reimportEligible")) + object.reimportEligible = message.reimportEligible; + return object; + }; + + /** + * Converts this CryptoKeyVersion to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @instance + * @returns {Object.} JSON object + */ + CryptoKeyVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CryptoKeyVersion + * @function getTypeUrl + * @memberof google.cloud.kms.v1.CryptoKeyVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CryptoKeyVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.CryptoKeyVersion"; + }; + + /** + * CryptoKeyVersionAlgorithm enum. + * @name google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm + * @enum {number} + * @property {number} CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED=0 CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED value + * @property {number} GOOGLE_SYMMETRIC_ENCRYPTION=1 GOOGLE_SYMMETRIC_ENCRYPTION value + * @property {number} RSA_SIGN_PSS_2048_SHA256=2 RSA_SIGN_PSS_2048_SHA256 value + * @property {number} RSA_SIGN_PSS_3072_SHA256=3 RSA_SIGN_PSS_3072_SHA256 value + * @property {number} RSA_SIGN_PSS_4096_SHA256=4 RSA_SIGN_PSS_4096_SHA256 value + * @property {number} RSA_SIGN_PSS_4096_SHA512=15 RSA_SIGN_PSS_4096_SHA512 value + * @property {number} RSA_SIGN_PKCS1_2048_SHA256=5 RSA_SIGN_PKCS1_2048_SHA256 value + * @property {number} RSA_SIGN_PKCS1_3072_SHA256=6 RSA_SIGN_PKCS1_3072_SHA256 value + * @property {number} RSA_SIGN_PKCS1_4096_SHA256=7 RSA_SIGN_PKCS1_4096_SHA256 value + * @property {number} RSA_SIGN_PKCS1_4096_SHA512=16 RSA_SIGN_PKCS1_4096_SHA512 value + * @property {number} RSA_SIGN_RAW_PKCS1_2048=28 RSA_SIGN_RAW_PKCS1_2048 value + * @property {number} RSA_SIGN_RAW_PKCS1_3072=29 RSA_SIGN_RAW_PKCS1_3072 value + * @property {number} RSA_SIGN_RAW_PKCS1_4096=30 RSA_SIGN_RAW_PKCS1_4096 value + * @property {number} RSA_DECRYPT_OAEP_2048_SHA256=8 RSA_DECRYPT_OAEP_2048_SHA256 value + * @property {number} RSA_DECRYPT_OAEP_3072_SHA256=9 RSA_DECRYPT_OAEP_3072_SHA256 value + * @property {number} RSA_DECRYPT_OAEP_4096_SHA256=10 RSA_DECRYPT_OAEP_4096_SHA256 value + * @property {number} RSA_DECRYPT_OAEP_4096_SHA512=17 RSA_DECRYPT_OAEP_4096_SHA512 value + * @property {number} RSA_DECRYPT_OAEP_2048_SHA1=37 RSA_DECRYPT_OAEP_2048_SHA1 value + * @property {number} RSA_DECRYPT_OAEP_3072_SHA1=38 RSA_DECRYPT_OAEP_3072_SHA1 value + * @property {number} RSA_DECRYPT_OAEP_4096_SHA1=39 RSA_DECRYPT_OAEP_4096_SHA1 value + * @property {number} EC_SIGN_P256_SHA256=12 EC_SIGN_P256_SHA256 value + * @property {number} EC_SIGN_P384_SHA384=13 EC_SIGN_P384_SHA384 value + * @property {number} EC_SIGN_SECP256K1_SHA256=31 EC_SIGN_SECP256K1_SHA256 value + * @property {number} HMAC_SHA256=32 HMAC_SHA256 value + * @property {number} EXTERNAL_SYMMETRIC_ENCRYPTION=18 EXTERNAL_SYMMETRIC_ENCRYPTION value + */ + CryptoKeyVersion.CryptoKeyVersionAlgorithm = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED"] = 0; + values[valuesById[1] = "GOOGLE_SYMMETRIC_ENCRYPTION"] = 1; + values[valuesById[2] = "RSA_SIGN_PSS_2048_SHA256"] = 2; + values[valuesById[3] = "RSA_SIGN_PSS_3072_SHA256"] = 3; + values[valuesById[4] = "RSA_SIGN_PSS_4096_SHA256"] = 4; + values[valuesById[15] = "RSA_SIGN_PSS_4096_SHA512"] = 15; + values[valuesById[5] = "RSA_SIGN_PKCS1_2048_SHA256"] = 5; + values[valuesById[6] = "RSA_SIGN_PKCS1_3072_SHA256"] = 6; + values[valuesById[7] = "RSA_SIGN_PKCS1_4096_SHA256"] = 7; + values[valuesById[16] = "RSA_SIGN_PKCS1_4096_SHA512"] = 16; + values[valuesById[28] = "RSA_SIGN_RAW_PKCS1_2048"] = 28; + values[valuesById[29] = "RSA_SIGN_RAW_PKCS1_3072"] = 29; + values[valuesById[30] = "RSA_SIGN_RAW_PKCS1_4096"] = 30; + values[valuesById[8] = "RSA_DECRYPT_OAEP_2048_SHA256"] = 8; + values[valuesById[9] = "RSA_DECRYPT_OAEP_3072_SHA256"] = 9; + values[valuesById[10] = "RSA_DECRYPT_OAEP_4096_SHA256"] = 10; + values[valuesById[17] = "RSA_DECRYPT_OAEP_4096_SHA512"] = 17; + values[valuesById[37] = "RSA_DECRYPT_OAEP_2048_SHA1"] = 37; + values[valuesById[38] = "RSA_DECRYPT_OAEP_3072_SHA1"] = 38; + values[valuesById[39] = "RSA_DECRYPT_OAEP_4096_SHA1"] = 39; + values[valuesById[12] = "EC_SIGN_P256_SHA256"] = 12; + values[valuesById[13] = "EC_SIGN_P384_SHA384"] = 13; + values[valuesById[31] = "EC_SIGN_SECP256K1_SHA256"] = 31; + values[valuesById[32] = "HMAC_SHA256"] = 32; + values[valuesById[18] = "EXTERNAL_SYMMETRIC_ENCRYPTION"] = 18; + return values; + })(); + + /** + * CryptoKeyVersionState enum. + * @name google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState + * @enum {number} + * @property {number} CRYPTO_KEY_VERSION_STATE_UNSPECIFIED=0 CRYPTO_KEY_VERSION_STATE_UNSPECIFIED value + * @property {number} PENDING_GENERATION=5 PENDING_GENERATION value + * @property {number} ENABLED=1 ENABLED value + * @property {number} DISABLED=2 DISABLED value + * @property {number} DESTROYED=3 DESTROYED value + * @property {number} DESTROY_SCHEDULED=4 DESTROY_SCHEDULED value + * @property {number} PENDING_IMPORT=6 PENDING_IMPORT value + * @property {number} IMPORT_FAILED=7 IMPORT_FAILED value + */ + CryptoKeyVersion.CryptoKeyVersionState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED"] = 0; + values[valuesById[5] = "PENDING_GENERATION"] = 5; + values[valuesById[1] = "ENABLED"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + values[valuesById[3] = "DESTROYED"] = 3; + values[valuesById[4] = "DESTROY_SCHEDULED"] = 4; + values[valuesById[6] = "PENDING_IMPORT"] = 6; + values[valuesById[7] = "IMPORT_FAILED"] = 7; + return values; + })(); + + /** + * CryptoKeyVersionView enum. + * @name google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView + * @enum {number} + * @property {number} CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED=0 CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED value + * @property {number} FULL=1 FULL value + */ + CryptoKeyVersion.CryptoKeyVersionView = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED"] = 0; + values[valuesById[1] = "FULL"] = 1; + return values; + })(); + + return CryptoKeyVersion; + })(); + + v1.PublicKey = (function() { + + /** + * Properties of a PublicKey. + * @memberof google.cloud.kms.v1 + * @interface IPublicKey + * @property {string|null} [pem] PublicKey pem + * @property {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|null} [algorithm] PublicKey algorithm + * @property {google.protobuf.IInt64Value|null} [pemCrc32c] PublicKey pemCrc32c + * @property {string|null} [name] PublicKey name + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] PublicKey protectionLevel + */ + + /** + * Constructs a new PublicKey. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a PublicKey. + * @implements IPublicKey + * @constructor + * @param {google.cloud.kms.v1.IPublicKey=} [properties] Properties to set + */ + function PublicKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PublicKey pem. + * @member {string} pem + * @memberof google.cloud.kms.v1.PublicKey + * @instance + */ + PublicKey.prototype.pem = ""; + + /** + * PublicKey algorithm. + * @member {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} algorithm + * @memberof google.cloud.kms.v1.PublicKey + * @instance + */ + PublicKey.prototype.algorithm = 0; + + /** + * PublicKey pemCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} pemCrc32c + * @memberof google.cloud.kms.v1.PublicKey + * @instance + */ + PublicKey.prototype.pemCrc32c = null; + + /** + * PublicKey name. + * @member {string} name + * @memberof google.cloud.kms.v1.PublicKey + * @instance + */ + PublicKey.prototype.name = ""; + + /** + * PublicKey protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.PublicKey + * @instance + */ + PublicKey.prototype.protectionLevel = 0; + + /** + * Creates a new PublicKey instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {google.cloud.kms.v1.IPublicKey=} [properties] Properties to set + * @returns {google.cloud.kms.v1.PublicKey} PublicKey instance + */ + PublicKey.create = function create(properties) { + return new PublicKey(properties); + }; + + /** + * Encodes the specified PublicKey message. Does not implicitly {@link google.cloud.kms.v1.PublicKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {google.cloud.kms.v1.IPublicKey} message PublicKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PublicKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pem != null && Object.hasOwnProperty.call(message, "pem")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.pem); + if (message.algorithm != null && Object.hasOwnProperty.call(message, "algorithm")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.algorithm); + if (message.pemCrc32c != null && Object.hasOwnProperty.call(message, "pemCrc32c")) + $root.google.protobuf.Int64Value.encode(message.pemCrc32c, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.protectionLevel); + return writer; + }; + + /** + * Encodes the specified PublicKey message, length delimited. Does not implicitly {@link google.cloud.kms.v1.PublicKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {google.cloud.kms.v1.IPublicKey} message PublicKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PublicKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PublicKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.PublicKey} PublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PublicKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.PublicKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.pem = reader.string(); + break; + } + case 2: { + message.algorithm = reader.int32(); + break; + } + case 3: { + message.pemCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 4: { + message.name = reader.string(); + break; + } + case 5: { + message.protectionLevel = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PublicKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.PublicKey} PublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PublicKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PublicKey message. + * @function verify + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PublicKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pem != null && message.hasOwnProperty("pem")) + if (!$util.isString(message.pem)) + return "pem: string expected"; + if (message.algorithm != null && message.hasOwnProperty("algorithm")) + switch (message.algorithm) { + default: + return "algorithm: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 15: + case 5: + case 6: + case 7: + case 16: + case 28: + case 29: + case 30: + case 8: + case 9: + case 10: + case 17: + case 37: + case 38: + case 39: + case 12: + case 13: + case 31: + case 32: + case 18: + break; + } + if (message.pemCrc32c != null && message.hasOwnProperty("pemCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.pemCrc32c); + if (error) + return "pemCrc32c." + error; + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a PublicKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.PublicKey} PublicKey + */ + PublicKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.PublicKey) + return object; + var message = new $root.google.cloud.kms.v1.PublicKey(); + if (object.pem != null) + message.pem = String(object.pem); + switch (object.algorithm) { + default: + if (typeof object.algorithm === "number") { + message.algorithm = object.algorithm; + break; + } + break; + case "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED": + case 0: + message.algorithm = 0; + break; + case "GOOGLE_SYMMETRIC_ENCRYPTION": + case 1: + message.algorithm = 1; + break; + case "RSA_SIGN_PSS_2048_SHA256": + case 2: + message.algorithm = 2; + break; + case "RSA_SIGN_PSS_3072_SHA256": + case 3: + message.algorithm = 3; + break; + case "RSA_SIGN_PSS_4096_SHA256": + case 4: + message.algorithm = 4; + break; + case "RSA_SIGN_PSS_4096_SHA512": + case 15: + message.algorithm = 15; + break; + case "RSA_SIGN_PKCS1_2048_SHA256": + case 5: + message.algorithm = 5; + break; + case "RSA_SIGN_PKCS1_3072_SHA256": + case 6: + message.algorithm = 6; + break; + case "RSA_SIGN_PKCS1_4096_SHA256": + case 7: + message.algorithm = 7; + break; + case "RSA_SIGN_PKCS1_4096_SHA512": + case 16: + message.algorithm = 16; + break; + case "RSA_SIGN_RAW_PKCS1_2048": + case 28: + message.algorithm = 28; + break; + case "RSA_SIGN_RAW_PKCS1_3072": + case 29: + message.algorithm = 29; + break; + case "RSA_SIGN_RAW_PKCS1_4096": + case 30: + message.algorithm = 30; + break; + case "RSA_DECRYPT_OAEP_2048_SHA256": + case 8: + message.algorithm = 8; + break; + case "RSA_DECRYPT_OAEP_3072_SHA256": + case 9: + message.algorithm = 9; + break; + case "RSA_DECRYPT_OAEP_4096_SHA256": + case 10: + message.algorithm = 10; + break; + case "RSA_DECRYPT_OAEP_4096_SHA512": + case 17: + message.algorithm = 17; + break; + case "RSA_DECRYPT_OAEP_2048_SHA1": + case 37: + message.algorithm = 37; + break; + case "RSA_DECRYPT_OAEP_3072_SHA1": + case 38: + message.algorithm = 38; + break; + case "RSA_DECRYPT_OAEP_4096_SHA1": + case 39: + message.algorithm = 39; + break; + case "EC_SIGN_P256_SHA256": + case 12: + message.algorithm = 12; + break; + case "EC_SIGN_P384_SHA384": + case 13: + message.algorithm = 13; + break; + case "EC_SIGN_SECP256K1_SHA256": + case 31: + message.algorithm = 31; + break; + case "HMAC_SHA256": + case 32: + message.algorithm = 32; + break; + case "EXTERNAL_SYMMETRIC_ENCRYPTION": + case 18: + message.algorithm = 18; + break; + } + if (object.pemCrc32c != null) { + if (typeof object.pemCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.PublicKey.pemCrc32c: object expected"); + message.pemCrc32c = $root.google.protobuf.Int64Value.fromObject(object.pemCrc32c); + } + if (object.name != null) + message.name = String(object.name); + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a PublicKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {google.cloud.kms.v1.PublicKey} message PublicKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PublicKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pem = ""; + object.algorithm = options.enums === String ? "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" : 0; + object.pemCrc32c = null; + object.name = ""; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + } + if (message.pem != null && message.hasOwnProperty("pem")) + object.pem = message.pem; + if (message.algorithm != null && message.hasOwnProperty("algorithm")) + object.algorithm = options.enums === String ? $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm[message.algorithm] === undefined ? message.algorithm : $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm[message.algorithm] : message.algorithm; + if (message.pemCrc32c != null && message.hasOwnProperty("pemCrc32c")) + object.pemCrc32c = $root.google.protobuf.Int64Value.toObject(message.pemCrc32c, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + return object; + }; + + /** + * Converts this PublicKey to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.PublicKey + * @instance + * @returns {Object.} JSON object + */ + PublicKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PublicKey + * @function getTypeUrl + * @memberof google.cloud.kms.v1.PublicKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PublicKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.PublicKey"; + }; + + return PublicKey; + })(); + + v1.ImportJob = (function() { + + /** + * Properties of an ImportJob. + * @memberof google.cloud.kms.v1 + * @interface IImportJob + * @property {string|null} [name] ImportJob name + * @property {google.cloud.kms.v1.ImportJob.ImportMethod|null} [importMethod] ImportJob importMethod + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] ImportJob protectionLevel + * @property {google.protobuf.ITimestamp|null} [createTime] ImportJob createTime + * @property {google.protobuf.ITimestamp|null} [generateTime] ImportJob generateTime + * @property {google.protobuf.ITimestamp|null} [expireTime] ImportJob expireTime + * @property {google.protobuf.ITimestamp|null} [expireEventTime] ImportJob expireEventTime + * @property {google.cloud.kms.v1.ImportJob.ImportJobState|null} [state] ImportJob state + * @property {google.cloud.kms.v1.ImportJob.IWrappingPublicKey|null} [publicKey] ImportJob publicKey + * @property {google.cloud.kms.v1.IKeyOperationAttestation|null} [attestation] ImportJob attestation + */ + + /** + * Constructs a new ImportJob. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an ImportJob. + * @implements IImportJob + * @constructor + * @param {google.cloud.kms.v1.IImportJob=} [properties] Properties to set + */ + function ImportJob(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportJob name. + * @member {string} name + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.name = ""; + + /** + * ImportJob importMethod. + * @member {google.cloud.kms.v1.ImportJob.ImportMethod} importMethod + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.importMethod = 0; + + /** + * ImportJob protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.protectionLevel = 0; + + /** + * ImportJob createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.createTime = null; + + /** + * ImportJob generateTime. + * @member {google.protobuf.ITimestamp|null|undefined} generateTime + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.generateTime = null; + + /** + * ImportJob expireTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireTime + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.expireTime = null; + + /** + * ImportJob expireEventTime. + * @member {google.protobuf.ITimestamp|null|undefined} expireEventTime + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.expireEventTime = null; + + /** + * ImportJob state. + * @member {google.cloud.kms.v1.ImportJob.ImportJobState} state + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.state = 0; + + /** + * ImportJob publicKey. + * @member {google.cloud.kms.v1.ImportJob.IWrappingPublicKey|null|undefined} publicKey + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.publicKey = null; + + /** + * ImportJob attestation. + * @member {google.cloud.kms.v1.IKeyOperationAttestation|null|undefined} attestation + * @memberof google.cloud.kms.v1.ImportJob + * @instance + */ + ImportJob.prototype.attestation = null; + + /** + * Creates a new ImportJob instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {google.cloud.kms.v1.IImportJob=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ImportJob} ImportJob instance + */ + ImportJob.create = function create(properties) { + return new ImportJob(properties); + }; + + /** + * Encodes the specified ImportJob message. Does not implicitly {@link google.cloud.kms.v1.ImportJob.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {google.cloud.kms.v1.IImportJob} message ImportJob message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportJob.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.importMethod != null && Object.hasOwnProperty.call(message, "importMethod")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.importMethod); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.generateTime != null && Object.hasOwnProperty.call(message, "generateTime")) + $root.google.protobuf.Timestamp.encode(message.generateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime")) + $root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + $root.google.cloud.kms.v1.ImportJob.WrappingPublicKey.encode(message.publicKey, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.attestation != null && Object.hasOwnProperty.call(message, "attestation")) + $root.google.cloud.kms.v1.KeyOperationAttestation.encode(message.attestation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.protectionLevel); + if (message.expireEventTime != null && Object.hasOwnProperty.call(message, "expireEventTime")) + $root.google.protobuf.Timestamp.encode(message.expireEventTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportJob message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ImportJob.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {google.cloud.kms.v1.IImportJob} message ImportJob message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportJob.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportJob message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ImportJob} ImportJob + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportJob.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ImportJob(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.importMethod = reader.int32(); + break; + } + case 9: { + message.protectionLevel = reader.int32(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.generateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 10: { + message.expireEventTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.state = reader.int32(); + break; + } + case 7: { + message.publicKey = $root.google.cloud.kms.v1.ImportJob.WrappingPublicKey.decode(reader, reader.uint32()); + break; + } + case 8: { + message.attestation = $root.google.cloud.kms.v1.KeyOperationAttestation.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportJob message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ImportJob} ImportJob + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportJob.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportJob message. + * @function verify + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportJob.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.importMethod != null && message.hasOwnProperty("importMethod")) + switch (message.importMethod) { + default: + return "importMethod: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.generateTime != null && message.hasOwnProperty("generateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.generateTime); + if (error) + return "generateTime." + error; + } + if (message.expireTime != null && message.hasOwnProperty("expireTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expireTime); + if (error) + return "expireTime." + error; + } + if (message.expireEventTime != null && message.hasOwnProperty("expireEventTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expireEventTime); + if (error) + return "expireEventTime." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.publicKey != null && message.hasOwnProperty("publicKey")) { + var error = $root.google.cloud.kms.v1.ImportJob.WrappingPublicKey.verify(message.publicKey); + if (error) + return "publicKey." + error; + } + if (message.attestation != null && message.hasOwnProperty("attestation")) { + var error = $root.google.cloud.kms.v1.KeyOperationAttestation.verify(message.attestation); + if (error) + return "attestation." + error; + } + return null; + }; + + /** + * Creates an ImportJob message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ImportJob} ImportJob + */ + ImportJob.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ImportJob) + return object; + var message = new $root.google.cloud.kms.v1.ImportJob(); + if (object.name != null) + message.name = String(object.name); + switch (object.importMethod) { + default: + if (typeof object.importMethod === "number") { + message.importMethod = object.importMethod; + break; + } + break; + case "IMPORT_METHOD_UNSPECIFIED": + case 0: + message.importMethod = 0; + break; + case "RSA_OAEP_3072_SHA1_AES_256": + case 1: + message.importMethod = 1; + break; + case "RSA_OAEP_4096_SHA1_AES_256": + case 2: + message.importMethod = 2; + break; + } + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.kms.v1.ImportJob.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.generateTime != null) { + if (typeof object.generateTime !== "object") + throw TypeError(".google.cloud.kms.v1.ImportJob.generateTime: object expected"); + message.generateTime = $root.google.protobuf.Timestamp.fromObject(object.generateTime); + } + if (object.expireTime != null) { + if (typeof object.expireTime !== "object") + throw TypeError(".google.cloud.kms.v1.ImportJob.expireTime: object expected"); + message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime); + } + if (object.expireEventTime != null) { + if (typeof object.expireEventTime !== "object") + throw TypeError(".google.cloud.kms.v1.ImportJob.expireEventTime: object expected"); + message.expireEventTime = $root.google.protobuf.Timestamp.fromObject(object.expireEventTime); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "IMPORT_JOB_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "PENDING_GENERATION": + case 1: + message.state = 1; + break; + case "ACTIVE": + case 2: + message.state = 2; + break; + case "EXPIRED": + case 3: + message.state = 3; + break; + } + if (object.publicKey != null) { + if (typeof object.publicKey !== "object") + throw TypeError(".google.cloud.kms.v1.ImportJob.publicKey: object expected"); + message.publicKey = $root.google.cloud.kms.v1.ImportJob.WrappingPublicKey.fromObject(object.publicKey); + } + if (object.attestation != null) { + if (typeof object.attestation !== "object") + throw TypeError(".google.cloud.kms.v1.ImportJob.attestation: object expected"); + message.attestation = $root.google.cloud.kms.v1.KeyOperationAttestation.fromObject(object.attestation); + } + return message; + }; + + /** + * Creates a plain object from an ImportJob message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {google.cloud.kms.v1.ImportJob} message ImportJob + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportJob.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.importMethod = options.enums === String ? "IMPORT_METHOD_UNSPECIFIED" : 0; + object.createTime = null; + object.generateTime = null; + object.expireTime = null; + object.state = options.enums === String ? "IMPORT_JOB_STATE_UNSPECIFIED" : 0; + object.publicKey = null; + object.attestation = null; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + object.expireEventTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.importMethod != null && message.hasOwnProperty("importMethod")) + object.importMethod = options.enums === String ? $root.google.cloud.kms.v1.ImportJob.ImportMethod[message.importMethod] === undefined ? message.importMethod : $root.google.cloud.kms.v1.ImportJob.ImportMethod[message.importMethod] : message.importMethod; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.generateTime != null && message.hasOwnProperty("generateTime")) + object.generateTime = $root.google.protobuf.Timestamp.toObject(message.generateTime, options); + if (message.expireTime != null && message.hasOwnProperty("expireTime")) + object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.kms.v1.ImportJob.ImportJobState[message.state] === undefined ? message.state : $root.google.cloud.kms.v1.ImportJob.ImportJobState[message.state] : message.state; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = $root.google.cloud.kms.v1.ImportJob.WrappingPublicKey.toObject(message.publicKey, options); + if (message.attestation != null && message.hasOwnProperty("attestation")) + object.attestation = $root.google.cloud.kms.v1.KeyOperationAttestation.toObject(message.attestation, options); + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + if (message.expireEventTime != null && message.hasOwnProperty("expireEventTime")) + object.expireEventTime = $root.google.protobuf.Timestamp.toObject(message.expireEventTime, options); + return object; + }; + + /** + * Converts this ImportJob to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ImportJob + * @instance + * @returns {Object.} JSON object + */ + ImportJob.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportJob + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ImportJob + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportJob.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ImportJob"; + }; + + /** + * ImportMethod enum. + * @name google.cloud.kms.v1.ImportJob.ImportMethod + * @enum {number} + * @property {number} IMPORT_METHOD_UNSPECIFIED=0 IMPORT_METHOD_UNSPECIFIED value + * @property {number} RSA_OAEP_3072_SHA1_AES_256=1 RSA_OAEP_3072_SHA1_AES_256 value + * @property {number} RSA_OAEP_4096_SHA1_AES_256=2 RSA_OAEP_4096_SHA1_AES_256 value + */ + ImportJob.ImportMethod = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IMPORT_METHOD_UNSPECIFIED"] = 0; + values[valuesById[1] = "RSA_OAEP_3072_SHA1_AES_256"] = 1; + values[valuesById[2] = "RSA_OAEP_4096_SHA1_AES_256"] = 2; + return values; + })(); + + /** + * ImportJobState enum. + * @name google.cloud.kms.v1.ImportJob.ImportJobState + * @enum {number} + * @property {number} IMPORT_JOB_STATE_UNSPECIFIED=0 IMPORT_JOB_STATE_UNSPECIFIED value + * @property {number} PENDING_GENERATION=1 PENDING_GENERATION value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} EXPIRED=3 EXPIRED value + */ + ImportJob.ImportJobState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IMPORT_JOB_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PENDING_GENERATION"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "EXPIRED"] = 3; + return values; + })(); + + ImportJob.WrappingPublicKey = (function() { + + /** + * Properties of a WrappingPublicKey. + * @memberof google.cloud.kms.v1.ImportJob + * @interface IWrappingPublicKey + * @property {string|null} [pem] WrappingPublicKey pem + */ + + /** + * Constructs a new WrappingPublicKey. + * @memberof google.cloud.kms.v1.ImportJob + * @classdesc Represents a WrappingPublicKey. + * @implements IWrappingPublicKey + * @constructor + * @param {google.cloud.kms.v1.ImportJob.IWrappingPublicKey=} [properties] Properties to set + */ + function WrappingPublicKey(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WrappingPublicKey pem. + * @member {string} pem + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @instance + */ + WrappingPublicKey.prototype.pem = ""; + + /** + * Creates a new WrappingPublicKey instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {google.cloud.kms.v1.ImportJob.IWrappingPublicKey=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ImportJob.WrappingPublicKey} WrappingPublicKey instance + */ + WrappingPublicKey.create = function create(properties) { + return new WrappingPublicKey(properties); + }; + + /** + * Encodes the specified WrappingPublicKey message. Does not implicitly {@link google.cloud.kms.v1.ImportJob.WrappingPublicKey.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {google.cloud.kms.v1.ImportJob.IWrappingPublicKey} message WrappingPublicKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WrappingPublicKey.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pem != null && Object.hasOwnProperty.call(message, "pem")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.pem); + return writer; + }; + + /** + * Encodes the specified WrappingPublicKey message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ImportJob.WrappingPublicKey.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {google.cloud.kms.v1.ImportJob.IWrappingPublicKey} message WrappingPublicKey message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WrappingPublicKey.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WrappingPublicKey message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ImportJob.WrappingPublicKey} WrappingPublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WrappingPublicKey.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ImportJob.WrappingPublicKey(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.pem = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WrappingPublicKey message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ImportJob.WrappingPublicKey} WrappingPublicKey + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WrappingPublicKey.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WrappingPublicKey message. + * @function verify + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WrappingPublicKey.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pem != null && message.hasOwnProperty("pem")) + if (!$util.isString(message.pem)) + return "pem: string expected"; + return null; + }; + + /** + * Creates a WrappingPublicKey message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ImportJob.WrappingPublicKey} WrappingPublicKey + */ + WrappingPublicKey.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ImportJob.WrappingPublicKey) + return object; + var message = new $root.google.cloud.kms.v1.ImportJob.WrappingPublicKey(); + if (object.pem != null) + message.pem = String(object.pem); + return message; + }; + + /** + * Creates a plain object from a WrappingPublicKey message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {google.cloud.kms.v1.ImportJob.WrappingPublicKey} message WrappingPublicKey + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WrappingPublicKey.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.pem = ""; + if (message.pem != null && message.hasOwnProperty("pem")) + object.pem = message.pem; + return object; + }; + + /** + * Converts this WrappingPublicKey to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @instance + * @returns {Object.} JSON object + */ + WrappingPublicKey.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WrappingPublicKey + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ImportJob.WrappingPublicKey + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WrappingPublicKey.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ImportJob.WrappingPublicKey"; + }; + + return WrappingPublicKey; + })(); + + return ImportJob; + })(); + + v1.ExternalProtectionLevelOptions = (function() { + + /** + * Properties of an ExternalProtectionLevelOptions. + * @memberof google.cloud.kms.v1 + * @interface IExternalProtectionLevelOptions + * @property {string|null} [externalKeyUri] ExternalProtectionLevelOptions externalKeyUri + * @property {string|null} [ekmConnectionKeyPath] ExternalProtectionLevelOptions ekmConnectionKeyPath + */ + + /** + * Constructs a new ExternalProtectionLevelOptions. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an ExternalProtectionLevelOptions. + * @implements IExternalProtectionLevelOptions + * @constructor + * @param {google.cloud.kms.v1.IExternalProtectionLevelOptions=} [properties] Properties to set + */ + function ExternalProtectionLevelOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExternalProtectionLevelOptions externalKeyUri. + * @member {string} externalKeyUri + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @instance + */ + ExternalProtectionLevelOptions.prototype.externalKeyUri = ""; + + /** + * ExternalProtectionLevelOptions ekmConnectionKeyPath. + * @member {string} ekmConnectionKeyPath + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @instance + */ + ExternalProtectionLevelOptions.prototype.ekmConnectionKeyPath = ""; + + /** + * Creates a new ExternalProtectionLevelOptions instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {google.cloud.kms.v1.IExternalProtectionLevelOptions=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ExternalProtectionLevelOptions} ExternalProtectionLevelOptions instance + */ + ExternalProtectionLevelOptions.create = function create(properties) { + return new ExternalProtectionLevelOptions(properties); + }; + + /** + * Encodes the specified ExternalProtectionLevelOptions message. Does not implicitly {@link google.cloud.kms.v1.ExternalProtectionLevelOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {google.cloud.kms.v1.IExternalProtectionLevelOptions} message ExternalProtectionLevelOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalProtectionLevelOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.externalKeyUri != null && Object.hasOwnProperty.call(message, "externalKeyUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.externalKeyUri); + if (message.ekmConnectionKeyPath != null && Object.hasOwnProperty.call(message, "ekmConnectionKeyPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ekmConnectionKeyPath); + return writer; + }; + + /** + * Encodes the specified ExternalProtectionLevelOptions message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ExternalProtectionLevelOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {google.cloud.kms.v1.IExternalProtectionLevelOptions} message ExternalProtectionLevelOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalProtectionLevelOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExternalProtectionLevelOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ExternalProtectionLevelOptions} ExternalProtectionLevelOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalProtectionLevelOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ExternalProtectionLevelOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.externalKeyUri = reader.string(); + break; + } + case 2: { + message.ekmConnectionKeyPath = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExternalProtectionLevelOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ExternalProtectionLevelOptions} ExternalProtectionLevelOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalProtectionLevelOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExternalProtectionLevelOptions message. + * @function verify + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExternalProtectionLevelOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.externalKeyUri != null && message.hasOwnProperty("externalKeyUri")) + if (!$util.isString(message.externalKeyUri)) + return "externalKeyUri: string expected"; + if (message.ekmConnectionKeyPath != null && message.hasOwnProperty("ekmConnectionKeyPath")) + if (!$util.isString(message.ekmConnectionKeyPath)) + return "ekmConnectionKeyPath: string expected"; + return null; + }; + + /** + * Creates an ExternalProtectionLevelOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ExternalProtectionLevelOptions} ExternalProtectionLevelOptions + */ + ExternalProtectionLevelOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ExternalProtectionLevelOptions) + return object; + var message = new $root.google.cloud.kms.v1.ExternalProtectionLevelOptions(); + if (object.externalKeyUri != null) + message.externalKeyUri = String(object.externalKeyUri); + if (object.ekmConnectionKeyPath != null) + message.ekmConnectionKeyPath = String(object.ekmConnectionKeyPath); + return message; + }; + + /** + * Creates a plain object from an ExternalProtectionLevelOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {google.cloud.kms.v1.ExternalProtectionLevelOptions} message ExternalProtectionLevelOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExternalProtectionLevelOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.externalKeyUri = ""; + object.ekmConnectionKeyPath = ""; + } + if (message.externalKeyUri != null && message.hasOwnProperty("externalKeyUri")) + object.externalKeyUri = message.externalKeyUri; + if (message.ekmConnectionKeyPath != null && message.hasOwnProperty("ekmConnectionKeyPath")) + object.ekmConnectionKeyPath = message.ekmConnectionKeyPath; + return object; + }; + + /** + * Converts this ExternalProtectionLevelOptions to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @instance + * @returns {Object.} JSON object + */ + ExternalProtectionLevelOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExternalProtectionLevelOptions + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ExternalProtectionLevelOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExternalProtectionLevelOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ExternalProtectionLevelOptions"; + }; + + return ExternalProtectionLevelOptions; + })(); + + /** + * ProtectionLevel enum. + * @name google.cloud.kms.v1.ProtectionLevel + * @enum {number} + * @property {number} PROTECTION_LEVEL_UNSPECIFIED=0 PROTECTION_LEVEL_UNSPECIFIED value + * @property {number} SOFTWARE=1 SOFTWARE value + * @property {number} HSM=2 HSM value + * @property {number} EXTERNAL=3 EXTERNAL value + * @property {number} EXTERNAL_VPC=4 EXTERNAL_VPC value + */ + v1.ProtectionLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PROTECTION_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "SOFTWARE"] = 1; + values[valuesById[2] = "HSM"] = 2; + values[valuesById[3] = "EXTERNAL"] = 3; + values[valuesById[4] = "EXTERNAL_VPC"] = 4; + return values; + })(); + + v1.KeyManagementService = (function() { + + /** + * Constructs a new KeyManagementService service. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a KeyManagementService + * @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 KeyManagementService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (KeyManagementService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = KeyManagementService; + + /** + * Creates new KeyManagementService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.kms.v1.KeyManagementService + * @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 {KeyManagementService} RPC service. Useful where requests and/or responses are streamed. + */ + KeyManagementService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|listKeyRings}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef ListKeyRingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.ListKeyRingsResponse} [response] ListKeyRingsResponse + */ + + /** + * Calls ListKeyRings. + * @function listKeyRings + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IListKeyRingsRequest} request ListKeyRingsRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.ListKeyRingsCallback} callback Node-style callback called with the error, if any, and ListKeyRingsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.listKeyRings = function listKeyRings(request, callback) { + return this.rpcCall(listKeyRings, $root.google.cloud.kms.v1.ListKeyRingsRequest, $root.google.cloud.kms.v1.ListKeyRingsResponse, request, callback); + }, "name", { value: "ListKeyRings" }); + + /** + * Calls ListKeyRings. + * @function listKeyRings + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IListKeyRingsRequest} request ListKeyRingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|listCryptoKeys}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef ListCryptoKeysCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.ListCryptoKeysResponse} [response] ListCryptoKeysResponse + */ + + /** + * Calls ListCryptoKeys. + * @function listCryptoKeys + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IListCryptoKeysRequest} request ListCryptoKeysRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.ListCryptoKeysCallback} callback Node-style callback called with the error, if any, and ListCryptoKeysResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.listCryptoKeys = function listCryptoKeys(request, callback) { + return this.rpcCall(listCryptoKeys, $root.google.cloud.kms.v1.ListCryptoKeysRequest, $root.google.cloud.kms.v1.ListCryptoKeysResponse, request, callback); + }, "name", { value: "ListCryptoKeys" }); + + /** + * Calls ListCryptoKeys. + * @function listCryptoKeys + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IListCryptoKeysRequest} request ListCryptoKeysRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|listCryptoKeyVersions}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef ListCryptoKeyVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.ListCryptoKeyVersionsResponse} [response] ListCryptoKeyVersionsResponse + */ + + /** + * Calls ListCryptoKeyVersions. + * @function listCryptoKeyVersions + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsRequest} request ListCryptoKeyVersionsRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersionsCallback} callback Node-style callback called with the error, if any, and ListCryptoKeyVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.listCryptoKeyVersions = function listCryptoKeyVersions(request, callback) { + return this.rpcCall(listCryptoKeyVersions, $root.google.cloud.kms.v1.ListCryptoKeyVersionsRequest, $root.google.cloud.kms.v1.ListCryptoKeyVersionsResponse, request, callback); + }, "name", { value: "ListCryptoKeyVersions" }); + + /** + * Calls ListCryptoKeyVersions. + * @function listCryptoKeyVersions + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsRequest} request ListCryptoKeyVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|listImportJobs}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef ListImportJobsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.ListImportJobsResponse} [response] ListImportJobsResponse + */ + + /** + * Calls ListImportJobs. + * @function listImportJobs + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IListImportJobsRequest} request ListImportJobsRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.ListImportJobsCallback} callback Node-style callback called with the error, if any, and ListImportJobsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.listImportJobs = function listImportJobs(request, callback) { + return this.rpcCall(listImportJobs, $root.google.cloud.kms.v1.ListImportJobsRequest, $root.google.cloud.kms.v1.ListImportJobsResponse, request, callback); + }, "name", { value: "ListImportJobs" }); + + /** + * Calls ListImportJobs. + * @function listImportJobs + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IListImportJobsRequest} request ListImportJobsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getKeyRing}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef GetKeyRingCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.KeyRing} [response] KeyRing + */ + + /** + * Calls GetKeyRing. + * @function getKeyRing + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetKeyRingRequest} request GetKeyRingRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.GetKeyRingCallback} callback Node-style callback called with the error, if any, and KeyRing + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.getKeyRing = function getKeyRing(request, callback) { + return this.rpcCall(getKeyRing, $root.google.cloud.kms.v1.GetKeyRingRequest, $root.google.cloud.kms.v1.KeyRing, request, callback); + }, "name", { value: "GetKeyRing" }); + + /** + * Calls GetKeyRing. + * @function getKeyRing + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetKeyRingRequest} request GetKeyRingRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getCryptoKey}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef GetCryptoKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKey} [response] CryptoKey + */ + + /** + * Calls GetCryptoKey. + * @function getCryptoKey + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetCryptoKeyRequest} request GetCryptoKeyRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.GetCryptoKeyCallback} callback Node-style callback called with the error, if any, and CryptoKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.getCryptoKey = function getCryptoKey(request, callback) { + return this.rpcCall(getCryptoKey, $root.google.cloud.kms.v1.GetCryptoKeyRequest, $root.google.cloud.kms.v1.CryptoKey, request, callback); + }, "name", { value: "GetCryptoKey" }); + + /** + * Calls GetCryptoKey. + * @function getCryptoKey + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetCryptoKeyRequest} request GetCryptoKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getCryptoKeyVersion}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef GetCryptoKeyVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKeyVersion} [response] CryptoKeyVersion + */ + + /** + * Calls GetCryptoKeyVersion. + * @function getCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetCryptoKeyVersionRequest} request GetCryptoKeyVersionRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersionCallback} callback Node-style callback called with the error, if any, and CryptoKeyVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.getCryptoKeyVersion = function getCryptoKeyVersion(request, callback) { + return this.rpcCall(getCryptoKeyVersion, $root.google.cloud.kms.v1.GetCryptoKeyVersionRequest, $root.google.cloud.kms.v1.CryptoKeyVersion, request, callback); + }, "name", { value: "GetCryptoKeyVersion" }); + + /** + * Calls GetCryptoKeyVersion. + * @function getCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetCryptoKeyVersionRequest} request GetCryptoKeyVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getPublicKey}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef GetPublicKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.PublicKey} [response] PublicKey + */ + + /** + * Calls GetPublicKey. + * @function getPublicKey + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetPublicKeyRequest} request GetPublicKeyRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.GetPublicKeyCallback} callback Node-style callback called with the error, if any, and PublicKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.getPublicKey = function getPublicKey(request, callback) { + return this.rpcCall(getPublicKey, $root.google.cloud.kms.v1.GetPublicKeyRequest, $root.google.cloud.kms.v1.PublicKey, request, callback); + }, "name", { value: "GetPublicKey" }); + + /** + * Calls GetPublicKey. + * @function getPublicKey + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetPublicKeyRequest} request GetPublicKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|getImportJob}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef GetImportJobCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.ImportJob} [response] ImportJob + */ + + /** + * Calls GetImportJob. + * @function getImportJob + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetImportJobRequest} request GetImportJobRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.GetImportJobCallback} callback Node-style callback called with the error, if any, and ImportJob + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.getImportJob = function getImportJob(request, callback) { + return this.rpcCall(getImportJob, $root.google.cloud.kms.v1.GetImportJobRequest, $root.google.cloud.kms.v1.ImportJob, request, callback); + }, "name", { value: "GetImportJob" }); + + /** + * Calls GetImportJob. + * @function getImportJob + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGetImportJobRequest} request GetImportJobRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|createKeyRing}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef CreateKeyRingCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.KeyRing} [response] KeyRing + */ + + /** + * Calls CreateKeyRing. + * @function createKeyRing + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.ICreateKeyRingRequest} request CreateKeyRingRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.CreateKeyRingCallback} callback Node-style callback called with the error, if any, and KeyRing + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.createKeyRing = function createKeyRing(request, callback) { + return this.rpcCall(createKeyRing, $root.google.cloud.kms.v1.CreateKeyRingRequest, $root.google.cloud.kms.v1.KeyRing, request, callback); + }, "name", { value: "CreateKeyRing" }); + + /** + * Calls CreateKeyRing. + * @function createKeyRing + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.ICreateKeyRingRequest} request CreateKeyRingRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|createCryptoKey}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef CreateCryptoKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKey} [response] CryptoKey + */ + + /** + * Calls CreateCryptoKey. + * @function createCryptoKey + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.ICreateCryptoKeyRequest} request CreateCryptoKeyRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyCallback} callback Node-style callback called with the error, if any, and CryptoKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.createCryptoKey = function createCryptoKey(request, callback) { + return this.rpcCall(createCryptoKey, $root.google.cloud.kms.v1.CreateCryptoKeyRequest, $root.google.cloud.kms.v1.CryptoKey, request, callback); + }, "name", { value: "CreateCryptoKey" }); + + /** + * Calls CreateCryptoKey. + * @function createCryptoKey + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.ICreateCryptoKeyRequest} request CreateCryptoKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|createCryptoKeyVersion}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef CreateCryptoKeyVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKeyVersion} [response] CryptoKeyVersion + */ + + /** + * Calls CreateCryptoKeyVersion. + * @function createCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.ICreateCryptoKeyVersionRequest} request CreateCryptoKeyVersionRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersionCallback} callback Node-style callback called with the error, if any, and CryptoKeyVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.createCryptoKeyVersion = function createCryptoKeyVersion(request, callback) { + return this.rpcCall(createCryptoKeyVersion, $root.google.cloud.kms.v1.CreateCryptoKeyVersionRequest, $root.google.cloud.kms.v1.CryptoKeyVersion, request, callback); + }, "name", { value: "CreateCryptoKeyVersion" }); + + /** + * Calls CreateCryptoKeyVersion. + * @function createCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.ICreateCryptoKeyVersionRequest} request CreateCryptoKeyVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|importCryptoKeyVersion}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef ImportCryptoKeyVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKeyVersion} [response] CryptoKeyVersion + */ + + /** + * Calls ImportCryptoKeyVersion. + * @function importCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IImportCryptoKeyVersionRequest} request ImportCryptoKeyVersionRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersionCallback} callback Node-style callback called with the error, if any, and CryptoKeyVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.importCryptoKeyVersion = function importCryptoKeyVersion(request, callback) { + return this.rpcCall(importCryptoKeyVersion, $root.google.cloud.kms.v1.ImportCryptoKeyVersionRequest, $root.google.cloud.kms.v1.CryptoKeyVersion, request, callback); + }, "name", { value: "ImportCryptoKeyVersion" }); + + /** + * Calls ImportCryptoKeyVersion. + * @function importCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IImportCryptoKeyVersionRequest} request ImportCryptoKeyVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|createImportJob}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef CreateImportJobCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.ImportJob} [response] ImportJob + */ + + /** + * Calls CreateImportJob. + * @function createImportJob + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.ICreateImportJobRequest} request CreateImportJobRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.CreateImportJobCallback} callback Node-style callback called with the error, if any, and ImportJob + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.createImportJob = function createImportJob(request, callback) { + return this.rpcCall(createImportJob, $root.google.cloud.kms.v1.CreateImportJobRequest, $root.google.cloud.kms.v1.ImportJob, request, callback); + }, "name", { value: "CreateImportJob" }); + + /** + * Calls CreateImportJob. + * @function createImportJob + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.ICreateImportJobRequest} request CreateImportJobRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|updateCryptoKey}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef UpdateCryptoKeyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKey} [response] CryptoKey + */ + + /** + * Calls UpdateCryptoKey. + * @function updateCryptoKey + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IUpdateCryptoKeyRequest} request UpdateCryptoKeyRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyCallback} callback Node-style callback called with the error, if any, and CryptoKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.updateCryptoKey = function updateCryptoKey(request, callback) { + return this.rpcCall(updateCryptoKey, $root.google.cloud.kms.v1.UpdateCryptoKeyRequest, $root.google.cloud.kms.v1.CryptoKey, request, callback); + }, "name", { value: "UpdateCryptoKey" }); + + /** + * Calls UpdateCryptoKey. + * @function updateCryptoKey + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IUpdateCryptoKeyRequest} request UpdateCryptoKeyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|updateCryptoKeyVersion}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef UpdateCryptoKeyVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKeyVersion} [response] CryptoKeyVersion + */ + + /** + * Calls UpdateCryptoKeyVersion. + * @function updateCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest} request UpdateCryptoKeyVersionRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersionCallback} callback Node-style callback called with the error, if any, and CryptoKeyVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.updateCryptoKeyVersion = function updateCryptoKeyVersion(request, callback) { + return this.rpcCall(updateCryptoKeyVersion, $root.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest, $root.google.cloud.kms.v1.CryptoKeyVersion, request, callback); + }, "name", { value: "UpdateCryptoKeyVersion" }); + + /** + * Calls UpdateCryptoKeyVersion. + * @function updateCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest} request UpdateCryptoKeyVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|updateCryptoKeyPrimaryVersion}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef UpdateCryptoKeyPrimaryVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKey} [response] CryptoKey + */ + + /** + * Calls UpdateCryptoKeyPrimaryVersion. + * @function updateCryptoKeyPrimaryVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest} request UpdateCryptoKeyPrimaryVersionRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersionCallback} callback Node-style callback called with the error, if any, and CryptoKey + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.updateCryptoKeyPrimaryVersion = function updateCryptoKeyPrimaryVersion(request, callback) { + return this.rpcCall(updateCryptoKeyPrimaryVersion, $root.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest, $root.google.cloud.kms.v1.CryptoKey, request, callback); + }, "name", { value: "UpdateCryptoKeyPrimaryVersion" }); + + /** + * Calls UpdateCryptoKeyPrimaryVersion. + * @function updateCryptoKeyPrimaryVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest} request UpdateCryptoKeyPrimaryVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|destroyCryptoKeyVersion}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef DestroyCryptoKeyVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKeyVersion} [response] CryptoKeyVersion + */ + + /** + * Calls DestroyCryptoKeyVersion. + * @function destroyCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest} request DestroyCryptoKeyVersionRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersionCallback} callback Node-style callback called with the error, if any, and CryptoKeyVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.destroyCryptoKeyVersion = function destroyCryptoKeyVersion(request, callback) { + return this.rpcCall(destroyCryptoKeyVersion, $root.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest, $root.google.cloud.kms.v1.CryptoKeyVersion, request, callback); + }, "name", { value: "DestroyCryptoKeyVersion" }); + + /** + * Calls DestroyCryptoKeyVersion. + * @function destroyCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest} request DestroyCryptoKeyVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|restoreCryptoKeyVersion}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef RestoreCryptoKeyVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.CryptoKeyVersion} [response] CryptoKeyVersion + */ + + /** + * Calls RestoreCryptoKeyVersion. + * @function restoreCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest} request RestoreCryptoKeyVersionRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersionCallback} callback Node-style callback called with the error, if any, and CryptoKeyVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.restoreCryptoKeyVersion = function restoreCryptoKeyVersion(request, callback) { + return this.rpcCall(restoreCryptoKeyVersion, $root.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest, $root.google.cloud.kms.v1.CryptoKeyVersion, request, callback); + }, "name", { value: "RestoreCryptoKeyVersion" }); + + /** + * Calls RestoreCryptoKeyVersion. + * @function restoreCryptoKeyVersion + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest} request RestoreCryptoKeyVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|encrypt}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef EncryptCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.EncryptResponse} [response] EncryptResponse + */ + + /** + * Calls Encrypt. + * @function encrypt + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IEncryptRequest} request EncryptRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.EncryptCallback} callback Node-style callback called with the error, if any, and EncryptResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.encrypt = function encrypt(request, callback) { + return this.rpcCall(encrypt, $root.google.cloud.kms.v1.EncryptRequest, $root.google.cloud.kms.v1.EncryptResponse, request, callback); + }, "name", { value: "Encrypt" }); + + /** + * Calls Encrypt. + * @function encrypt + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IEncryptRequest} request EncryptRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|decrypt}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef DecryptCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.DecryptResponse} [response] DecryptResponse + */ + + /** + * Calls Decrypt. + * @function decrypt + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IDecryptRequest} request DecryptRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.DecryptCallback} callback Node-style callback called with the error, if any, and DecryptResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.decrypt = function decrypt(request, callback) { + return this.rpcCall(decrypt, $root.google.cloud.kms.v1.DecryptRequest, $root.google.cloud.kms.v1.DecryptResponse, request, callback); + }, "name", { value: "Decrypt" }); + + /** + * Calls Decrypt. + * @function decrypt + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IDecryptRequest} request DecryptRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|asymmetricSign}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef AsymmetricSignCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.AsymmetricSignResponse} [response] AsymmetricSignResponse + */ + + /** + * Calls AsymmetricSign. + * @function asymmetricSign + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IAsymmetricSignRequest} request AsymmetricSignRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.AsymmetricSignCallback} callback Node-style callback called with the error, if any, and AsymmetricSignResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.asymmetricSign = function asymmetricSign(request, callback) { + return this.rpcCall(asymmetricSign, $root.google.cloud.kms.v1.AsymmetricSignRequest, $root.google.cloud.kms.v1.AsymmetricSignResponse, request, callback); + }, "name", { value: "AsymmetricSign" }); + + /** + * Calls AsymmetricSign. + * @function asymmetricSign + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IAsymmetricSignRequest} request AsymmetricSignRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|asymmetricDecrypt}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef AsymmetricDecryptCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.AsymmetricDecryptResponse} [response] AsymmetricDecryptResponse + */ + + /** + * Calls AsymmetricDecrypt. + * @function asymmetricDecrypt + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IAsymmetricDecryptRequest} request AsymmetricDecryptRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.AsymmetricDecryptCallback} callback Node-style callback called with the error, if any, and AsymmetricDecryptResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.asymmetricDecrypt = function asymmetricDecrypt(request, callback) { + return this.rpcCall(asymmetricDecrypt, $root.google.cloud.kms.v1.AsymmetricDecryptRequest, $root.google.cloud.kms.v1.AsymmetricDecryptResponse, request, callback); + }, "name", { value: "AsymmetricDecrypt" }); + + /** + * Calls AsymmetricDecrypt. + * @function asymmetricDecrypt + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IAsymmetricDecryptRequest} request AsymmetricDecryptRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|macSign}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef MacSignCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.MacSignResponse} [response] MacSignResponse + */ + + /** + * Calls MacSign. + * @function macSign + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IMacSignRequest} request MacSignRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.MacSignCallback} callback Node-style callback called with the error, if any, and MacSignResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.macSign = function macSign(request, callback) { + return this.rpcCall(macSign, $root.google.cloud.kms.v1.MacSignRequest, $root.google.cloud.kms.v1.MacSignResponse, request, callback); + }, "name", { value: "MacSign" }); + + /** + * Calls MacSign. + * @function macSign + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IMacSignRequest} request MacSignRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|macVerify}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef MacVerifyCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.MacVerifyResponse} [response] MacVerifyResponse + */ + + /** + * Calls MacVerify. + * @function macVerify + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IMacVerifyRequest} request MacVerifyRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.MacVerifyCallback} callback Node-style callback called with the error, if any, and MacVerifyResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.macVerify = function macVerify(request, callback) { + return this.rpcCall(macVerify, $root.google.cloud.kms.v1.MacVerifyRequest, $root.google.cloud.kms.v1.MacVerifyResponse, request, callback); + }, "name", { value: "MacVerify" }); + + /** + * Calls MacVerify. + * @function macVerify + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IMacVerifyRequest} request MacVerifyRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.kms.v1.KeyManagementService|generateRandomBytes}. + * @memberof google.cloud.kms.v1.KeyManagementService + * @typedef GenerateRandomBytesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.kms.v1.GenerateRandomBytesResponse} [response] GenerateRandomBytesResponse + */ + + /** + * Calls GenerateRandomBytes. + * @function generateRandomBytes + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGenerateRandomBytesRequest} request GenerateRandomBytesRequest message or plain object + * @param {google.cloud.kms.v1.KeyManagementService.GenerateRandomBytesCallback} callback Node-style callback called with the error, if any, and GenerateRandomBytesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KeyManagementService.prototype.generateRandomBytes = function generateRandomBytes(request, callback) { + return this.rpcCall(generateRandomBytes, $root.google.cloud.kms.v1.GenerateRandomBytesRequest, $root.google.cloud.kms.v1.GenerateRandomBytesResponse, request, callback); + }, "name", { value: "GenerateRandomBytes" }); + + /** + * Calls GenerateRandomBytes. + * @function generateRandomBytes + * @memberof google.cloud.kms.v1.KeyManagementService + * @instance + * @param {google.cloud.kms.v1.IGenerateRandomBytesRequest} request GenerateRandomBytesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return KeyManagementService; + })(); + + v1.ListKeyRingsRequest = (function() { + + /** + * Properties of a ListKeyRingsRequest. + * @memberof google.cloud.kms.v1 + * @interface IListKeyRingsRequest + * @property {string|null} [parent] ListKeyRingsRequest parent + * @property {number|null} [pageSize] ListKeyRingsRequest pageSize + * @property {string|null} [pageToken] ListKeyRingsRequest pageToken + * @property {string|null} [filter] ListKeyRingsRequest filter + * @property {string|null} [orderBy] ListKeyRingsRequest orderBy + */ + + /** + * Constructs a new ListKeyRingsRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListKeyRingsRequest. + * @implements IListKeyRingsRequest + * @constructor + * @param {google.cloud.kms.v1.IListKeyRingsRequest=} [properties] Properties to set + */ + function ListKeyRingsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKeyRingsRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @instance + */ + ListKeyRingsRequest.prototype.parent = ""; + + /** + * ListKeyRingsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @instance + */ + ListKeyRingsRequest.prototype.pageSize = 0; + + /** + * ListKeyRingsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @instance + */ + ListKeyRingsRequest.prototype.pageToken = ""; + + /** + * ListKeyRingsRequest filter. + * @member {string} filter + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @instance + */ + ListKeyRingsRequest.prototype.filter = ""; + + /** + * ListKeyRingsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @instance + */ + ListKeyRingsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListKeyRingsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {google.cloud.kms.v1.IListKeyRingsRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListKeyRingsRequest} ListKeyRingsRequest instance + */ + ListKeyRingsRequest.create = function create(properties) { + return new ListKeyRingsRequest(properties); + }; + + /** + * Encodes the specified ListKeyRingsRequest message. Does not implicitly {@link google.cloud.kms.v1.ListKeyRingsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {google.cloud.kms.v1.IListKeyRingsRequest} message ListKeyRingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeyRingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListKeyRingsRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListKeyRingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {google.cloud.kms.v1.IListKeyRingsRequest} message ListKeyRingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeyRingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKeyRingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListKeyRingsRequest} ListKeyRingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeyRingsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListKeyRingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKeyRingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListKeyRingsRequest} ListKeyRingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeyRingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKeyRingsRequest message. + * @function verify + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKeyRingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListKeyRingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListKeyRingsRequest} ListKeyRingsRequest + */ + ListKeyRingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListKeyRingsRequest) + return object; + var message = new $root.google.cloud.kms.v1.ListKeyRingsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListKeyRingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {google.cloud.kms.v1.ListKeyRingsRequest} message ListKeyRingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKeyRingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListKeyRingsRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @instance + * @returns {Object.} JSON object + */ + ListKeyRingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKeyRingsRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListKeyRingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKeyRingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListKeyRingsRequest"; + }; + + return ListKeyRingsRequest; + })(); + + v1.ListCryptoKeysRequest = (function() { + + /** + * Properties of a ListCryptoKeysRequest. + * @memberof google.cloud.kms.v1 + * @interface IListCryptoKeysRequest + * @property {string|null} [parent] ListCryptoKeysRequest parent + * @property {number|null} [pageSize] ListCryptoKeysRequest pageSize + * @property {string|null} [pageToken] ListCryptoKeysRequest pageToken + * @property {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView|null} [versionView] ListCryptoKeysRequest versionView + * @property {string|null} [filter] ListCryptoKeysRequest filter + * @property {string|null} [orderBy] ListCryptoKeysRequest orderBy + */ + + /** + * Constructs a new ListCryptoKeysRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListCryptoKeysRequest. + * @implements IListCryptoKeysRequest + * @constructor + * @param {google.cloud.kms.v1.IListCryptoKeysRequest=} [properties] Properties to set + */ + function ListCryptoKeysRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCryptoKeysRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @instance + */ + ListCryptoKeysRequest.prototype.parent = ""; + + /** + * ListCryptoKeysRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @instance + */ + ListCryptoKeysRequest.prototype.pageSize = 0; + + /** + * ListCryptoKeysRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @instance + */ + ListCryptoKeysRequest.prototype.pageToken = ""; + + /** + * ListCryptoKeysRequest versionView. + * @member {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} versionView + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @instance + */ + ListCryptoKeysRequest.prototype.versionView = 0; + + /** + * ListCryptoKeysRequest filter. + * @member {string} filter + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @instance + */ + ListCryptoKeysRequest.prototype.filter = ""; + + /** + * ListCryptoKeysRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @instance + */ + ListCryptoKeysRequest.prototype.orderBy = ""; + + /** + * Creates a new ListCryptoKeysRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {google.cloud.kms.v1.IListCryptoKeysRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListCryptoKeysRequest} ListCryptoKeysRequest instance + */ + ListCryptoKeysRequest.create = function create(properties) { + return new ListCryptoKeysRequest(properties); + }; + + /** + * Encodes the specified ListCryptoKeysRequest message. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeysRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {google.cloud.kms.v1.IListCryptoKeysRequest} message ListCryptoKeysRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCryptoKeysRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.versionView != null && Object.hasOwnProperty.call(message, "versionView")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.versionView); + 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 ListCryptoKeysRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeysRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {google.cloud.kms.v1.IListCryptoKeysRequest} message ListCryptoKeysRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCryptoKeysRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCryptoKeysRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListCryptoKeysRequest} ListCryptoKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCryptoKeysRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListCryptoKeysRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.versionView = reader.int32(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCryptoKeysRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListCryptoKeysRequest} ListCryptoKeysRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCryptoKeysRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCryptoKeysRequest message. + * @function verify + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCryptoKeysRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.versionView != null && message.hasOwnProperty("versionView")) + switch (message.versionView) { + default: + return "versionView: enum value expected"; + case 0: + case 1: + break; + } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListCryptoKeysRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListCryptoKeysRequest} ListCryptoKeysRequest + */ + ListCryptoKeysRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListCryptoKeysRequest) + return object; + var message = new $root.google.cloud.kms.v1.ListCryptoKeysRequest(); + 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); + switch (object.versionView) { + default: + if (typeof object.versionView === "number") { + message.versionView = object.versionView; + break; + } + break; + case "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED": + case 0: + message.versionView = 0; + break; + case "FULL": + case 1: + message.versionView = 1; + break; + } + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListCryptoKeysRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {google.cloud.kms.v1.ListCryptoKeysRequest} message ListCryptoKeysRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCryptoKeysRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.versionView = options.enums === String ? "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" : 0; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.versionView != null && message.hasOwnProperty("versionView")) + object.versionView = options.enums === String ? $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView[message.versionView] === undefined ? message.versionView : $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView[message.versionView] : message.versionView; + 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 ListCryptoKeysRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @instance + * @returns {Object.} JSON object + */ + ListCryptoKeysRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListCryptoKeysRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListCryptoKeysRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCryptoKeysRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListCryptoKeysRequest"; + }; + + return ListCryptoKeysRequest; + })(); + + v1.ListCryptoKeyVersionsRequest = (function() { + + /** + * Properties of a ListCryptoKeyVersionsRequest. + * @memberof google.cloud.kms.v1 + * @interface IListCryptoKeyVersionsRequest + * @property {string|null} [parent] ListCryptoKeyVersionsRequest parent + * @property {number|null} [pageSize] ListCryptoKeyVersionsRequest pageSize + * @property {string|null} [pageToken] ListCryptoKeyVersionsRequest pageToken + * @property {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView|null} [view] ListCryptoKeyVersionsRequest view + * @property {string|null} [filter] ListCryptoKeyVersionsRequest filter + * @property {string|null} [orderBy] ListCryptoKeyVersionsRequest orderBy + */ + + /** + * Constructs a new ListCryptoKeyVersionsRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListCryptoKeyVersionsRequest. + * @implements IListCryptoKeyVersionsRequest + * @constructor + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsRequest=} [properties] Properties to set + */ + function ListCryptoKeyVersionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCryptoKeyVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @instance + */ + ListCryptoKeyVersionsRequest.prototype.parent = ""; + + /** + * ListCryptoKeyVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @instance + */ + ListCryptoKeyVersionsRequest.prototype.pageSize = 0; + + /** + * ListCryptoKeyVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @instance + */ + ListCryptoKeyVersionsRequest.prototype.pageToken = ""; + + /** + * ListCryptoKeyVersionsRequest view. + * @member {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} view + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @instance + */ + ListCryptoKeyVersionsRequest.prototype.view = 0; + + /** + * ListCryptoKeyVersionsRequest filter. + * @member {string} filter + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @instance + */ + ListCryptoKeyVersionsRequest.prototype.filter = ""; + + /** + * ListCryptoKeyVersionsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @instance + */ + ListCryptoKeyVersionsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListCryptoKeyVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListCryptoKeyVersionsRequest} ListCryptoKeyVersionsRequest instance + */ + ListCryptoKeyVersionsRequest.create = function create(properties) { + return new ListCryptoKeyVersionsRequest(properties); + }; + + /** + * Encodes the specified ListCryptoKeyVersionsRequest message. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeyVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsRequest} message ListCryptoKeyVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCryptoKeyVersionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.view != null && Object.hasOwnProperty.call(message, "view")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.view); + 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 ListCryptoKeyVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeyVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsRequest} message ListCryptoKeyVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCryptoKeyVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCryptoKeyVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListCryptoKeyVersionsRequest} ListCryptoKeyVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCryptoKeyVersionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListCryptoKeyVersionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.view = reader.int32(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 6: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListCryptoKeyVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListCryptoKeyVersionsRequest} ListCryptoKeyVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCryptoKeyVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCryptoKeyVersionsRequest message. + * @function verify + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCryptoKeyVersionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.view != null && message.hasOwnProperty("view")) + switch (message.view) { + default: + return "view: enum value expected"; + case 0: + case 1: + break; + } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListCryptoKeyVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListCryptoKeyVersionsRequest} ListCryptoKeyVersionsRequest + */ + ListCryptoKeyVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListCryptoKeyVersionsRequest) + return object; + var message = new $root.google.cloud.kms.v1.ListCryptoKeyVersionsRequest(); + 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); + switch (object.view) { + default: + if (typeof object.view === "number") { + message.view = object.view; + break; + } + break; + case "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED": + case 0: + message.view = 0; + break; + case "FULL": + case 1: + message.view = 1; + break; + } + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListCryptoKeyVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {google.cloud.kms.v1.ListCryptoKeyVersionsRequest} message ListCryptoKeyVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCryptoKeyVersionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.view = options.enums === String ? "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" : 0; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.view != null && message.hasOwnProperty("view")) + object.view = options.enums === String ? $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView[message.view] === undefined ? message.view : $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView[message.view] : message.view; + 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 ListCryptoKeyVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListCryptoKeyVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListCryptoKeyVersionsRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCryptoKeyVersionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"; + }; + + return ListCryptoKeyVersionsRequest; + })(); + + v1.ListImportJobsRequest = (function() { + + /** + * Properties of a ListImportJobsRequest. + * @memberof google.cloud.kms.v1 + * @interface IListImportJobsRequest + * @property {string|null} [parent] ListImportJobsRequest parent + * @property {number|null} [pageSize] ListImportJobsRequest pageSize + * @property {string|null} [pageToken] ListImportJobsRequest pageToken + * @property {string|null} [filter] ListImportJobsRequest filter + * @property {string|null} [orderBy] ListImportJobsRequest orderBy + */ + + /** + * Constructs a new ListImportJobsRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListImportJobsRequest. + * @implements IListImportJobsRequest + * @constructor + * @param {google.cloud.kms.v1.IListImportJobsRequest=} [properties] Properties to set + */ + function ListImportJobsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListImportJobsRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @instance + */ + ListImportJobsRequest.prototype.parent = ""; + + /** + * ListImportJobsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @instance + */ + ListImportJobsRequest.prototype.pageSize = 0; + + /** + * ListImportJobsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @instance + */ + ListImportJobsRequest.prototype.pageToken = ""; + + /** + * ListImportJobsRequest filter. + * @member {string} filter + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @instance + */ + ListImportJobsRequest.prototype.filter = ""; + + /** + * ListImportJobsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @instance + */ + ListImportJobsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListImportJobsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {google.cloud.kms.v1.IListImportJobsRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListImportJobsRequest} ListImportJobsRequest instance + */ + ListImportJobsRequest.create = function create(properties) { + return new ListImportJobsRequest(properties); + }; + + /** + * Encodes the specified ListImportJobsRequest message. Does not implicitly {@link google.cloud.kms.v1.ListImportJobsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {google.cloud.kms.v1.IListImportJobsRequest} message ListImportJobsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListImportJobsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListImportJobsRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListImportJobsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {google.cloud.kms.v1.IListImportJobsRequest} message ListImportJobsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListImportJobsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListImportJobsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListImportJobsRequest} ListImportJobsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListImportJobsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListImportJobsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListImportJobsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListImportJobsRequest} ListImportJobsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListImportJobsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListImportJobsRequest message. + * @function verify + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListImportJobsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListImportJobsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListImportJobsRequest} ListImportJobsRequest + */ + ListImportJobsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListImportJobsRequest) + return object; + var message = new $root.google.cloud.kms.v1.ListImportJobsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListImportJobsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {google.cloud.kms.v1.ListImportJobsRequest} message ListImportJobsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListImportJobsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListImportJobsRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @instance + * @returns {Object.} JSON object + */ + ListImportJobsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListImportJobsRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListImportJobsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListImportJobsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListImportJobsRequest"; + }; + + return ListImportJobsRequest; + })(); + + v1.ListKeyRingsResponse = (function() { + + /** + * Properties of a ListKeyRingsResponse. + * @memberof google.cloud.kms.v1 + * @interface IListKeyRingsResponse + * @property {Array.|null} [keyRings] ListKeyRingsResponse keyRings + * @property {string|null} [nextPageToken] ListKeyRingsResponse nextPageToken + * @property {number|null} [totalSize] ListKeyRingsResponse totalSize + */ + + /** + * Constructs a new ListKeyRingsResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListKeyRingsResponse. + * @implements IListKeyRingsResponse + * @constructor + * @param {google.cloud.kms.v1.IListKeyRingsResponse=} [properties] Properties to set + */ + function ListKeyRingsResponse(properties) { + this.keyRings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKeyRingsResponse keyRings. + * @member {Array.} keyRings + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @instance + */ + ListKeyRingsResponse.prototype.keyRings = $util.emptyArray; + + /** + * ListKeyRingsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @instance + */ + ListKeyRingsResponse.prototype.nextPageToken = ""; + + /** + * ListKeyRingsResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @instance + */ + ListKeyRingsResponse.prototype.totalSize = 0; + + /** + * Creates a new ListKeyRingsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {google.cloud.kms.v1.IListKeyRingsResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListKeyRingsResponse} ListKeyRingsResponse instance + */ + ListKeyRingsResponse.create = function create(properties) { + return new ListKeyRingsResponse(properties); + }; + + /** + * Encodes the specified ListKeyRingsResponse message. Does not implicitly {@link google.cloud.kms.v1.ListKeyRingsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {google.cloud.kms.v1.IListKeyRingsResponse} message ListKeyRingsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeyRingsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.keyRings != null && message.keyRings.length) + for (var i = 0; i < message.keyRings.length; ++i) + $root.google.cloud.kms.v1.KeyRing.encode(message.keyRings[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 ListKeyRingsResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListKeyRingsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {google.cloud.kms.v1.IListKeyRingsResponse} message ListKeyRingsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKeyRingsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKeyRingsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListKeyRingsResponse} ListKeyRingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeyRingsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListKeyRingsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.keyRings && message.keyRings.length)) + message.keyRings = []; + message.keyRings.push($root.google.cloud.kms.v1.KeyRing.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 ListKeyRingsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListKeyRingsResponse} ListKeyRingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKeyRingsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKeyRingsResponse message. + * @function verify + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKeyRingsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.keyRings != null && message.hasOwnProperty("keyRings")) { + if (!Array.isArray(message.keyRings)) + return "keyRings: array expected"; + for (var i = 0; i < message.keyRings.length; ++i) { + var error = $root.google.cloud.kms.v1.KeyRing.verify(message.keyRings[i]); + if (error) + return "keyRings." + 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 ListKeyRingsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListKeyRingsResponse} ListKeyRingsResponse + */ + ListKeyRingsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListKeyRingsResponse) + return object; + var message = new $root.google.cloud.kms.v1.ListKeyRingsResponse(); + if (object.keyRings) { + if (!Array.isArray(object.keyRings)) + throw TypeError(".google.cloud.kms.v1.ListKeyRingsResponse.keyRings: array expected"); + message.keyRings = []; + for (var i = 0; i < object.keyRings.length; ++i) { + if (typeof object.keyRings[i] !== "object") + throw TypeError(".google.cloud.kms.v1.ListKeyRingsResponse.keyRings: object expected"); + message.keyRings[i] = $root.google.cloud.kms.v1.KeyRing.fromObject(object.keyRings[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 ListKeyRingsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {google.cloud.kms.v1.ListKeyRingsResponse} message ListKeyRingsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKeyRingsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.keyRings = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.keyRings && message.keyRings.length) { + object.keyRings = []; + for (var j = 0; j < message.keyRings.length; ++j) + object.keyRings[j] = $root.google.cloud.kms.v1.KeyRing.toObject(message.keyRings[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 ListKeyRingsResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @instance + * @returns {Object.} JSON object + */ + ListKeyRingsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKeyRingsResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListKeyRingsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKeyRingsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListKeyRingsResponse"; + }; + + return ListKeyRingsResponse; + })(); + + v1.ListCryptoKeysResponse = (function() { + + /** + * Properties of a ListCryptoKeysResponse. + * @memberof google.cloud.kms.v1 + * @interface IListCryptoKeysResponse + * @property {Array.|null} [cryptoKeys] ListCryptoKeysResponse cryptoKeys + * @property {string|null} [nextPageToken] ListCryptoKeysResponse nextPageToken + * @property {number|null} [totalSize] ListCryptoKeysResponse totalSize + */ + + /** + * Constructs a new ListCryptoKeysResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListCryptoKeysResponse. + * @implements IListCryptoKeysResponse + * @constructor + * @param {google.cloud.kms.v1.IListCryptoKeysResponse=} [properties] Properties to set + */ + function ListCryptoKeysResponse(properties) { + this.cryptoKeys = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCryptoKeysResponse cryptoKeys. + * @member {Array.} cryptoKeys + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @instance + */ + ListCryptoKeysResponse.prototype.cryptoKeys = $util.emptyArray; + + /** + * ListCryptoKeysResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @instance + */ + ListCryptoKeysResponse.prototype.nextPageToken = ""; + + /** + * ListCryptoKeysResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @instance + */ + ListCryptoKeysResponse.prototype.totalSize = 0; + + /** + * Creates a new ListCryptoKeysResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {google.cloud.kms.v1.IListCryptoKeysResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListCryptoKeysResponse} ListCryptoKeysResponse instance + */ + ListCryptoKeysResponse.create = function create(properties) { + return new ListCryptoKeysResponse(properties); + }; + + /** + * Encodes the specified ListCryptoKeysResponse message. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeysResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {google.cloud.kms.v1.IListCryptoKeysResponse} message ListCryptoKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCryptoKeysResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cryptoKeys != null && message.cryptoKeys.length) + for (var i = 0; i < message.cryptoKeys.length; ++i) + $root.google.cloud.kms.v1.CryptoKey.encode(message.cryptoKeys[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 ListCryptoKeysResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeysResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {google.cloud.kms.v1.IListCryptoKeysResponse} message ListCryptoKeysResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCryptoKeysResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCryptoKeysResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListCryptoKeysResponse} ListCryptoKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCryptoKeysResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListCryptoKeysResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.cryptoKeys && message.cryptoKeys.length)) + message.cryptoKeys = []; + message.cryptoKeys.push($root.google.cloud.kms.v1.CryptoKey.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 ListCryptoKeysResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListCryptoKeysResponse} ListCryptoKeysResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCryptoKeysResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCryptoKeysResponse message. + * @function verify + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCryptoKeysResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cryptoKeys != null && message.hasOwnProperty("cryptoKeys")) { + if (!Array.isArray(message.cryptoKeys)) + return "cryptoKeys: array expected"; + for (var i = 0; i < message.cryptoKeys.length; ++i) { + var error = $root.google.cloud.kms.v1.CryptoKey.verify(message.cryptoKeys[i]); + if (error) + return "cryptoKeys." + 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 ListCryptoKeysResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListCryptoKeysResponse} ListCryptoKeysResponse + */ + ListCryptoKeysResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListCryptoKeysResponse) + return object; + var message = new $root.google.cloud.kms.v1.ListCryptoKeysResponse(); + if (object.cryptoKeys) { + if (!Array.isArray(object.cryptoKeys)) + throw TypeError(".google.cloud.kms.v1.ListCryptoKeysResponse.cryptoKeys: array expected"); + message.cryptoKeys = []; + for (var i = 0; i < object.cryptoKeys.length; ++i) { + if (typeof object.cryptoKeys[i] !== "object") + throw TypeError(".google.cloud.kms.v1.ListCryptoKeysResponse.cryptoKeys: object expected"); + message.cryptoKeys[i] = $root.google.cloud.kms.v1.CryptoKey.fromObject(object.cryptoKeys[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 ListCryptoKeysResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {google.cloud.kms.v1.ListCryptoKeysResponse} message ListCryptoKeysResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCryptoKeysResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cryptoKeys = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.cryptoKeys && message.cryptoKeys.length) { + object.cryptoKeys = []; + for (var j = 0; j < message.cryptoKeys.length; ++j) + object.cryptoKeys[j] = $root.google.cloud.kms.v1.CryptoKey.toObject(message.cryptoKeys[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 ListCryptoKeysResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @instance + * @returns {Object.} JSON object + */ + ListCryptoKeysResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListCryptoKeysResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListCryptoKeysResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCryptoKeysResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListCryptoKeysResponse"; + }; + + return ListCryptoKeysResponse; + })(); + + v1.ListCryptoKeyVersionsResponse = (function() { + + /** + * Properties of a ListCryptoKeyVersionsResponse. + * @memberof google.cloud.kms.v1 + * @interface IListCryptoKeyVersionsResponse + * @property {Array.|null} [cryptoKeyVersions] ListCryptoKeyVersionsResponse cryptoKeyVersions + * @property {string|null} [nextPageToken] ListCryptoKeyVersionsResponse nextPageToken + * @property {number|null} [totalSize] ListCryptoKeyVersionsResponse totalSize + */ + + /** + * Constructs a new ListCryptoKeyVersionsResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListCryptoKeyVersionsResponse. + * @implements IListCryptoKeyVersionsResponse + * @constructor + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsResponse=} [properties] Properties to set + */ + function ListCryptoKeyVersionsResponse(properties) { + this.cryptoKeyVersions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListCryptoKeyVersionsResponse cryptoKeyVersions. + * @member {Array.} cryptoKeyVersions + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @instance + */ + ListCryptoKeyVersionsResponse.prototype.cryptoKeyVersions = $util.emptyArray; + + /** + * ListCryptoKeyVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @instance + */ + ListCryptoKeyVersionsResponse.prototype.nextPageToken = ""; + + /** + * ListCryptoKeyVersionsResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @instance + */ + ListCryptoKeyVersionsResponse.prototype.totalSize = 0; + + /** + * Creates a new ListCryptoKeyVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListCryptoKeyVersionsResponse} ListCryptoKeyVersionsResponse instance + */ + ListCryptoKeyVersionsResponse.create = function create(properties) { + return new ListCryptoKeyVersionsResponse(properties); + }; + + /** + * Encodes the specified ListCryptoKeyVersionsResponse message. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsResponse} message ListCryptoKeyVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCryptoKeyVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cryptoKeyVersions != null && message.cryptoKeyVersions.length) + for (var i = 0; i < message.cryptoKeyVersions.length; ++i) + $root.google.cloud.kms.v1.CryptoKeyVersion.encode(message.cryptoKeyVersions[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 ListCryptoKeyVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {google.cloud.kms.v1.IListCryptoKeyVersionsResponse} message ListCryptoKeyVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListCryptoKeyVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListCryptoKeyVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListCryptoKeyVersionsResponse} ListCryptoKeyVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCryptoKeyVersionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListCryptoKeyVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.cryptoKeyVersions && message.cryptoKeyVersions.length)) + message.cryptoKeyVersions = []; + message.cryptoKeyVersions.push($root.google.cloud.kms.v1.CryptoKeyVersion.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 ListCryptoKeyVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListCryptoKeyVersionsResponse} ListCryptoKeyVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListCryptoKeyVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListCryptoKeyVersionsResponse message. + * @function verify + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListCryptoKeyVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cryptoKeyVersions != null && message.hasOwnProperty("cryptoKeyVersions")) { + if (!Array.isArray(message.cryptoKeyVersions)) + return "cryptoKeyVersions: array expected"; + for (var i = 0; i < message.cryptoKeyVersions.length; ++i) { + var error = $root.google.cloud.kms.v1.CryptoKeyVersion.verify(message.cryptoKeyVersions[i]); + if (error) + return "cryptoKeyVersions." + 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 ListCryptoKeyVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListCryptoKeyVersionsResponse} ListCryptoKeyVersionsResponse + */ + ListCryptoKeyVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListCryptoKeyVersionsResponse) + return object; + var message = new $root.google.cloud.kms.v1.ListCryptoKeyVersionsResponse(); + if (object.cryptoKeyVersions) { + if (!Array.isArray(object.cryptoKeyVersions)) + throw TypeError(".google.cloud.kms.v1.ListCryptoKeyVersionsResponse.cryptoKeyVersions: array expected"); + message.cryptoKeyVersions = []; + for (var i = 0; i < object.cryptoKeyVersions.length; ++i) { + if (typeof object.cryptoKeyVersions[i] !== "object") + throw TypeError(".google.cloud.kms.v1.ListCryptoKeyVersionsResponse.cryptoKeyVersions: object expected"); + message.cryptoKeyVersions[i] = $root.google.cloud.kms.v1.CryptoKeyVersion.fromObject(object.cryptoKeyVersions[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 ListCryptoKeyVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {google.cloud.kms.v1.ListCryptoKeyVersionsResponse} message ListCryptoKeyVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListCryptoKeyVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cryptoKeyVersions = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.cryptoKeyVersions && message.cryptoKeyVersions.length) { + object.cryptoKeyVersions = []; + for (var j = 0; j < message.cryptoKeyVersions.length; ++j) + object.cryptoKeyVersions[j] = $root.google.cloud.kms.v1.CryptoKeyVersion.toObject(message.cryptoKeyVersions[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 ListCryptoKeyVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListCryptoKeyVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListCryptoKeyVersionsResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListCryptoKeyVersionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListCryptoKeyVersionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"; + }; + + return ListCryptoKeyVersionsResponse; + })(); + + v1.ListImportJobsResponse = (function() { + + /** + * Properties of a ListImportJobsResponse. + * @memberof google.cloud.kms.v1 + * @interface IListImportJobsResponse + * @property {Array.|null} [importJobs] ListImportJobsResponse importJobs + * @property {string|null} [nextPageToken] ListImportJobsResponse nextPageToken + * @property {number|null} [totalSize] ListImportJobsResponse totalSize + */ + + /** + * Constructs a new ListImportJobsResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a ListImportJobsResponse. + * @implements IListImportJobsResponse + * @constructor + * @param {google.cloud.kms.v1.IListImportJobsResponse=} [properties] Properties to set + */ + function ListImportJobsResponse(properties) { + this.importJobs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListImportJobsResponse importJobs. + * @member {Array.} importJobs + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @instance + */ + ListImportJobsResponse.prototype.importJobs = $util.emptyArray; + + /** + * ListImportJobsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @instance + */ + ListImportJobsResponse.prototype.nextPageToken = ""; + + /** + * ListImportJobsResponse totalSize. + * @member {number} totalSize + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @instance + */ + ListImportJobsResponse.prototype.totalSize = 0; + + /** + * Creates a new ListImportJobsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {google.cloud.kms.v1.IListImportJobsResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ListImportJobsResponse} ListImportJobsResponse instance + */ + ListImportJobsResponse.create = function create(properties) { + return new ListImportJobsResponse(properties); + }; + + /** + * Encodes the specified ListImportJobsResponse message. Does not implicitly {@link google.cloud.kms.v1.ListImportJobsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {google.cloud.kms.v1.IListImportJobsResponse} message ListImportJobsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListImportJobsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.importJobs != null && message.importJobs.length) + for (var i = 0; i < message.importJobs.length; ++i) + $root.google.cloud.kms.v1.ImportJob.encode(message.importJobs[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 ListImportJobsResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ListImportJobsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {google.cloud.kms.v1.IListImportJobsResponse} message ListImportJobsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListImportJobsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListImportJobsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ListImportJobsResponse} ListImportJobsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListImportJobsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ListImportJobsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.importJobs && message.importJobs.length)) + message.importJobs = []; + message.importJobs.push($root.google.cloud.kms.v1.ImportJob.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 ListImportJobsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ListImportJobsResponse} ListImportJobsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListImportJobsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListImportJobsResponse message. + * @function verify + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListImportJobsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.importJobs != null && message.hasOwnProperty("importJobs")) { + if (!Array.isArray(message.importJobs)) + return "importJobs: array expected"; + for (var i = 0; i < message.importJobs.length; ++i) { + var error = $root.google.cloud.kms.v1.ImportJob.verify(message.importJobs[i]); + if (error) + return "importJobs." + 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 ListImportJobsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ListImportJobsResponse} ListImportJobsResponse + */ + ListImportJobsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ListImportJobsResponse) + return object; + var message = new $root.google.cloud.kms.v1.ListImportJobsResponse(); + if (object.importJobs) { + if (!Array.isArray(object.importJobs)) + throw TypeError(".google.cloud.kms.v1.ListImportJobsResponse.importJobs: array expected"); + message.importJobs = []; + for (var i = 0; i < object.importJobs.length; ++i) { + if (typeof object.importJobs[i] !== "object") + throw TypeError(".google.cloud.kms.v1.ListImportJobsResponse.importJobs: object expected"); + message.importJobs[i] = $root.google.cloud.kms.v1.ImportJob.fromObject(object.importJobs[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 ListImportJobsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {google.cloud.kms.v1.ListImportJobsResponse} message ListImportJobsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListImportJobsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.importJobs = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.importJobs && message.importJobs.length) { + object.importJobs = []; + for (var j = 0; j < message.importJobs.length; ++j) + object.importJobs[j] = $root.google.cloud.kms.v1.ImportJob.toObject(message.importJobs[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 ListImportJobsResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @instance + * @returns {Object.} JSON object + */ + ListImportJobsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListImportJobsResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ListImportJobsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListImportJobsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ListImportJobsResponse"; + }; + + return ListImportJobsResponse; + })(); + + v1.GetKeyRingRequest = (function() { + + /** + * Properties of a GetKeyRingRequest. + * @memberof google.cloud.kms.v1 + * @interface IGetKeyRingRequest + * @property {string|null} [name] GetKeyRingRequest name + */ + + /** + * Constructs a new GetKeyRingRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a GetKeyRingRequest. + * @implements IGetKeyRingRequest + * @constructor + * @param {google.cloud.kms.v1.IGetKeyRingRequest=} [properties] Properties to set + */ + function GetKeyRingRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetKeyRingRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @instance + */ + GetKeyRingRequest.prototype.name = ""; + + /** + * Creates a new GetKeyRingRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {google.cloud.kms.v1.IGetKeyRingRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.GetKeyRingRequest} GetKeyRingRequest instance + */ + GetKeyRingRequest.create = function create(properties) { + return new GetKeyRingRequest(properties); + }; + + /** + * Encodes the specified GetKeyRingRequest message. Does not implicitly {@link google.cloud.kms.v1.GetKeyRingRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {google.cloud.kms.v1.IGetKeyRingRequest} message GetKeyRingRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKeyRingRequest.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 GetKeyRingRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetKeyRingRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {google.cloud.kms.v1.IGetKeyRingRequest} message GetKeyRingRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKeyRingRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetKeyRingRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.GetKeyRingRequest} GetKeyRingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKeyRingRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.GetKeyRingRequest(); + 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 GetKeyRingRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.GetKeyRingRequest} GetKeyRingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKeyRingRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetKeyRingRequest message. + * @function verify + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetKeyRingRequest.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 GetKeyRingRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.GetKeyRingRequest} GetKeyRingRequest + */ + GetKeyRingRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.GetKeyRingRequest) + return object; + var message = new $root.google.cloud.kms.v1.GetKeyRingRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetKeyRingRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {google.cloud.kms.v1.GetKeyRingRequest} message GetKeyRingRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetKeyRingRequest.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 GetKeyRingRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @instance + * @returns {Object.} JSON object + */ + GetKeyRingRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetKeyRingRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.GetKeyRingRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetKeyRingRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.GetKeyRingRequest"; + }; + + return GetKeyRingRequest; + })(); + + v1.GetCryptoKeyRequest = (function() { + + /** + * Properties of a GetCryptoKeyRequest. + * @memberof google.cloud.kms.v1 + * @interface IGetCryptoKeyRequest + * @property {string|null} [name] GetCryptoKeyRequest name + */ + + /** + * Constructs a new GetCryptoKeyRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a GetCryptoKeyRequest. + * @implements IGetCryptoKeyRequest + * @constructor + * @param {google.cloud.kms.v1.IGetCryptoKeyRequest=} [properties] Properties to set + */ + function GetCryptoKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetCryptoKeyRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @instance + */ + GetCryptoKeyRequest.prototype.name = ""; + + /** + * Creates a new GetCryptoKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.IGetCryptoKeyRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.GetCryptoKeyRequest} GetCryptoKeyRequest instance + */ + GetCryptoKeyRequest.create = function create(properties) { + return new GetCryptoKeyRequest(properties); + }; + + /** + * Encodes the specified GetCryptoKeyRequest message. Does not implicitly {@link google.cloud.kms.v1.GetCryptoKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.IGetCryptoKeyRequest} message GetCryptoKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetCryptoKeyRequest.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 GetCryptoKeyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetCryptoKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.IGetCryptoKeyRequest} message GetCryptoKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetCryptoKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetCryptoKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.GetCryptoKeyRequest} GetCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetCryptoKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.GetCryptoKeyRequest(); + 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 GetCryptoKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.GetCryptoKeyRequest} GetCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetCryptoKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetCryptoKeyRequest message. + * @function verify + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetCryptoKeyRequest.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 GetCryptoKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.GetCryptoKeyRequest} GetCryptoKeyRequest + */ + GetCryptoKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.GetCryptoKeyRequest) + return object; + var message = new $root.google.cloud.kms.v1.GetCryptoKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetCryptoKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.GetCryptoKeyRequest} message GetCryptoKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetCryptoKeyRequest.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 GetCryptoKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @instance + * @returns {Object.} JSON object + */ + GetCryptoKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetCryptoKeyRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.GetCryptoKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetCryptoKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.GetCryptoKeyRequest"; + }; + + return GetCryptoKeyRequest; + })(); + + v1.GetCryptoKeyVersionRequest = (function() { + + /** + * Properties of a GetCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @interface IGetCryptoKeyVersionRequest + * @property {string|null} [name] GetCryptoKeyVersionRequest name + */ + + /** + * Constructs a new GetCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a GetCryptoKeyVersionRequest. + * @implements IGetCryptoKeyVersionRequest + * @constructor + * @param {google.cloud.kms.v1.IGetCryptoKeyVersionRequest=} [properties] Properties to set + */ + function GetCryptoKeyVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetCryptoKeyVersionRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @instance + */ + GetCryptoKeyVersionRequest.prototype.name = ""; + + /** + * Creates a new GetCryptoKeyVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IGetCryptoKeyVersionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.GetCryptoKeyVersionRequest} GetCryptoKeyVersionRequest instance + */ + GetCryptoKeyVersionRequest.create = function create(properties) { + return new GetCryptoKeyVersionRequest(properties); + }; + + /** + * Encodes the specified GetCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.GetCryptoKeyVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IGetCryptoKeyVersionRequest} message GetCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetCryptoKeyVersionRequest.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 GetCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetCryptoKeyVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IGetCryptoKeyVersionRequest} message GetCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetCryptoKeyVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetCryptoKeyVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.GetCryptoKeyVersionRequest} GetCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetCryptoKeyVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.GetCryptoKeyVersionRequest(); + 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 GetCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.GetCryptoKeyVersionRequest} GetCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetCryptoKeyVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetCryptoKeyVersionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetCryptoKeyVersionRequest.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 GetCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.GetCryptoKeyVersionRequest} GetCryptoKeyVersionRequest + */ + GetCryptoKeyVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.GetCryptoKeyVersionRequest) + return object; + var message = new $root.google.cloud.kms.v1.GetCryptoKeyVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.GetCryptoKeyVersionRequest} message GetCryptoKeyVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetCryptoKeyVersionRequest.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 GetCryptoKeyVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetCryptoKeyVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetCryptoKeyVersionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.GetCryptoKeyVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetCryptoKeyVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.GetCryptoKeyVersionRequest"; + }; + + return GetCryptoKeyVersionRequest; + })(); + + v1.GetPublicKeyRequest = (function() { + + /** + * Properties of a GetPublicKeyRequest. + * @memberof google.cloud.kms.v1 + * @interface IGetPublicKeyRequest + * @property {string|null} [name] GetPublicKeyRequest name + */ + + /** + * Constructs a new GetPublicKeyRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a GetPublicKeyRequest. + * @implements IGetPublicKeyRequest + * @constructor + * @param {google.cloud.kms.v1.IGetPublicKeyRequest=} [properties] Properties to set + */ + function GetPublicKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetPublicKeyRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @instance + */ + GetPublicKeyRequest.prototype.name = ""; + + /** + * Creates a new GetPublicKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {google.cloud.kms.v1.IGetPublicKeyRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.GetPublicKeyRequest} GetPublicKeyRequest instance + */ + GetPublicKeyRequest.create = function create(properties) { + return new GetPublicKeyRequest(properties); + }; + + /** + * Encodes the specified GetPublicKeyRequest message. Does not implicitly {@link google.cloud.kms.v1.GetPublicKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {google.cloud.kms.v1.IGetPublicKeyRequest} message GetPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPublicKeyRequest.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 GetPublicKeyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetPublicKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {google.cloud.kms.v1.IGetPublicKeyRequest} message GetPublicKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetPublicKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetPublicKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.GetPublicKeyRequest} GetPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPublicKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.GetPublicKeyRequest(); + 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 GetPublicKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.GetPublicKeyRequest} GetPublicKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetPublicKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetPublicKeyRequest message. + * @function verify + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetPublicKeyRequest.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 GetPublicKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.GetPublicKeyRequest} GetPublicKeyRequest + */ + GetPublicKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.GetPublicKeyRequest) + return object; + var message = new $root.google.cloud.kms.v1.GetPublicKeyRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetPublicKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {google.cloud.kms.v1.GetPublicKeyRequest} message GetPublicKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetPublicKeyRequest.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 GetPublicKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @instance + * @returns {Object.} JSON object + */ + GetPublicKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetPublicKeyRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.GetPublicKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetPublicKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.GetPublicKeyRequest"; + }; + + return GetPublicKeyRequest; + })(); + + v1.GetImportJobRequest = (function() { + + /** + * Properties of a GetImportJobRequest. + * @memberof google.cloud.kms.v1 + * @interface IGetImportJobRequest + * @property {string|null} [name] GetImportJobRequest name + */ + + /** + * Constructs a new GetImportJobRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a GetImportJobRequest. + * @implements IGetImportJobRequest + * @constructor + * @param {google.cloud.kms.v1.IGetImportJobRequest=} [properties] Properties to set + */ + function GetImportJobRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetImportJobRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @instance + */ + GetImportJobRequest.prototype.name = ""; + + /** + * Creates a new GetImportJobRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {google.cloud.kms.v1.IGetImportJobRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.GetImportJobRequest} GetImportJobRequest instance + */ + GetImportJobRequest.create = function create(properties) { + return new GetImportJobRequest(properties); + }; + + /** + * Encodes the specified GetImportJobRequest message. Does not implicitly {@link google.cloud.kms.v1.GetImportJobRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {google.cloud.kms.v1.IGetImportJobRequest} message GetImportJobRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetImportJobRequest.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 GetImportJobRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GetImportJobRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {google.cloud.kms.v1.IGetImportJobRequest} message GetImportJobRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetImportJobRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetImportJobRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.GetImportJobRequest} GetImportJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetImportJobRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.GetImportJobRequest(); + 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 GetImportJobRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.GetImportJobRequest} GetImportJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetImportJobRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetImportJobRequest message. + * @function verify + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetImportJobRequest.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 GetImportJobRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.GetImportJobRequest} GetImportJobRequest + */ + GetImportJobRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.GetImportJobRequest) + return object; + var message = new $root.google.cloud.kms.v1.GetImportJobRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetImportJobRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {google.cloud.kms.v1.GetImportJobRequest} message GetImportJobRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetImportJobRequest.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 GetImportJobRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @instance + * @returns {Object.} JSON object + */ + GetImportJobRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetImportJobRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.GetImportJobRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetImportJobRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.GetImportJobRequest"; + }; + + return GetImportJobRequest; + })(); + + v1.CreateKeyRingRequest = (function() { + + /** + * Properties of a CreateKeyRingRequest. + * @memberof google.cloud.kms.v1 + * @interface ICreateKeyRingRequest + * @property {string|null} [parent] CreateKeyRingRequest parent + * @property {string|null} [keyRingId] CreateKeyRingRequest keyRingId + * @property {google.cloud.kms.v1.IKeyRing|null} [keyRing] CreateKeyRingRequest keyRing + */ + + /** + * Constructs a new CreateKeyRingRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a CreateKeyRingRequest. + * @implements ICreateKeyRingRequest + * @constructor + * @param {google.cloud.kms.v1.ICreateKeyRingRequest=} [properties] Properties to set + */ + function CreateKeyRingRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateKeyRingRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @instance + */ + CreateKeyRingRequest.prototype.parent = ""; + + /** + * CreateKeyRingRequest keyRingId. + * @member {string} keyRingId + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @instance + */ + CreateKeyRingRequest.prototype.keyRingId = ""; + + /** + * CreateKeyRingRequest keyRing. + * @member {google.cloud.kms.v1.IKeyRing|null|undefined} keyRing + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @instance + */ + CreateKeyRingRequest.prototype.keyRing = null; + + /** + * Creates a new CreateKeyRingRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {google.cloud.kms.v1.ICreateKeyRingRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.CreateKeyRingRequest} CreateKeyRingRequest instance + */ + CreateKeyRingRequest.create = function create(properties) { + return new CreateKeyRingRequest(properties); + }; + + /** + * Encodes the specified CreateKeyRingRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateKeyRingRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {google.cloud.kms.v1.ICreateKeyRingRequest} message CreateKeyRingRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKeyRingRequest.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.keyRingId != null && Object.hasOwnProperty.call(message, "keyRingId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.keyRingId); + if (message.keyRing != null && Object.hasOwnProperty.call(message, "keyRing")) + $root.google.cloud.kms.v1.KeyRing.encode(message.keyRing, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateKeyRingRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateKeyRingRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {google.cloud.kms.v1.ICreateKeyRingRequest} message CreateKeyRingRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKeyRingRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateKeyRingRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.CreateKeyRingRequest} CreateKeyRingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKeyRingRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.CreateKeyRingRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.keyRingId = reader.string(); + break; + } + case 3: { + message.keyRing = $root.google.cloud.kms.v1.KeyRing.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateKeyRingRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.CreateKeyRingRequest} CreateKeyRingRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKeyRingRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateKeyRingRequest message. + * @function verify + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateKeyRingRequest.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.keyRingId != null && message.hasOwnProperty("keyRingId")) + if (!$util.isString(message.keyRingId)) + return "keyRingId: string expected"; + if (message.keyRing != null && message.hasOwnProperty("keyRing")) { + var error = $root.google.cloud.kms.v1.KeyRing.verify(message.keyRing); + if (error) + return "keyRing." + error; + } + return null; + }; + + /** + * Creates a CreateKeyRingRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.CreateKeyRingRequest} CreateKeyRingRequest + */ + CreateKeyRingRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.CreateKeyRingRequest) + return object; + var message = new $root.google.cloud.kms.v1.CreateKeyRingRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.keyRingId != null) + message.keyRingId = String(object.keyRingId); + if (object.keyRing != null) { + if (typeof object.keyRing !== "object") + throw TypeError(".google.cloud.kms.v1.CreateKeyRingRequest.keyRing: object expected"); + message.keyRing = $root.google.cloud.kms.v1.KeyRing.fromObject(object.keyRing); + } + return message; + }; + + /** + * Creates a plain object from a CreateKeyRingRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {google.cloud.kms.v1.CreateKeyRingRequest} message CreateKeyRingRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateKeyRingRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.keyRingId = ""; + object.keyRing = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.keyRingId != null && message.hasOwnProperty("keyRingId")) + object.keyRingId = message.keyRingId; + if (message.keyRing != null && message.hasOwnProperty("keyRing")) + object.keyRing = $root.google.cloud.kms.v1.KeyRing.toObject(message.keyRing, options); + return object; + }; + + /** + * Converts this CreateKeyRingRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @instance + * @returns {Object.} JSON object + */ + CreateKeyRingRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateKeyRingRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.CreateKeyRingRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateKeyRingRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.CreateKeyRingRequest"; + }; + + return CreateKeyRingRequest; + })(); + + v1.CreateCryptoKeyRequest = (function() { + + /** + * Properties of a CreateCryptoKeyRequest. + * @memberof google.cloud.kms.v1 + * @interface ICreateCryptoKeyRequest + * @property {string|null} [parent] CreateCryptoKeyRequest parent + * @property {string|null} [cryptoKeyId] CreateCryptoKeyRequest cryptoKeyId + * @property {google.cloud.kms.v1.ICryptoKey|null} [cryptoKey] CreateCryptoKeyRequest cryptoKey + * @property {boolean|null} [skipInitialVersionCreation] CreateCryptoKeyRequest skipInitialVersionCreation + */ + + /** + * Constructs a new CreateCryptoKeyRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a CreateCryptoKeyRequest. + * @implements ICreateCryptoKeyRequest + * @constructor + * @param {google.cloud.kms.v1.ICreateCryptoKeyRequest=} [properties] Properties to set + */ + function CreateCryptoKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateCryptoKeyRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @instance + */ + CreateCryptoKeyRequest.prototype.parent = ""; + + /** + * CreateCryptoKeyRequest cryptoKeyId. + * @member {string} cryptoKeyId + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @instance + */ + CreateCryptoKeyRequest.prototype.cryptoKeyId = ""; + + /** + * CreateCryptoKeyRequest cryptoKey. + * @member {google.cloud.kms.v1.ICryptoKey|null|undefined} cryptoKey + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @instance + */ + CreateCryptoKeyRequest.prototype.cryptoKey = null; + + /** + * CreateCryptoKeyRequest skipInitialVersionCreation. + * @member {boolean} skipInitialVersionCreation + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @instance + */ + CreateCryptoKeyRequest.prototype.skipInitialVersionCreation = false; + + /** + * Creates a new CreateCryptoKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.ICreateCryptoKeyRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.CreateCryptoKeyRequest} CreateCryptoKeyRequest instance + */ + CreateCryptoKeyRequest.create = function create(properties) { + return new CreateCryptoKeyRequest(properties); + }; + + /** + * Encodes the specified CreateCryptoKeyRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateCryptoKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.ICreateCryptoKeyRequest} message CreateCryptoKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateCryptoKeyRequest.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.cryptoKeyId != null && Object.hasOwnProperty.call(message, "cryptoKeyId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.cryptoKeyId); + if (message.cryptoKey != null && Object.hasOwnProperty.call(message, "cryptoKey")) + $root.google.cloud.kms.v1.CryptoKey.encode(message.cryptoKey, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.skipInitialVersionCreation != null && Object.hasOwnProperty.call(message, "skipInitialVersionCreation")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.skipInitialVersionCreation); + return writer; + }; + + /** + * Encodes the specified CreateCryptoKeyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateCryptoKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.ICreateCryptoKeyRequest} message CreateCryptoKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateCryptoKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateCryptoKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.CreateCryptoKeyRequest} CreateCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateCryptoKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.CreateCryptoKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.cryptoKeyId = reader.string(); + break; + } + case 3: { + message.cryptoKey = $root.google.cloud.kms.v1.CryptoKey.decode(reader, reader.uint32()); + break; + } + case 5: { + message.skipInitialVersionCreation = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateCryptoKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.CreateCryptoKeyRequest} CreateCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateCryptoKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateCryptoKeyRequest message. + * @function verify + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateCryptoKeyRequest.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.cryptoKeyId != null && message.hasOwnProperty("cryptoKeyId")) + if (!$util.isString(message.cryptoKeyId)) + return "cryptoKeyId: string expected"; + if (message.cryptoKey != null && message.hasOwnProperty("cryptoKey")) { + var error = $root.google.cloud.kms.v1.CryptoKey.verify(message.cryptoKey); + if (error) + return "cryptoKey." + error; + } + if (message.skipInitialVersionCreation != null && message.hasOwnProperty("skipInitialVersionCreation")) + if (typeof message.skipInitialVersionCreation !== "boolean") + return "skipInitialVersionCreation: boolean expected"; + return null; + }; + + /** + * Creates a CreateCryptoKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.CreateCryptoKeyRequest} CreateCryptoKeyRequest + */ + CreateCryptoKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.CreateCryptoKeyRequest) + return object; + var message = new $root.google.cloud.kms.v1.CreateCryptoKeyRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.cryptoKeyId != null) + message.cryptoKeyId = String(object.cryptoKeyId); + if (object.cryptoKey != null) { + if (typeof object.cryptoKey !== "object") + throw TypeError(".google.cloud.kms.v1.CreateCryptoKeyRequest.cryptoKey: object expected"); + message.cryptoKey = $root.google.cloud.kms.v1.CryptoKey.fromObject(object.cryptoKey); + } + if (object.skipInitialVersionCreation != null) + message.skipInitialVersionCreation = Boolean(object.skipInitialVersionCreation); + return message; + }; + + /** + * Creates a plain object from a CreateCryptoKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.CreateCryptoKeyRequest} message CreateCryptoKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateCryptoKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.cryptoKeyId = ""; + object.cryptoKey = null; + object.skipInitialVersionCreation = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.cryptoKeyId != null && message.hasOwnProperty("cryptoKeyId")) + object.cryptoKeyId = message.cryptoKeyId; + if (message.cryptoKey != null && message.hasOwnProperty("cryptoKey")) + object.cryptoKey = $root.google.cloud.kms.v1.CryptoKey.toObject(message.cryptoKey, options); + if (message.skipInitialVersionCreation != null && message.hasOwnProperty("skipInitialVersionCreation")) + object.skipInitialVersionCreation = message.skipInitialVersionCreation; + return object; + }; + + /** + * Converts this CreateCryptoKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @instance + * @returns {Object.} JSON object + */ + CreateCryptoKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateCryptoKeyRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.CreateCryptoKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateCryptoKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.CreateCryptoKeyRequest"; + }; + + return CreateCryptoKeyRequest; + })(); + + v1.CreateCryptoKeyVersionRequest = (function() { + + /** + * Properties of a CreateCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @interface ICreateCryptoKeyVersionRequest + * @property {string|null} [parent] CreateCryptoKeyVersionRequest parent + * @property {google.cloud.kms.v1.ICryptoKeyVersion|null} [cryptoKeyVersion] CreateCryptoKeyVersionRequest cryptoKeyVersion + */ + + /** + * Constructs a new CreateCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a CreateCryptoKeyVersionRequest. + * @implements ICreateCryptoKeyVersionRequest + * @constructor + * @param {google.cloud.kms.v1.ICreateCryptoKeyVersionRequest=} [properties] Properties to set + */ + function CreateCryptoKeyVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateCryptoKeyVersionRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @instance + */ + CreateCryptoKeyVersionRequest.prototype.parent = ""; + + /** + * CreateCryptoKeyVersionRequest cryptoKeyVersion. + * @member {google.cloud.kms.v1.ICryptoKeyVersion|null|undefined} cryptoKeyVersion + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @instance + */ + CreateCryptoKeyVersionRequest.prototype.cryptoKeyVersion = null; + + /** + * Creates a new CreateCryptoKeyVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.ICreateCryptoKeyVersionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.CreateCryptoKeyVersionRequest} CreateCryptoKeyVersionRequest instance + */ + CreateCryptoKeyVersionRequest.create = function create(properties) { + return new CreateCryptoKeyVersionRequest(properties); + }; + + /** + * Encodes the specified CreateCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateCryptoKeyVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.ICreateCryptoKeyVersionRequest} message CreateCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateCryptoKeyVersionRequest.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.cryptoKeyVersion != null && Object.hasOwnProperty.call(message, "cryptoKeyVersion")) + $root.google.cloud.kms.v1.CryptoKeyVersion.encode(message.cryptoKeyVersion, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateCryptoKeyVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.ICreateCryptoKeyVersionRequest} message CreateCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateCryptoKeyVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateCryptoKeyVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.CreateCryptoKeyVersionRequest} CreateCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateCryptoKeyVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.CreateCryptoKeyVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.cryptoKeyVersion = $root.google.cloud.kms.v1.CryptoKeyVersion.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.CreateCryptoKeyVersionRequest} CreateCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateCryptoKeyVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateCryptoKeyVersionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateCryptoKeyVersionRequest.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.cryptoKeyVersion != null && message.hasOwnProperty("cryptoKeyVersion")) { + var error = $root.google.cloud.kms.v1.CryptoKeyVersion.verify(message.cryptoKeyVersion); + if (error) + return "cryptoKeyVersion." + error; + } + return null; + }; + + /** + * Creates a CreateCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.CreateCryptoKeyVersionRequest} CreateCryptoKeyVersionRequest + */ + CreateCryptoKeyVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.CreateCryptoKeyVersionRequest) + return object; + var message = new $root.google.cloud.kms.v1.CreateCryptoKeyVersionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.cryptoKeyVersion != null) { + if (typeof object.cryptoKeyVersion !== "object") + throw TypeError(".google.cloud.kms.v1.CreateCryptoKeyVersionRequest.cryptoKeyVersion: object expected"); + message.cryptoKeyVersion = $root.google.cloud.kms.v1.CryptoKeyVersion.fromObject(object.cryptoKeyVersion); + } + return message; + }; + + /** + * Creates a plain object from a CreateCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.CreateCryptoKeyVersionRequest} message CreateCryptoKeyVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateCryptoKeyVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.cryptoKeyVersion = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.cryptoKeyVersion != null && message.hasOwnProperty("cryptoKeyVersion")) + object.cryptoKeyVersion = $root.google.cloud.kms.v1.CryptoKeyVersion.toObject(message.cryptoKeyVersion, options); + return object; + }; + + /** + * Converts this CreateCryptoKeyVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateCryptoKeyVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateCryptoKeyVersionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.CreateCryptoKeyVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateCryptoKeyVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"; + }; + + return CreateCryptoKeyVersionRequest; + })(); + + v1.ImportCryptoKeyVersionRequest = (function() { + + /** + * Properties of an ImportCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @interface IImportCryptoKeyVersionRequest + * @property {string|null} [parent] ImportCryptoKeyVersionRequest parent + * @property {string|null} [cryptoKeyVersion] ImportCryptoKeyVersionRequest cryptoKeyVersion + * @property {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|null} [algorithm] ImportCryptoKeyVersionRequest algorithm + * @property {string|null} [importJob] ImportCryptoKeyVersionRequest importJob + * @property {Uint8Array|null} [rsaAesWrappedKey] ImportCryptoKeyVersionRequest rsaAesWrappedKey + */ + + /** + * Constructs a new ImportCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an ImportCryptoKeyVersionRequest. + * @implements IImportCryptoKeyVersionRequest + * @constructor + * @param {google.cloud.kms.v1.IImportCryptoKeyVersionRequest=} [properties] Properties to set + */ + function ImportCryptoKeyVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportCryptoKeyVersionRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @instance + */ + ImportCryptoKeyVersionRequest.prototype.parent = ""; + + /** + * ImportCryptoKeyVersionRequest cryptoKeyVersion. + * @member {string} cryptoKeyVersion + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @instance + */ + ImportCryptoKeyVersionRequest.prototype.cryptoKeyVersion = ""; + + /** + * ImportCryptoKeyVersionRequest algorithm. + * @member {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} algorithm + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @instance + */ + ImportCryptoKeyVersionRequest.prototype.algorithm = 0; + + /** + * ImportCryptoKeyVersionRequest importJob. + * @member {string} importJob + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @instance + */ + ImportCryptoKeyVersionRequest.prototype.importJob = ""; + + /** + * ImportCryptoKeyVersionRequest rsaAesWrappedKey. + * @member {Uint8Array|null|undefined} rsaAesWrappedKey + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @instance + */ + ImportCryptoKeyVersionRequest.prototype.rsaAesWrappedKey = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportCryptoKeyVersionRequest wrappedKeyMaterial. + * @member {"rsaAesWrappedKey"|undefined} wrappedKeyMaterial + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @instance + */ + Object.defineProperty(ImportCryptoKeyVersionRequest.prototype, "wrappedKeyMaterial", { + get: $util.oneOfGetter($oneOfFields = ["rsaAesWrappedKey"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportCryptoKeyVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IImportCryptoKeyVersionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.ImportCryptoKeyVersionRequest} ImportCryptoKeyVersionRequest instance + */ + ImportCryptoKeyVersionRequest.create = function create(properties) { + return new ImportCryptoKeyVersionRequest(properties); + }; + + /** + * Encodes the specified ImportCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.ImportCryptoKeyVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IImportCryptoKeyVersionRequest} message ImportCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCryptoKeyVersionRequest.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.algorithm != null && Object.hasOwnProperty.call(message, "algorithm")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.algorithm); + if (message.importJob != null && Object.hasOwnProperty.call(message, "importJob")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.importJob); + if (message.rsaAesWrappedKey != null && Object.hasOwnProperty.call(message, "rsaAesWrappedKey")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.rsaAesWrappedKey); + if (message.cryptoKeyVersion != null && Object.hasOwnProperty.call(message, "cryptoKeyVersion")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.cryptoKeyVersion); + return writer; + }; + + /** + * Encodes the specified ImportCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.ImportCryptoKeyVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IImportCryptoKeyVersionRequest} message ImportCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportCryptoKeyVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportCryptoKeyVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.ImportCryptoKeyVersionRequest} ImportCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCryptoKeyVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.ImportCryptoKeyVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 6: { + message.cryptoKeyVersion = reader.string(); + break; + } + case 2: { + message.algorithm = reader.int32(); + break; + } + case 4: { + message.importJob = reader.string(); + break; + } + case 5: { + message.rsaAesWrappedKey = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.ImportCryptoKeyVersionRequest} ImportCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportCryptoKeyVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportCryptoKeyVersionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportCryptoKeyVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.cryptoKeyVersion != null && message.hasOwnProperty("cryptoKeyVersion")) + if (!$util.isString(message.cryptoKeyVersion)) + return "cryptoKeyVersion: string expected"; + if (message.algorithm != null && message.hasOwnProperty("algorithm")) + switch (message.algorithm) { + default: + return "algorithm: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 15: + case 5: + case 6: + case 7: + case 16: + case 28: + case 29: + case 30: + case 8: + case 9: + case 10: + case 17: + case 37: + case 38: + case 39: + case 12: + case 13: + case 31: + case 32: + case 18: + break; + } + if (message.importJob != null && message.hasOwnProperty("importJob")) + if (!$util.isString(message.importJob)) + return "importJob: string expected"; + if (message.rsaAesWrappedKey != null && message.hasOwnProperty("rsaAesWrappedKey")) { + properties.wrappedKeyMaterial = 1; + if (!(message.rsaAesWrappedKey && typeof message.rsaAesWrappedKey.length === "number" || $util.isString(message.rsaAesWrappedKey))) + return "rsaAesWrappedKey: buffer expected"; + } + return null; + }; + + /** + * Creates an ImportCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.ImportCryptoKeyVersionRequest} ImportCryptoKeyVersionRequest + */ + ImportCryptoKeyVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.ImportCryptoKeyVersionRequest) + return object; + var message = new $root.google.cloud.kms.v1.ImportCryptoKeyVersionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.cryptoKeyVersion != null) + message.cryptoKeyVersion = String(object.cryptoKeyVersion); + switch (object.algorithm) { + default: + if (typeof object.algorithm === "number") { + message.algorithm = object.algorithm; + break; + } + break; + case "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED": + case 0: + message.algorithm = 0; + break; + case "GOOGLE_SYMMETRIC_ENCRYPTION": + case 1: + message.algorithm = 1; + break; + case "RSA_SIGN_PSS_2048_SHA256": + case 2: + message.algorithm = 2; + break; + case "RSA_SIGN_PSS_3072_SHA256": + case 3: + message.algorithm = 3; + break; + case "RSA_SIGN_PSS_4096_SHA256": + case 4: + message.algorithm = 4; + break; + case "RSA_SIGN_PSS_4096_SHA512": + case 15: + message.algorithm = 15; + break; + case "RSA_SIGN_PKCS1_2048_SHA256": + case 5: + message.algorithm = 5; + break; + case "RSA_SIGN_PKCS1_3072_SHA256": + case 6: + message.algorithm = 6; + break; + case "RSA_SIGN_PKCS1_4096_SHA256": + case 7: + message.algorithm = 7; + break; + case "RSA_SIGN_PKCS1_4096_SHA512": + case 16: + message.algorithm = 16; + break; + case "RSA_SIGN_RAW_PKCS1_2048": + case 28: + message.algorithm = 28; + break; + case "RSA_SIGN_RAW_PKCS1_3072": + case 29: + message.algorithm = 29; + break; + case "RSA_SIGN_RAW_PKCS1_4096": + case 30: + message.algorithm = 30; + break; + case "RSA_DECRYPT_OAEP_2048_SHA256": + case 8: + message.algorithm = 8; + break; + case "RSA_DECRYPT_OAEP_3072_SHA256": + case 9: + message.algorithm = 9; + break; + case "RSA_DECRYPT_OAEP_4096_SHA256": + case 10: + message.algorithm = 10; + break; + case "RSA_DECRYPT_OAEP_4096_SHA512": + case 17: + message.algorithm = 17; + break; + case "RSA_DECRYPT_OAEP_2048_SHA1": + case 37: + message.algorithm = 37; + break; + case "RSA_DECRYPT_OAEP_3072_SHA1": + case 38: + message.algorithm = 38; + break; + case "RSA_DECRYPT_OAEP_4096_SHA1": + case 39: + message.algorithm = 39; + break; + case "EC_SIGN_P256_SHA256": + case 12: + message.algorithm = 12; + break; + case "EC_SIGN_P384_SHA384": + case 13: + message.algorithm = 13; + break; + case "EC_SIGN_SECP256K1_SHA256": + case 31: + message.algorithm = 31; + break; + case "HMAC_SHA256": + case 32: + message.algorithm = 32; + break; + case "EXTERNAL_SYMMETRIC_ENCRYPTION": + case 18: + message.algorithm = 18; + break; + } + if (object.importJob != null) + message.importJob = String(object.importJob); + if (object.rsaAesWrappedKey != null) + if (typeof object.rsaAesWrappedKey === "string") + $util.base64.decode(object.rsaAesWrappedKey, message.rsaAesWrappedKey = $util.newBuffer($util.base64.length(object.rsaAesWrappedKey)), 0); + else if (object.rsaAesWrappedKey.length >= 0) + message.rsaAesWrappedKey = object.rsaAesWrappedKey; + return message; + }; + + /** + * Creates a plain object from an ImportCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.ImportCryptoKeyVersionRequest} message ImportCryptoKeyVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportCryptoKeyVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.algorithm = options.enums === String ? "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" : 0; + object.importJob = ""; + object.cryptoKeyVersion = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.algorithm != null && message.hasOwnProperty("algorithm")) + object.algorithm = options.enums === String ? $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm[message.algorithm] === undefined ? message.algorithm : $root.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm[message.algorithm] : message.algorithm; + if (message.importJob != null && message.hasOwnProperty("importJob")) + object.importJob = message.importJob; + if (message.rsaAesWrappedKey != null && message.hasOwnProperty("rsaAesWrappedKey")) { + object.rsaAesWrappedKey = options.bytes === String ? $util.base64.encode(message.rsaAesWrappedKey, 0, message.rsaAesWrappedKey.length) : options.bytes === Array ? Array.prototype.slice.call(message.rsaAesWrappedKey) : message.rsaAesWrappedKey; + if (options.oneofs) + object.wrappedKeyMaterial = "rsaAesWrappedKey"; + } + if (message.cryptoKeyVersion != null && message.hasOwnProperty("cryptoKeyVersion")) + object.cryptoKeyVersion = message.cryptoKeyVersion; + return object; + }; + + /** + * Converts this ImportCryptoKeyVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @instance + * @returns {Object.} JSON object + */ + ImportCryptoKeyVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportCryptoKeyVersionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.ImportCryptoKeyVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportCryptoKeyVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"; + }; + + return ImportCryptoKeyVersionRequest; + })(); + + v1.CreateImportJobRequest = (function() { + + /** + * Properties of a CreateImportJobRequest. + * @memberof google.cloud.kms.v1 + * @interface ICreateImportJobRequest + * @property {string|null} [parent] CreateImportJobRequest parent + * @property {string|null} [importJobId] CreateImportJobRequest importJobId + * @property {google.cloud.kms.v1.IImportJob|null} [importJob] CreateImportJobRequest importJob + */ + + /** + * Constructs a new CreateImportJobRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a CreateImportJobRequest. + * @implements ICreateImportJobRequest + * @constructor + * @param {google.cloud.kms.v1.ICreateImportJobRequest=} [properties] Properties to set + */ + function CreateImportJobRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateImportJobRequest parent. + * @member {string} parent + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @instance + */ + CreateImportJobRequest.prototype.parent = ""; + + /** + * CreateImportJobRequest importJobId. + * @member {string} importJobId + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @instance + */ + CreateImportJobRequest.prototype.importJobId = ""; + + /** + * CreateImportJobRequest importJob. + * @member {google.cloud.kms.v1.IImportJob|null|undefined} importJob + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @instance + */ + CreateImportJobRequest.prototype.importJob = null; + + /** + * Creates a new CreateImportJobRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {google.cloud.kms.v1.ICreateImportJobRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.CreateImportJobRequest} CreateImportJobRequest instance + */ + CreateImportJobRequest.create = function create(properties) { + return new CreateImportJobRequest(properties); + }; + + /** + * Encodes the specified CreateImportJobRequest message. Does not implicitly {@link google.cloud.kms.v1.CreateImportJobRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {google.cloud.kms.v1.ICreateImportJobRequest} message CreateImportJobRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateImportJobRequest.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.importJobId != null && Object.hasOwnProperty.call(message, "importJobId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.importJobId); + if (message.importJob != null && Object.hasOwnProperty.call(message, "importJob")) + $root.google.cloud.kms.v1.ImportJob.encode(message.importJob, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateImportJobRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.CreateImportJobRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {google.cloud.kms.v1.ICreateImportJobRequest} message CreateImportJobRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateImportJobRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateImportJobRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.CreateImportJobRequest} CreateImportJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateImportJobRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.CreateImportJobRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.importJobId = reader.string(); + break; + } + case 3: { + message.importJob = $root.google.cloud.kms.v1.ImportJob.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateImportJobRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.CreateImportJobRequest} CreateImportJobRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateImportJobRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateImportJobRequest message. + * @function verify + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateImportJobRequest.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.importJobId != null && message.hasOwnProperty("importJobId")) + if (!$util.isString(message.importJobId)) + return "importJobId: string expected"; + if (message.importJob != null && message.hasOwnProperty("importJob")) { + var error = $root.google.cloud.kms.v1.ImportJob.verify(message.importJob); + if (error) + return "importJob." + error; + } + return null; + }; + + /** + * Creates a CreateImportJobRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.CreateImportJobRequest} CreateImportJobRequest + */ + CreateImportJobRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.CreateImportJobRequest) + return object; + var message = new $root.google.cloud.kms.v1.CreateImportJobRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.importJobId != null) + message.importJobId = String(object.importJobId); + if (object.importJob != null) { + if (typeof object.importJob !== "object") + throw TypeError(".google.cloud.kms.v1.CreateImportJobRequest.importJob: object expected"); + message.importJob = $root.google.cloud.kms.v1.ImportJob.fromObject(object.importJob); + } + return message; + }; + + /** + * Creates a plain object from a CreateImportJobRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {google.cloud.kms.v1.CreateImportJobRequest} message CreateImportJobRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateImportJobRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.importJobId = ""; + object.importJob = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.importJobId != null && message.hasOwnProperty("importJobId")) + object.importJobId = message.importJobId; + if (message.importJob != null && message.hasOwnProperty("importJob")) + object.importJob = $root.google.cloud.kms.v1.ImportJob.toObject(message.importJob, options); + return object; + }; + + /** + * Converts this CreateImportJobRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @instance + * @returns {Object.} JSON object + */ + CreateImportJobRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateImportJobRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.CreateImportJobRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateImportJobRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.CreateImportJobRequest"; + }; + + return CreateImportJobRequest; + })(); + + v1.UpdateCryptoKeyRequest = (function() { + + /** + * Properties of an UpdateCryptoKeyRequest. + * @memberof google.cloud.kms.v1 + * @interface IUpdateCryptoKeyRequest + * @property {google.cloud.kms.v1.ICryptoKey|null} [cryptoKey] UpdateCryptoKeyRequest cryptoKey + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCryptoKeyRequest updateMask + */ + + /** + * Constructs a new UpdateCryptoKeyRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an UpdateCryptoKeyRequest. + * @implements IUpdateCryptoKeyRequest + * @constructor + * @param {google.cloud.kms.v1.IUpdateCryptoKeyRequest=} [properties] Properties to set + */ + function UpdateCryptoKeyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCryptoKeyRequest cryptoKey. + * @member {google.cloud.kms.v1.ICryptoKey|null|undefined} cryptoKey + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @instance + */ + UpdateCryptoKeyRequest.prototype.cryptoKey = null; + + /** + * UpdateCryptoKeyRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @instance + */ + UpdateCryptoKeyRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCryptoKeyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.UpdateCryptoKeyRequest} UpdateCryptoKeyRequest instance + */ + UpdateCryptoKeyRequest.create = function create(properties) { + return new UpdateCryptoKeyRequest(properties); + }; + + /** + * Encodes the specified UpdateCryptoKeyRequest message. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyRequest} message UpdateCryptoKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCryptoKeyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cryptoKey != null && Object.hasOwnProperty.call(message, "cryptoKey")) + $root.google.cloud.kms.v1.CryptoKey.encode(message.cryptoKey, 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 UpdateCryptoKeyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyRequest} message UpdateCryptoKeyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCryptoKeyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCryptoKeyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.UpdateCryptoKeyRequest} UpdateCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCryptoKeyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.UpdateCryptoKeyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.cryptoKey = $root.google.cloud.kms.v1.CryptoKey.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 UpdateCryptoKeyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.UpdateCryptoKeyRequest} UpdateCryptoKeyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCryptoKeyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCryptoKeyRequest message. + * @function verify + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCryptoKeyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cryptoKey != null && message.hasOwnProperty("cryptoKey")) { + var error = $root.google.cloud.kms.v1.CryptoKey.verify(message.cryptoKey); + if (error) + return "cryptoKey." + 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 UpdateCryptoKeyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.UpdateCryptoKeyRequest} UpdateCryptoKeyRequest + */ + UpdateCryptoKeyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.UpdateCryptoKeyRequest) + return object; + var message = new $root.google.cloud.kms.v1.UpdateCryptoKeyRequest(); + if (object.cryptoKey != null) { + if (typeof object.cryptoKey !== "object") + throw TypeError(".google.cloud.kms.v1.UpdateCryptoKeyRequest.cryptoKey: object expected"); + message.cryptoKey = $root.google.cloud.kms.v1.CryptoKey.fromObject(object.cryptoKey); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.kms.v1.UpdateCryptoKeyRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCryptoKeyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {google.cloud.kms.v1.UpdateCryptoKeyRequest} message UpdateCryptoKeyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCryptoKeyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.cryptoKey = null; + object.updateMask = null; + } + if (message.cryptoKey != null && message.hasOwnProperty("cryptoKey")) + object.cryptoKey = $root.google.cloud.kms.v1.CryptoKey.toObject(message.cryptoKey, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCryptoKeyRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCryptoKeyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateCryptoKeyRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.UpdateCryptoKeyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCryptoKeyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.UpdateCryptoKeyRequest"; + }; + + return UpdateCryptoKeyRequest; + })(); + + v1.UpdateCryptoKeyVersionRequest = (function() { + + /** + * Properties of an UpdateCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @interface IUpdateCryptoKeyVersionRequest + * @property {google.cloud.kms.v1.ICryptoKeyVersion|null} [cryptoKeyVersion] UpdateCryptoKeyVersionRequest cryptoKeyVersion + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCryptoKeyVersionRequest updateMask + */ + + /** + * Constructs a new UpdateCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an UpdateCryptoKeyVersionRequest. + * @implements IUpdateCryptoKeyVersionRequest + * @constructor + * @param {google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest=} [properties] Properties to set + */ + function UpdateCryptoKeyVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCryptoKeyVersionRequest cryptoKeyVersion. + * @member {google.cloud.kms.v1.ICryptoKeyVersion|null|undefined} cryptoKeyVersion + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @instance + */ + UpdateCryptoKeyVersionRequest.prototype.cryptoKeyVersion = null; + + /** + * UpdateCryptoKeyVersionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @instance + */ + UpdateCryptoKeyVersionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCryptoKeyVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.UpdateCryptoKeyVersionRequest} UpdateCryptoKeyVersionRequest instance + */ + UpdateCryptoKeyVersionRequest.create = function create(properties) { + return new UpdateCryptoKeyVersionRequest(properties); + }; + + /** + * Encodes the specified UpdateCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest} message UpdateCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCryptoKeyVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cryptoKeyVersion != null && Object.hasOwnProperty.call(message, "cryptoKeyVersion")) + $root.google.cloud.kms.v1.CryptoKeyVersion.encode(message.cryptoKeyVersion, 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 UpdateCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest} message UpdateCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCryptoKeyVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCryptoKeyVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.UpdateCryptoKeyVersionRequest} UpdateCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCryptoKeyVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.cryptoKeyVersion = $root.google.cloud.kms.v1.CryptoKeyVersion.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 UpdateCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.UpdateCryptoKeyVersionRequest} UpdateCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCryptoKeyVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCryptoKeyVersionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCryptoKeyVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cryptoKeyVersion != null && message.hasOwnProperty("cryptoKeyVersion")) { + var error = $root.google.cloud.kms.v1.CryptoKeyVersion.verify(message.cryptoKeyVersion); + if (error) + return "cryptoKeyVersion." + 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 UpdateCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.UpdateCryptoKeyVersionRequest} UpdateCryptoKeyVersionRequest + */ + UpdateCryptoKeyVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) + return object; + var message = new $root.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest(); + if (object.cryptoKeyVersion != null) { + if (typeof object.cryptoKeyVersion !== "object") + throw TypeError(".google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.cryptoKeyVersion: object expected"); + message.cryptoKeyVersion = $root.google.cloud.kms.v1.CryptoKeyVersion.fromObject(object.cryptoKeyVersion); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.UpdateCryptoKeyVersionRequest} message UpdateCryptoKeyVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCryptoKeyVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.cryptoKeyVersion = null; + object.updateMask = null; + } + if (message.cryptoKeyVersion != null && message.hasOwnProperty("cryptoKeyVersion")) + object.cryptoKeyVersion = $root.google.cloud.kms.v1.CryptoKeyVersion.toObject(message.cryptoKeyVersion, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCryptoKeyVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCryptoKeyVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateCryptoKeyVersionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.UpdateCryptoKeyVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCryptoKeyVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"; + }; + + return UpdateCryptoKeyVersionRequest; + })(); + + v1.UpdateCryptoKeyPrimaryVersionRequest = (function() { + + /** + * Properties of an UpdateCryptoKeyPrimaryVersionRequest. + * @memberof google.cloud.kms.v1 + * @interface IUpdateCryptoKeyPrimaryVersionRequest + * @property {string|null} [name] UpdateCryptoKeyPrimaryVersionRequest name + * @property {string|null} [cryptoKeyVersionId] UpdateCryptoKeyPrimaryVersionRequest cryptoKeyVersionId + */ + + /** + * Constructs a new UpdateCryptoKeyPrimaryVersionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an UpdateCryptoKeyPrimaryVersionRequest. + * @implements IUpdateCryptoKeyPrimaryVersionRequest + * @constructor + * @param {google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest=} [properties] Properties to set + */ + function UpdateCryptoKeyPrimaryVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCryptoKeyPrimaryVersionRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @instance + */ + UpdateCryptoKeyPrimaryVersionRequest.prototype.name = ""; + + /** + * UpdateCryptoKeyPrimaryVersionRequest cryptoKeyVersionId. + * @member {string} cryptoKeyVersionId + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @instance + */ + UpdateCryptoKeyPrimaryVersionRequest.prototype.cryptoKeyVersionId = ""; + + /** + * Creates a new UpdateCryptoKeyPrimaryVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest} UpdateCryptoKeyPrimaryVersionRequest instance + */ + UpdateCryptoKeyPrimaryVersionRequest.create = function create(properties) { + return new UpdateCryptoKeyPrimaryVersionRequest(properties); + }; + + /** + * Encodes the specified UpdateCryptoKeyPrimaryVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest} message UpdateCryptoKeyPrimaryVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCryptoKeyPrimaryVersionRequest.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.cryptoKeyVersionId != null && Object.hasOwnProperty.call(message, "cryptoKeyVersionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.cryptoKeyVersionId); + return writer; + }; + + /** + * Encodes the specified UpdateCryptoKeyPrimaryVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest} message UpdateCryptoKeyPrimaryVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCryptoKeyPrimaryVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCryptoKeyPrimaryVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest} UpdateCryptoKeyPrimaryVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCryptoKeyPrimaryVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.cryptoKeyVersionId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCryptoKeyPrimaryVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest} UpdateCryptoKeyPrimaryVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCryptoKeyPrimaryVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCryptoKeyPrimaryVersionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCryptoKeyPrimaryVersionRequest.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.cryptoKeyVersionId != null && message.hasOwnProperty("cryptoKeyVersionId")) + if (!$util.isString(message.cryptoKeyVersionId)) + return "cryptoKeyVersionId: string expected"; + return null; + }; + + /** + * Creates an UpdateCryptoKeyPrimaryVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest} UpdateCryptoKeyPrimaryVersionRequest + */ + UpdateCryptoKeyPrimaryVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) + return object; + var message = new $root.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.cryptoKeyVersionId != null) + message.cryptoKeyVersionId = String(object.cryptoKeyVersionId); + return message; + }; + + /** + * Creates a plain object from an UpdateCryptoKeyPrimaryVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest} message UpdateCryptoKeyPrimaryVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCryptoKeyPrimaryVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.cryptoKeyVersionId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.cryptoKeyVersionId != null && message.hasOwnProperty("cryptoKeyVersionId")) + object.cryptoKeyVersionId = message.cryptoKeyVersionId; + return object; + }; + + /** + * Converts this UpdateCryptoKeyPrimaryVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCryptoKeyPrimaryVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateCryptoKeyPrimaryVersionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCryptoKeyPrimaryVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"; + }; + + return UpdateCryptoKeyPrimaryVersionRequest; + })(); + + v1.DestroyCryptoKeyVersionRequest = (function() { + + /** + * Properties of a DestroyCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @interface IDestroyCryptoKeyVersionRequest + * @property {string|null} [name] DestroyCryptoKeyVersionRequest name + */ + + /** + * Constructs a new DestroyCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a DestroyCryptoKeyVersionRequest. + * @implements IDestroyCryptoKeyVersionRequest + * @constructor + * @param {google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest=} [properties] Properties to set + */ + function DestroyCryptoKeyVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DestroyCryptoKeyVersionRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @instance + */ + DestroyCryptoKeyVersionRequest.prototype.name = ""; + + /** + * Creates a new DestroyCryptoKeyVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.DestroyCryptoKeyVersionRequest} DestroyCryptoKeyVersionRequest instance + */ + DestroyCryptoKeyVersionRequest.create = function create(properties) { + return new DestroyCryptoKeyVersionRequest(properties); + }; + + /** + * Encodes the specified DestroyCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest} message DestroyCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DestroyCryptoKeyVersionRequest.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 DestroyCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest} message DestroyCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DestroyCryptoKeyVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DestroyCryptoKeyVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.DestroyCryptoKeyVersionRequest} DestroyCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DestroyCryptoKeyVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest(); + 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 DestroyCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.DestroyCryptoKeyVersionRequest} DestroyCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DestroyCryptoKeyVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DestroyCryptoKeyVersionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DestroyCryptoKeyVersionRequest.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 DestroyCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.DestroyCryptoKeyVersionRequest} DestroyCryptoKeyVersionRequest + */ + DestroyCryptoKeyVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) + return object; + var message = new $root.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DestroyCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.DestroyCryptoKeyVersionRequest} message DestroyCryptoKeyVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DestroyCryptoKeyVersionRequest.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 DestroyCryptoKeyVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DestroyCryptoKeyVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DestroyCryptoKeyVersionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.DestroyCryptoKeyVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DestroyCryptoKeyVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"; + }; + + return DestroyCryptoKeyVersionRequest; + })(); + + v1.RestoreCryptoKeyVersionRequest = (function() { + + /** + * Properties of a RestoreCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @interface IRestoreCryptoKeyVersionRequest + * @property {string|null} [name] RestoreCryptoKeyVersionRequest name + */ + + /** + * Constructs a new RestoreCryptoKeyVersionRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a RestoreCryptoKeyVersionRequest. + * @implements IRestoreCryptoKeyVersionRequest + * @constructor + * @param {google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest=} [properties] Properties to set + */ + function RestoreCryptoKeyVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RestoreCryptoKeyVersionRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @instance + */ + RestoreCryptoKeyVersionRequest.prototype.name = ""; + + /** + * Creates a new RestoreCryptoKeyVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.RestoreCryptoKeyVersionRequest} RestoreCryptoKeyVersionRequest instance + */ + RestoreCryptoKeyVersionRequest.create = function create(properties) { + return new RestoreCryptoKeyVersionRequest(properties); + }; + + /** + * Encodes the specified RestoreCryptoKeyVersionRequest message. Does not implicitly {@link google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest} message RestoreCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreCryptoKeyVersionRequest.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 RestoreCryptoKeyVersionRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest} message RestoreCryptoKeyVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreCryptoKeyVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RestoreCryptoKeyVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.RestoreCryptoKeyVersionRequest} RestoreCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreCryptoKeyVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest(); + 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 RestoreCryptoKeyVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.RestoreCryptoKeyVersionRequest} RestoreCryptoKeyVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreCryptoKeyVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RestoreCryptoKeyVersionRequest message. + * @function verify + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RestoreCryptoKeyVersionRequest.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 RestoreCryptoKeyVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.RestoreCryptoKeyVersionRequest} RestoreCryptoKeyVersionRequest + */ + RestoreCryptoKeyVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) + return object; + var message = new $root.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a RestoreCryptoKeyVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {google.cloud.kms.v1.RestoreCryptoKeyVersionRequest} message RestoreCryptoKeyVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RestoreCryptoKeyVersionRequest.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 RestoreCryptoKeyVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @instance + * @returns {Object.} JSON object + */ + RestoreCryptoKeyVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RestoreCryptoKeyVersionRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.RestoreCryptoKeyVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RestoreCryptoKeyVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"; + }; + + return RestoreCryptoKeyVersionRequest; + })(); + + v1.EncryptRequest = (function() { + + /** + * Properties of an EncryptRequest. + * @memberof google.cloud.kms.v1 + * @interface IEncryptRequest + * @property {string|null} [name] EncryptRequest name + * @property {Uint8Array|null} [plaintext] EncryptRequest plaintext + * @property {Uint8Array|null} [additionalAuthenticatedData] EncryptRequest additionalAuthenticatedData + * @property {google.protobuf.IInt64Value|null} [plaintextCrc32c] EncryptRequest plaintextCrc32c + * @property {google.protobuf.IInt64Value|null} [additionalAuthenticatedDataCrc32c] EncryptRequest additionalAuthenticatedDataCrc32c + */ + + /** + * Constructs a new EncryptRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an EncryptRequest. + * @implements IEncryptRequest + * @constructor + * @param {google.cloud.kms.v1.IEncryptRequest=} [properties] Properties to set + */ + function EncryptRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EncryptRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.EncryptRequest + * @instance + */ + EncryptRequest.prototype.name = ""; + + /** + * EncryptRequest plaintext. + * @member {Uint8Array} plaintext + * @memberof google.cloud.kms.v1.EncryptRequest + * @instance + */ + EncryptRequest.prototype.plaintext = $util.newBuffer([]); + + /** + * EncryptRequest additionalAuthenticatedData. + * @member {Uint8Array} additionalAuthenticatedData + * @memberof google.cloud.kms.v1.EncryptRequest + * @instance + */ + EncryptRequest.prototype.additionalAuthenticatedData = $util.newBuffer([]); + + /** + * EncryptRequest plaintextCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} plaintextCrc32c + * @memberof google.cloud.kms.v1.EncryptRequest + * @instance + */ + EncryptRequest.prototype.plaintextCrc32c = null; + + /** + * EncryptRequest additionalAuthenticatedDataCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} additionalAuthenticatedDataCrc32c + * @memberof google.cloud.kms.v1.EncryptRequest + * @instance + */ + EncryptRequest.prototype.additionalAuthenticatedDataCrc32c = null; + + /** + * Creates a new EncryptRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {google.cloud.kms.v1.IEncryptRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.EncryptRequest} EncryptRequest instance + */ + EncryptRequest.create = function create(properties) { + return new EncryptRequest(properties); + }; + + /** + * Encodes the specified EncryptRequest message. Does not implicitly {@link google.cloud.kms.v1.EncryptRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {google.cloud.kms.v1.IEncryptRequest} message EncryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptRequest.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.plaintext != null && Object.hasOwnProperty.call(message, "plaintext")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.plaintext); + if (message.additionalAuthenticatedData != null && Object.hasOwnProperty.call(message, "additionalAuthenticatedData")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.additionalAuthenticatedData); + if (message.plaintextCrc32c != null && Object.hasOwnProperty.call(message, "plaintextCrc32c")) + $root.google.protobuf.Int64Value.encode(message.plaintextCrc32c, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.additionalAuthenticatedDataCrc32c != null && Object.hasOwnProperty.call(message, "additionalAuthenticatedDataCrc32c")) + $root.google.protobuf.Int64Value.encode(message.additionalAuthenticatedDataCrc32c, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EncryptRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.EncryptRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {google.cloud.kms.v1.IEncryptRequest} message EncryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EncryptRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.EncryptRequest} EncryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.EncryptRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.plaintext = reader.bytes(); + break; + } + case 3: { + message.additionalAuthenticatedData = reader.bytes(); + break; + } + case 7: { + message.plaintextCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 8: { + message.additionalAuthenticatedDataCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EncryptRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.EncryptRequest} EncryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EncryptRequest message. + * @function verify + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EncryptRequest.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.plaintext != null && message.hasOwnProperty("plaintext")) + if (!(message.plaintext && typeof message.plaintext.length === "number" || $util.isString(message.plaintext))) + return "plaintext: buffer expected"; + if (message.additionalAuthenticatedData != null && message.hasOwnProperty("additionalAuthenticatedData")) + if (!(message.additionalAuthenticatedData && typeof message.additionalAuthenticatedData.length === "number" || $util.isString(message.additionalAuthenticatedData))) + return "additionalAuthenticatedData: buffer expected"; + if (message.plaintextCrc32c != null && message.hasOwnProperty("plaintextCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.plaintextCrc32c); + if (error) + return "plaintextCrc32c." + error; + } + if (message.additionalAuthenticatedDataCrc32c != null && message.hasOwnProperty("additionalAuthenticatedDataCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.additionalAuthenticatedDataCrc32c); + if (error) + return "additionalAuthenticatedDataCrc32c." + error; + } + return null; + }; + + /** + * Creates an EncryptRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.EncryptRequest} EncryptRequest + */ + EncryptRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.EncryptRequest) + return object; + var message = new $root.google.cloud.kms.v1.EncryptRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.plaintext != null) + if (typeof object.plaintext === "string") + $util.base64.decode(object.plaintext, message.plaintext = $util.newBuffer($util.base64.length(object.plaintext)), 0); + else if (object.plaintext.length >= 0) + message.plaintext = object.plaintext; + if (object.additionalAuthenticatedData != null) + if (typeof object.additionalAuthenticatedData === "string") + $util.base64.decode(object.additionalAuthenticatedData, message.additionalAuthenticatedData = $util.newBuffer($util.base64.length(object.additionalAuthenticatedData)), 0); + else if (object.additionalAuthenticatedData.length >= 0) + message.additionalAuthenticatedData = object.additionalAuthenticatedData; + if (object.plaintextCrc32c != null) { + if (typeof object.plaintextCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.EncryptRequest.plaintextCrc32c: object expected"); + message.plaintextCrc32c = $root.google.protobuf.Int64Value.fromObject(object.plaintextCrc32c); + } + if (object.additionalAuthenticatedDataCrc32c != null) { + if (typeof object.additionalAuthenticatedDataCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.EncryptRequest.additionalAuthenticatedDataCrc32c: object expected"); + message.additionalAuthenticatedDataCrc32c = $root.google.protobuf.Int64Value.fromObject(object.additionalAuthenticatedDataCrc32c); + } + return message; + }; + + /** + * Creates a plain object from an EncryptRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {google.cloud.kms.v1.EncryptRequest} message EncryptRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EncryptRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if (options.bytes === String) + object.plaintext = ""; + else { + object.plaintext = []; + if (options.bytes !== Array) + object.plaintext = $util.newBuffer(object.plaintext); + } + if (options.bytes === String) + object.additionalAuthenticatedData = ""; + else { + object.additionalAuthenticatedData = []; + if (options.bytes !== Array) + object.additionalAuthenticatedData = $util.newBuffer(object.additionalAuthenticatedData); + } + object.plaintextCrc32c = null; + object.additionalAuthenticatedDataCrc32c = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.plaintext != null && message.hasOwnProperty("plaintext")) + object.plaintext = options.bytes === String ? $util.base64.encode(message.plaintext, 0, message.plaintext.length) : options.bytes === Array ? Array.prototype.slice.call(message.plaintext) : message.plaintext; + if (message.additionalAuthenticatedData != null && message.hasOwnProperty("additionalAuthenticatedData")) + object.additionalAuthenticatedData = options.bytes === String ? $util.base64.encode(message.additionalAuthenticatedData, 0, message.additionalAuthenticatedData.length) : options.bytes === Array ? Array.prototype.slice.call(message.additionalAuthenticatedData) : message.additionalAuthenticatedData; + if (message.plaintextCrc32c != null && message.hasOwnProperty("plaintextCrc32c")) + object.plaintextCrc32c = $root.google.protobuf.Int64Value.toObject(message.plaintextCrc32c, options); + if (message.additionalAuthenticatedDataCrc32c != null && message.hasOwnProperty("additionalAuthenticatedDataCrc32c")) + object.additionalAuthenticatedDataCrc32c = $root.google.protobuf.Int64Value.toObject(message.additionalAuthenticatedDataCrc32c, options); + return object; + }; + + /** + * Converts this EncryptRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.EncryptRequest + * @instance + * @returns {Object.} JSON object + */ + EncryptRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EncryptRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.EncryptRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EncryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.EncryptRequest"; + }; + + return EncryptRequest; + })(); + + v1.DecryptRequest = (function() { + + /** + * Properties of a DecryptRequest. + * @memberof google.cloud.kms.v1 + * @interface IDecryptRequest + * @property {string|null} [name] DecryptRequest name + * @property {Uint8Array|null} [ciphertext] DecryptRequest ciphertext + * @property {Uint8Array|null} [additionalAuthenticatedData] DecryptRequest additionalAuthenticatedData + * @property {google.protobuf.IInt64Value|null} [ciphertextCrc32c] DecryptRequest ciphertextCrc32c + * @property {google.protobuf.IInt64Value|null} [additionalAuthenticatedDataCrc32c] DecryptRequest additionalAuthenticatedDataCrc32c + */ + + /** + * Constructs a new DecryptRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a DecryptRequest. + * @implements IDecryptRequest + * @constructor + * @param {google.cloud.kms.v1.IDecryptRequest=} [properties] Properties to set + */ + function DecryptRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DecryptRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.DecryptRequest + * @instance + */ + DecryptRequest.prototype.name = ""; + + /** + * DecryptRequest ciphertext. + * @member {Uint8Array} ciphertext + * @memberof google.cloud.kms.v1.DecryptRequest + * @instance + */ + DecryptRequest.prototype.ciphertext = $util.newBuffer([]); + + /** + * DecryptRequest additionalAuthenticatedData. + * @member {Uint8Array} additionalAuthenticatedData + * @memberof google.cloud.kms.v1.DecryptRequest + * @instance + */ + DecryptRequest.prototype.additionalAuthenticatedData = $util.newBuffer([]); + + /** + * DecryptRequest ciphertextCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} ciphertextCrc32c + * @memberof google.cloud.kms.v1.DecryptRequest + * @instance + */ + DecryptRequest.prototype.ciphertextCrc32c = null; + + /** + * DecryptRequest additionalAuthenticatedDataCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} additionalAuthenticatedDataCrc32c + * @memberof google.cloud.kms.v1.DecryptRequest + * @instance + */ + DecryptRequest.prototype.additionalAuthenticatedDataCrc32c = null; + + /** + * Creates a new DecryptRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {google.cloud.kms.v1.IDecryptRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.DecryptRequest} DecryptRequest instance + */ + DecryptRequest.create = function create(properties) { + return new DecryptRequest(properties); + }; + + /** + * Encodes the specified DecryptRequest message. Does not implicitly {@link google.cloud.kms.v1.DecryptRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {google.cloud.kms.v1.IDecryptRequest} message DecryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DecryptRequest.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.ciphertext != null && Object.hasOwnProperty.call(message, "ciphertext")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.ciphertext); + if (message.additionalAuthenticatedData != null && Object.hasOwnProperty.call(message, "additionalAuthenticatedData")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.additionalAuthenticatedData); + if (message.ciphertextCrc32c != null && Object.hasOwnProperty.call(message, "ciphertextCrc32c")) + $root.google.protobuf.Int64Value.encode(message.ciphertextCrc32c, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.additionalAuthenticatedDataCrc32c != null && Object.hasOwnProperty.call(message, "additionalAuthenticatedDataCrc32c")) + $root.google.protobuf.Int64Value.encode(message.additionalAuthenticatedDataCrc32c, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DecryptRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.DecryptRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {google.cloud.kms.v1.IDecryptRequest} message DecryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DecryptRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DecryptRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.DecryptRequest} DecryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DecryptRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.DecryptRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.ciphertext = reader.bytes(); + break; + } + case 3: { + message.additionalAuthenticatedData = reader.bytes(); + break; + } + case 5: { + message.ciphertextCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 6: { + message.additionalAuthenticatedDataCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DecryptRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.DecryptRequest} DecryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DecryptRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DecryptRequest message. + * @function verify + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DecryptRequest.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.ciphertext != null && message.hasOwnProperty("ciphertext")) + if (!(message.ciphertext && typeof message.ciphertext.length === "number" || $util.isString(message.ciphertext))) + return "ciphertext: buffer expected"; + if (message.additionalAuthenticatedData != null && message.hasOwnProperty("additionalAuthenticatedData")) + if (!(message.additionalAuthenticatedData && typeof message.additionalAuthenticatedData.length === "number" || $util.isString(message.additionalAuthenticatedData))) + return "additionalAuthenticatedData: buffer expected"; + if (message.ciphertextCrc32c != null && message.hasOwnProperty("ciphertextCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.ciphertextCrc32c); + if (error) + return "ciphertextCrc32c." + error; + } + if (message.additionalAuthenticatedDataCrc32c != null && message.hasOwnProperty("additionalAuthenticatedDataCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.additionalAuthenticatedDataCrc32c); + if (error) + return "additionalAuthenticatedDataCrc32c." + error; + } + return null; + }; + + /** + * Creates a DecryptRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.DecryptRequest} DecryptRequest + */ + DecryptRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.DecryptRequest) + return object; + var message = new $root.google.cloud.kms.v1.DecryptRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.ciphertext != null) + if (typeof object.ciphertext === "string") + $util.base64.decode(object.ciphertext, message.ciphertext = $util.newBuffer($util.base64.length(object.ciphertext)), 0); + else if (object.ciphertext.length >= 0) + message.ciphertext = object.ciphertext; + if (object.additionalAuthenticatedData != null) + if (typeof object.additionalAuthenticatedData === "string") + $util.base64.decode(object.additionalAuthenticatedData, message.additionalAuthenticatedData = $util.newBuffer($util.base64.length(object.additionalAuthenticatedData)), 0); + else if (object.additionalAuthenticatedData.length >= 0) + message.additionalAuthenticatedData = object.additionalAuthenticatedData; + if (object.ciphertextCrc32c != null) { + if (typeof object.ciphertextCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.DecryptRequest.ciphertextCrc32c: object expected"); + message.ciphertextCrc32c = $root.google.protobuf.Int64Value.fromObject(object.ciphertextCrc32c); + } + if (object.additionalAuthenticatedDataCrc32c != null) { + if (typeof object.additionalAuthenticatedDataCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.DecryptRequest.additionalAuthenticatedDataCrc32c: object expected"); + message.additionalAuthenticatedDataCrc32c = $root.google.protobuf.Int64Value.fromObject(object.additionalAuthenticatedDataCrc32c); + } + return message; + }; + + /** + * Creates a plain object from a DecryptRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {google.cloud.kms.v1.DecryptRequest} message DecryptRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DecryptRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if (options.bytes === String) + object.ciphertext = ""; + else { + object.ciphertext = []; + if (options.bytes !== Array) + object.ciphertext = $util.newBuffer(object.ciphertext); + } + if (options.bytes === String) + object.additionalAuthenticatedData = ""; + else { + object.additionalAuthenticatedData = []; + if (options.bytes !== Array) + object.additionalAuthenticatedData = $util.newBuffer(object.additionalAuthenticatedData); + } + object.ciphertextCrc32c = null; + object.additionalAuthenticatedDataCrc32c = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.ciphertext != null && message.hasOwnProperty("ciphertext")) + object.ciphertext = options.bytes === String ? $util.base64.encode(message.ciphertext, 0, message.ciphertext.length) : options.bytes === Array ? Array.prototype.slice.call(message.ciphertext) : message.ciphertext; + if (message.additionalAuthenticatedData != null && message.hasOwnProperty("additionalAuthenticatedData")) + object.additionalAuthenticatedData = options.bytes === String ? $util.base64.encode(message.additionalAuthenticatedData, 0, message.additionalAuthenticatedData.length) : options.bytes === Array ? Array.prototype.slice.call(message.additionalAuthenticatedData) : message.additionalAuthenticatedData; + if (message.ciphertextCrc32c != null && message.hasOwnProperty("ciphertextCrc32c")) + object.ciphertextCrc32c = $root.google.protobuf.Int64Value.toObject(message.ciphertextCrc32c, options); + if (message.additionalAuthenticatedDataCrc32c != null && message.hasOwnProperty("additionalAuthenticatedDataCrc32c")) + object.additionalAuthenticatedDataCrc32c = $root.google.protobuf.Int64Value.toObject(message.additionalAuthenticatedDataCrc32c, options); + return object; + }; + + /** + * Converts this DecryptRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.DecryptRequest + * @instance + * @returns {Object.} JSON object + */ + DecryptRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DecryptRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.DecryptRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DecryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.DecryptRequest"; + }; + + return DecryptRequest; + })(); + + v1.AsymmetricSignRequest = (function() { + + /** + * Properties of an AsymmetricSignRequest. + * @memberof google.cloud.kms.v1 + * @interface IAsymmetricSignRequest + * @property {string|null} [name] AsymmetricSignRequest name + * @property {google.cloud.kms.v1.IDigest|null} [digest] AsymmetricSignRequest digest + * @property {google.protobuf.IInt64Value|null} [digestCrc32c] AsymmetricSignRequest digestCrc32c + * @property {Uint8Array|null} [data] AsymmetricSignRequest data + * @property {google.protobuf.IInt64Value|null} [dataCrc32c] AsymmetricSignRequest dataCrc32c + */ + + /** + * Constructs a new AsymmetricSignRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an AsymmetricSignRequest. + * @implements IAsymmetricSignRequest + * @constructor + * @param {google.cloud.kms.v1.IAsymmetricSignRequest=} [properties] Properties to set + */ + function AsymmetricSignRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AsymmetricSignRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @instance + */ + AsymmetricSignRequest.prototype.name = ""; + + /** + * AsymmetricSignRequest digest. + * @member {google.cloud.kms.v1.IDigest|null|undefined} digest + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @instance + */ + AsymmetricSignRequest.prototype.digest = null; + + /** + * AsymmetricSignRequest digestCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} digestCrc32c + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @instance + */ + AsymmetricSignRequest.prototype.digestCrc32c = null; + + /** + * AsymmetricSignRequest data. + * @member {Uint8Array} data + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @instance + */ + AsymmetricSignRequest.prototype.data = $util.newBuffer([]); + + /** + * AsymmetricSignRequest dataCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} dataCrc32c + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @instance + */ + AsymmetricSignRequest.prototype.dataCrc32c = null; + + /** + * Creates a new AsymmetricSignRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {google.cloud.kms.v1.IAsymmetricSignRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.AsymmetricSignRequest} AsymmetricSignRequest instance + */ + AsymmetricSignRequest.create = function create(properties) { + return new AsymmetricSignRequest(properties); + }; + + /** + * Encodes the specified AsymmetricSignRequest message. Does not implicitly {@link google.cloud.kms.v1.AsymmetricSignRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {google.cloud.kms.v1.IAsymmetricSignRequest} message AsymmetricSignRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AsymmetricSignRequest.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.digest != null && Object.hasOwnProperty.call(message, "digest")) + $root.google.cloud.kms.v1.Digest.encode(message.digest, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.digestCrc32c != null && Object.hasOwnProperty.call(message, "digestCrc32c")) + $root.google.protobuf.Int64Value.encode(message.digestCrc32c, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.data); + if (message.dataCrc32c != null && Object.hasOwnProperty.call(message, "dataCrc32c")) + $root.google.protobuf.Int64Value.encode(message.dataCrc32c, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AsymmetricSignRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.AsymmetricSignRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {google.cloud.kms.v1.IAsymmetricSignRequest} message AsymmetricSignRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AsymmetricSignRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AsymmetricSignRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.AsymmetricSignRequest} AsymmetricSignRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AsymmetricSignRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.AsymmetricSignRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.digest = $root.google.cloud.kms.v1.Digest.decode(reader, reader.uint32()); + break; + } + case 4: { + message.digestCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 6: { + message.data = reader.bytes(); + break; + } + case 7: { + message.dataCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AsymmetricSignRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.AsymmetricSignRequest} AsymmetricSignRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AsymmetricSignRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AsymmetricSignRequest message. + * @function verify + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AsymmetricSignRequest.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.digest != null && message.hasOwnProperty("digest")) { + var error = $root.google.cloud.kms.v1.Digest.verify(message.digest); + if (error) + return "digest." + error; + } + if (message.digestCrc32c != null && message.hasOwnProperty("digestCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.digestCrc32c); + if (error) + return "digestCrc32c." + error; + } + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.dataCrc32c != null && message.hasOwnProperty("dataCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.dataCrc32c); + if (error) + return "dataCrc32c." + error; + } + return null; + }; + + /** + * Creates an AsymmetricSignRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.AsymmetricSignRequest} AsymmetricSignRequest + */ + AsymmetricSignRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.AsymmetricSignRequest) + return object; + var message = new $root.google.cloud.kms.v1.AsymmetricSignRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.digest != null) { + if (typeof object.digest !== "object") + throw TypeError(".google.cloud.kms.v1.AsymmetricSignRequest.digest: object expected"); + message.digest = $root.google.cloud.kms.v1.Digest.fromObject(object.digest); + } + if (object.digestCrc32c != null) { + if (typeof object.digestCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.AsymmetricSignRequest.digestCrc32c: object expected"); + message.digestCrc32c = $root.google.protobuf.Int64Value.fromObject(object.digestCrc32c); + } + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length >= 0) + message.data = object.data; + if (object.dataCrc32c != null) { + if (typeof object.dataCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.AsymmetricSignRequest.dataCrc32c: object expected"); + message.dataCrc32c = $root.google.protobuf.Int64Value.fromObject(object.dataCrc32c); + } + return message; + }; + + /** + * Creates a plain object from an AsymmetricSignRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {google.cloud.kms.v1.AsymmetricSignRequest} message AsymmetricSignRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AsymmetricSignRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.digest = null; + object.digestCrc32c = null; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.dataCrc32c = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.digest != null && message.hasOwnProperty("digest")) + object.digest = $root.google.cloud.kms.v1.Digest.toObject(message.digest, options); + if (message.digestCrc32c != null && message.hasOwnProperty("digestCrc32c")) + object.digestCrc32c = $root.google.protobuf.Int64Value.toObject(message.digestCrc32c, options); + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.dataCrc32c != null && message.hasOwnProperty("dataCrc32c")) + object.dataCrc32c = $root.google.protobuf.Int64Value.toObject(message.dataCrc32c, options); + return object; + }; + + /** + * Converts this AsymmetricSignRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @instance + * @returns {Object.} JSON object + */ + AsymmetricSignRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AsymmetricSignRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.AsymmetricSignRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AsymmetricSignRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.AsymmetricSignRequest"; + }; + + return AsymmetricSignRequest; + })(); + + v1.AsymmetricDecryptRequest = (function() { + + /** + * Properties of an AsymmetricDecryptRequest. + * @memberof google.cloud.kms.v1 + * @interface IAsymmetricDecryptRequest + * @property {string|null} [name] AsymmetricDecryptRequest name + * @property {Uint8Array|null} [ciphertext] AsymmetricDecryptRequest ciphertext + * @property {google.protobuf.IInt64Value|null} [ciphertextCrc32c] AsymmetricDecryptRequest ciphertextCrc32c + */ + + /** + * Constructs a new AsymmetricDecryptRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an AsymmetricDecryptRequest. + * @implements IAsymmetricDecryptRequest + * @constructor + * @param {google.cloud.kms.v1.IAsymmetricDecryptRequest=} [properties] Properties to set + */ + function AsymmetricDecryptRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AsymmetricDecryptRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @instance + */ + AsymmetricDecryptRequest.prototype.name = ""; + + /** + * AsymmetricDecryptRequest ciphertext. + * @member {Uint8Array} ciphertext + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @instance + */ + AsymmetricDecryptRequest.prototype.ciphertext = $util.newBuffer([]); + + /** + * AsymmetricDecryptRequest ciphertextCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} ciphertextCrc32c + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @instance + */ + AsymmetricDecryptRequest.prototype.ciphertextCrc32c = null; + + /** + * Creates a new AsymmetricDecryptRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {google.cloud.kms.v1.IAsymmetricDecryptRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.AsymmetricDecryptRequest} AsymmetricDecryptRequest instance + */ + AsymmetricDecryptRequest.create = function create(properties) { + return new AsymmetricDecryptRequest(properties); + }; + + /** + * Encodes the specified AsymmetricDecryptRequest message. Does not implicitly {@link google.cloud.kms.v1.AsymmetricDecryptRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {google.cloud.kms.v1.IAsymmetricDecryptRequest} message AsymmetricDecryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AsymmetricDecryptRequest.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.ciphertext != null && Object.hasOwnProperty.call(message, "ciphertext")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.ciphertext); + if (message.ciphertextCrc32c != null && Object.hasOwnProperty.call(message, "ciphertextCrc32c")) + $root.google.protobuf.Int64Value.encode(message.ciphertextCrc32c, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AsymmetricDecryptRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.AsymmetricDecryptRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {google.cloud.kms.v1.IAsymmetricDecryptRequest} message AsymmetricDecryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AsymmetricDecryptRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AsymmetricDecryptRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.AsymmetricDecryptRequest} AsymmetricDecryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AsymmetricDecryptRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.AsymmetricDecryptRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.ciphertext = reader.bytes(); + break; + } + case 4: { + message.ciphertextCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AsymmetricDecryptRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.AsymmetricDecryptRequest} AsymmetricDecryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AsymmetricDecryptRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AsymmetricDecryptRequest message. + * @function verify + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AsymmetricDecryptRequest.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.ciphertext != null && message.hasOwnProperty("ciphertext")) + if (!(message.ciphertext && typeof message.ciphertext.length === "number" || $util.isString(message.ciphertext))) + return "ciphertext: buffer expected"; + if (message.ciphertextCrc32c != null && message.hasOwnProperty("ciphertextCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.ciphertextCrc32c); + if (error) + return "ciphertextCrc32c." + error; + } + return null; + }; + + /** + * Creates an AsymmetricDecryptRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.AsymmetricDecryptRequest} AsymmetricDecryptRequest + */ + AsymmetricDecryptRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.AsymmetricDecryptRequest) + return object; + var message = new $root.google.cloud.kms.v1.AsymmetricDecryptRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.ciphertext != null) + if (typeof object.ciphertext === "string") + $util.base64.decode(object.ciphertext, message.ciphertext = $util.newBuffer($util.base64.length(object.ciphertext)), 0); + else if (object.ciphertext.length >= 0) + message.ciphertext = object.ciphertext; + if (object.ciphertextCrc32c != null) { + if (typeof object.ciphertextCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertextCrc32c: object expected"); + message.ciphertextCrc32c = $root.google.protobuf.Int64Value.fromObject(object.ciphertextCrc32c); + } + return message; + }; + + /** + * Creates a plain object from an AsymmetricDecryptRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {google.cloud.kms.v1.AsymmetricDecryptRequest} message AsymmetricDecryptRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AsymmetricDecryptRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if (options.bytes === String) + object.ciphertext = ""; + else { + object.ciphertext = []; + if (options.bytes !== Array) + object.ciphertext = $util.newBuffer(object.ciphertext); + } + object.ciphertextCrc32c = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.ciphertext != null && message.hasOwnProperty("ciphertext")) + object.ciphertext = options.bytes === String ? $util.base64.encode(message.ciphertext, 0, message.ciphertext.length) : options.bytes === Array ? Array.prototype.slice.call(message.ciphertext) : message.ciphertext; + if (message.ciphertextCrc32c != null && message.hasOwnProperty("ciphertextCrc32c")) + object.ciphertextCrc32c = $root.google.protobuf.Int64Value.toObject(message.ciphertextCrc32c, options); + return object; + }; + + /** + * Converts this AsymmetricDecryptRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @instance + * @returns {Object.} JSON object + */ + AsymmetricDecryptRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AsymmetricDecryptRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.AsymmetricDecryptRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AsymmetricDecryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.AsymmetricDecryptRequest"; + }; + + return AsymmetricDecryptRequest; + })(); + + v1.MacSignRequest = (function() { + + /** + * Properties of a MacSignRequest. + * @memberof google.cloud.kms.v1 + * @interface IMacSignRequest + * @property {string|null} [name] MacSignRequest name + * @property {Uint8Array|null} [data] MacSignRequest data + * @property {google.protobuf.IInt64Value|null} [dataCrc32c] MacSignRequest dataCrc32c + */ + + /** + * Constructs a new MacSignRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a MacSignRequest. + * @implements IMacSignRequest + * @constructor + * @param {google.cloud.kms.v1.IMacSignRequest=} [properties] Properties to set + */ + function MacSignRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MacSignRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.MacSignRequest + * @instance + */ + MacSignRequest.prototype.name = ""; + + /** + * MacSignRequest data. + * @member {Uint8Array} data + * @memberof google.cloud.kms.v1.MacSignRequest + * @instance + */ + MacSignRequest.prototype.data = $util.newBuffer([]); + + /** + * MacSignRequest dataCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} dataCrc32c + * @memberof google.cloud.kms.v1.MacSignRequest + * @instance + */ + MacSignRequest.prototype.dataCrc32c = null; + + /** + * Creates a new MacSignRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {google.cloud.kms.v1.IMacSignRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.MacSignRequest} MacSignRequest instance + */ + MacSignRequest.create = function create(properties) { + return new MacSignRequest(properties); + }; + + /** + * Encodes the specified MacSignRequest message. Does not implicitly {@link google.cloud.kms.v1.MacSignRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {google.cloud.kms.v1.IMacSignRequest} message MacSignRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MacSignRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + if (message.dataCrc32c != null && Object.hasOwnProperty.call(message, "dataCrc32c")) + $root.google.protobuf.Int64Value.encode(message.dataCrc32c, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MacSignRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.MacSignRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {google.cloud.kms.v1.IMacSignRequest} message MacSignRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MacSignRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MacSignRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.MacSignRequest} MacSignRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MacSignRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.MacSignRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.data = reader.bytes(); + break; + } + case 3: { + message.dataCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MacSignRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.MacSignRequest} MacSignRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MacSignRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MacSignRequest message. + * @function verify + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MacSignRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.dataCrc32c != null && message.hasOwnProperty("dataCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.dataCrc32c); + if (error) + return "dataCrc32c." + error; + } + return null; + }; + + /** + * Creates a MacSignRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.MacSignRequest} MacSignRequest + */ + MacSignRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.MacSignRequest) + return object; + var message = new $root.google.cloud.kms.v1.MacSignRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length >= 0) + message.data = object.data; + if (object.dataCrc32c != null) { + if (typeof object.dataCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.MacSignRequest.dataCrc32c: object expected"); + message.dataCrc32c = $root.google.protobuf.Int64Value.fromObject(object.dataCrc32c); + } + return message; + }; + + /** + * Creates a plain object from a MacSignRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {google.cloud.kms.v1.MacSignRequest} message MacSignRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MacSignRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.dataCrc32c = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.dataCrc32c != null && message.hasOwnProperty("dataCrc32c")) + object.dataCrc32c = $root.google.protobuf.Int64Value.toObject(message.dataCrc32c, options); + return object; + }; + + /** + * Converts this MacSignRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.MacSignRequest + * @instance + * @returns {Object.} JSON object + */ + MacSignRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MacSignRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.MacSignRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MacSignRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.MacSignRequest"; + }; + + return MacSignRequest; + })(); + + v1.MacVerifyRequest = (function() { + + /** + * Properties of a MacVerifyRequest. + * @memberof google.cloud.kms.v1 + * @interface IMacVerifyRequest + * @property {string|null} [name] MacVerifyRequest name + * @property {Uint8Array|null} [data] MacVerifyRequest data + * @property {google.protobuf.IInt64Value|null} [dataCrc32c] MacVerifyRequest dataCrc32c + * @property {Uint8Array|null} [mac] MacVerifyRequest mac + * @property {google.protobuf.IInt64Value|null} [macCrc32c] MacVerifyRequest macCrc32c + */ + + /** + * Constructs a new MacVerifyRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a MacVerifyRequest. + * @implements IMacVerifyRequest + * @constructor + * @param {google.cloud.kms.v1.IMacVerifyRequest=} [properties] Properties to set + */ + function MacVerifyRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MacVerifyRequest name. + * @member {string} name + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @instance + */ + MacVerifyRequest.prototype.name = ""; + + /** + * MacVerifyRequest data. + * @member {Uint8Array} data + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @instance + */ + MacVerifyRequest.prototype.data = $util.newBuffer([]); + + /** + * MacVerifyRequest dataCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} dataCrc32c + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @instance + */ + MacVerifyRequest.prototype.dataCrc32c = null; + + /** + * MacVerifyRequest mac. + * @member {Uint8Array} mac + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @instance + */ + MacVerifyRequest.prototype.mac = $util.newBuffer([]); + + /** + * MacVerifyRequest macCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} macCrc32c + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @instance + */ + MacVerifyRequest.prototype.macCrc32c = null; + + /** + * Creates a new MacVerifyRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {google.cloud.kms.v1.IMacVerifyRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.MacVerifyRequest} MacVerifyRequest instance + */ + MacVerifyRequest.create = function create(properties) { + return new MacVerifyRequest(properties); + }; + + /** + * Encodes the specified MacVerifyRequest message. Does not implicitly {@link google.cloud.kms.v1.MacVerifyRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {google.cloud.kms.v1.IMacVerifyRequest} message MacVerifyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MacVerifyRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data); + if (message.dataCrc32c != null && Object.hasOwnProperty.call(message, "dataCrc32c")) + $root.google.protobuf.Int64Value.encode(message.dataCrc32c, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.mac != null && Object.hasOwnProperty.call(message, "mac")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.mac); + if (message.macCrc32c != null && Object.hasOwnProperty.call(message, "macCrc32c")) + $root.google.protobuf.Int64Value.encode(message.macCrc32c, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MacVerifyRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.MacVerifyRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {google.cloud.kms.v1.IMacVerifyRequest} message MacVerifyRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MacVerifyRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MacVerifyRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.MacVerifyRequest} MacVerifyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MacVerifyRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.MacVerifyRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.data = reader.bytes(); + break; + } + case 3: { + message.dataCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 4: { + message.mac = reader.bytes(); + break; + } + case 5: { + message.macCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MacVerifyRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.MacVerifyRequest} MacVerifyRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MacVerifyRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MacVerifyRequest message. + * @function verify + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MacVerifyRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.dataCrc32c != null && message.hasOwnProperty("dataCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.dataCrc32c); + if (error) + return "dataCrc32c." + error; + } + if (message.mac != null && message.hasOwnProperty("mac")) + if (!(message.mac && typeof message.mac.length === "number" || $util.isString(message.mac))) + return "mac: buffer expected"; + if (message.macCrc32c != null && message.hasOwnProperty("macCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.macCrc32c); + if (error) + return "macCrc32c." + error; + } + return null; + }; + + /** + * Creates a MacVerifyRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.MacVerifyRequest} MacVerifyRequest + */ + MacVerifyRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.MacVerifyRequest) + return object; + var message = new $root.google.cloud.kms.v1.MacVerifyRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length >= 0) + message.data = object.data; + if (object.dataCrc32c != null) { + if (typeof object.dataCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.MacVerifyRequest.dataCrc32c: object expected"); + message.dataCrc32c = $root.google.protobuf.Int64Value.fromObject(object.dataCrc32c); + } + if (object.mac != null) + if (typeof object.mac === "string") + $util.base64.decode(object.mac, message.mac = $util.newBuffer($util.base64.length(object.mac)), 0); + else if (object.mac.length >= 0) + message.mac = object.mac; + if (object.macCrc32c != null) { + if (typeof object.macCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.MacVerifyRequest.macCrc32c: object expected"); + message.macCrc32c = $root.google.protobuf.Int64Value.fromObject(object.macCrc32c); + } + return message; + }; + + /** + * Creates a plain object from a MacVerifyRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {google.cloud.kms.v1.MacVerifyRequest} message MacVerifyRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MacVerifyRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.dataCrc32c = null; + if (options.bytes === String) + object.mac = ""; + else { + object.mac = []; + if (options.bytes !== Array) + object.mac = $util.newBuffer(object.mac); + } + object.macCrc32c = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.dataCrc32c != null && message.hasOwnProperty("dataCrc32c")) + object.dataCrc32c = $root.google.protobuf.Int64Value.toObject(message.dataCrc32c, options); + if (message.mac != null && message.hasOwnProperty("mac")) + object.mac = options.bytes === String ? $util.base64.encode(message.mac, 0, message.mac.length) : options.bytes === Array ? Array.prototype.slice.call(message.mac) : message.mac; + if (message.macCrc32c != null && message.hasOwnProperty("macCrc32c")) + object.macCrc32c = $root.google.protobuf.Int64Value.toObject(message.macCrc32c, options); + return object; + }; + + /** + * Converts this MacVerifyRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @instance + * @returns {Object.} JSON object + */ + MacVerifyRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MacVerifyRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.MacVerifyRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MacVerifyRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.MacVerifyRequest"; + }; + + return MacVerifyRequest; + })(); + + v1.GenerateRandomBytesRequest = (function() { + + /** + * Properties of a GenerateRandomBytesRequest. + * @memberof google.cloud.kms.v1 + * @interface IGenerateRandomBytesRequest + * @property {string|null} [location] GenerateRandomBytesRequest location + * @property {number|null} [lengthBytes] GenerateRandomBytesRequest lengthBytes + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] GenerateRandomBytesRequest protectionLevel + */ + + /** + * Constructs a new GenerateRandomBytesRequest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a GenerateRandomBytesRequest. + * @implements IGenerateRandomBytesRequest + * @constructor + * @param {google.cloud.kms.v1.IGenerateRandomBytesRequest=} [properties] Properties to set + */ + function GenerateRandomBytesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateRandomBytesRequest location. + * @member {string} location + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @instance + */ + GenerateRandomBytesRequest.prototype.location = ""; + + /** + * GenerateRandomBytesRequest lengthBytes. + * @member {number} lengthBytes + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @instance + */ + GenerateRandomBytesRequest.prototype.lengthBytes = 0; + + /** + * GenerateRandomBytesRequest protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @instance + */ + GenerateRandomBytesRequest.prototype.protectionLevel = 0; + + /** + * Creates a new GenerateRandomBytesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {google.cloud.kms.v1.IGenerateRandomBytesRequest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.GenerateRandomBytesRequest} GenerateRandomBytesRequest instance + */ + GenerateRandomBytesRequest.create = function create(properties) { + return new GenerateRandomBytesRequest(properties); + }; + + /** + * Encodes the specified GenerateRandomBytesRequest message. Does not implicitly {@link google.cloud.kms.v1.GenerateRandomBytesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {google.cloud.kms.v1.IGenerateRandomBytesRequest} message GenerateRandomBytesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateRandomBytesRequest.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.lengthBytes != null && Object.hasOwnProperty.call(message, "lengthBytes")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.lengthBytes); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.protectionLevel); + return writer; + }; + + /** + * Encodes the specified GenerateRandomBytesRequest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GenerateRandomBytesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {google.cloud.kms.v1.IGenerateRandomBytesRequest} message GenerateRandomBytesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateRandomBytesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateRandomBytesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.GenerateRandomBytesRequest} GenerateRandomBytesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateRandomBytesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.GenerateRandomBytesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.location = reader.string(); + break; + } + case 2: { + message.lengthBytes = reader.int32(); + break; + } + case 3: { + message.protectionLevel = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateRandomBytesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.GenerateRandomBytesRequest} GenerateRandomBytesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateRandomBytesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateRandomBytesRequest message. + * @function verify + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateRandomBytesRequest.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.lengthBytes != null && message.hasOwnProperty("lengthBytes")) + if (!$util.isInteger(message.lengthBytes)) + return "lengthBytes: integer expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a GenerateRandomBytesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.GenerateRandomBytesRequest} GenerateRandomBytesRequest + */ + GenerateRandomBytesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.GenerateRandomBytesRequest) + return object; + var message = new $root.google.cloud.kms.v1.GenerateRandomBytesRequest(); + if (object.location != null) + message.location = String(object.location); + if (object.lengthBytes != null) + message.lengthBytes = object.lengthBytes | 0; + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a GenerateRandomBytesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {google.cloud.kms.v1.GenerateRandomBytesRequest} message GenerateRandomBytesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateRandomBytesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.location = ""; + object.lengthBytes = 0; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + } + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.lengthBytes != null && message.hasOwnProperty("lengthBytes")) + object.lengthBytes = message.lengthBytes; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + return object; + }; + + /** + * Converts this GenerateRandomBytesRequest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateRandomBytesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenerateRandomBytesRequest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.GenerateRandomBytesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateRandomBytesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.GenerateRandomBytesRequest"; + }; + + return GenerateRandomBytesRequest; + })(); + + v1.EncryptResponse = (function() { + + /** + * Properties of an EncryptResponse. + * @memberof google.cloud.kms.v1 + * @interface IEncryptResponse + * @property {string|null} [name] EncryptResponse name + * @property {Uint8Array|null} [ciphertext] EncryptResponse ciphertext + * @property {google.protobuf.IInt64Value|null} [ciphertextCrc32c] EncryptResponse ciphertextCrc32c + * @property {boolean|null} [verifiedPlaintextCrc32c] EncryptResponse verifiedPlaintextCrc32c + * @property {boolean|null} [verifiedAdditionalAuthenticatedDataCrc32c] EncryptResponse verifiedAdditionalAuthenticatedDataCrc32c + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] EncryptResponse protectionLevel + */ + + /** + * Constructs a new EncryptResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an EncryptResponse. + * @implements IEncryptResponse + * @constructor + * @param {google.cloud.kms.v1.IEncryptResponse=} [properties] Properties to set + */ + function EncryptResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EncryptResponse name. + * @member {string} name + * @memberof google.cloud.kms.v1.EncryptResponse + * @instance + */ + EncryptResponse.prototype.name = ""; + + /** + * EncryptResponse ciphertext. + * @member {Uint8Array} ciphertext + * @memberof google.cloud.kms.v1.EncryptResponse + * @instance + */ + EncryptResponse.prototype.ciphertext = $util.newBuffer([]); + + /** + * EncryptResponse ciphertextCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} ciphertextCrc32c + * @memberof google.cloud.kms.v1.EncryptResponse + * @instance + */ + EncryptResponse.prototype.ciphertextCrc32c = null; + + /** + * EncryptResponse verifiedPlaintextCrc32c. + * @member {boolean} verifiedPlaintextCrc32c + * @memberof google.cloud.kms.v1.EncryptResponse + * @instance + */ + EncryptResponse.prototype.verifiedPlaintextCrc32c = false; + + /** + * EncryptResponse verifiedAdditionalAuthenticatedDataCrc32c. + * @member {boolean} verifiedAdditionalAuthenticatedDataCrc32c + * @memberof google.cloud.kms.v1.EncryptResponse + * @instance + */ + EncryptResponse.prototype.verifiedAdditionalAuthenticatedDataCrc32c = false; + + /** + * EncryptResponse protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.EncryptResponse + * @instance + */ + EncryptResponse.prototype.protectionLevel = 0; + + /** + * Creates a new EncryptResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {google.cloud.kms.v1.IEncryptResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.EncryptResponse} EncryptResponse instance + */ + EncryptResponse.create = function create(properties) { + return new EncryptResponse(properties); + }; + + /** + * Encodes the specified EncryptResponse message. Does not implicitly {@link google.cloud.kms.v1.EncryptResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {google.cloud.kms.v1.IEncryptResponse} message EncryptResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptResponse.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.ciphertext != null && Object.hasOwnProperty.call(message, "ciphertext")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.ciphertext); + if (message.ciphertextCrc32c != null && Object.hasOwnProperty.call(message, "ciphertextCrc32c")) + $root.google.protobuf.Int64Value.encode(message.ciphertextCrc32c, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.verifiedPlaintextCrc32c != null && Object.hasOwnProperty.call(message, "verifiedPlaintextCrc32c")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.verifiedPlaintextCrc32c); + if (message.verifiedAdditionalAuthenticatedDataCrc32c != null && Object.hasOwnProperty.call(message, "verifiedAdditionalAuthenticatedDataCrc32c")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.verifiedAdditionalAuthenticatedDataCrc32c); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.protectionLevel); + return writer; + }; + + /** + * Encodes the specified EncryptResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.EncryptResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {google.cloud.kms.v1.IEncryptResponse} message EncryptResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EncryptResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.EncryptResponse} EncryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.EncryptResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.ciphertext = reader.bytes(); + break; + } + case 4: { + message.ciphertextCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 5: { + message.verifiedPlaintextCrc32c = reader.bool(); + break; + } + case 6: { + message.verifiedAdditionalAuthenticatedDataCrc32c = reader.bool(); + break; + } + case 7: { + message.protectionLevel = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EncryptResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.EncryptResponse} EncryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EncryptResponse message. + * @function verify + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EncryptResponse.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.ciphertext != null && message.hasOwnProperty("ciphertext")) + if (!(message.ciphertext && typeof message.ciphertext.length === "number" || $util.isString(message.ciphertext))) + return "ciphertext: buffer expected"; + if (message.ciphertextCrc32c != null && message.hasOwnProperty("ciphertextCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.ciphertextCrc32c); + if (error) + return "ciphertextCrc32c." + error; + } + if (message.verifiedPlaintextCrc32c != null && message.hasOwnProperty("verifiedPlaintextCrc32c")) + if (typeof message.verifiedPlaintextCrc32c !== "boolean") + return "verifiedPlaintextCrc32c: boolean expected"; + if (message.verifiedAdditionalAuthenticatedDataCrc32c != null && message.hasOwnProperty("verifiedAdditionalAuthenticatedDataCrc32c")) + if (typeof message.verifiedAdditionalAuthenticatedDataCrc32c !== "boolean") + return "verifiedAdditionalAuthenticatedDataCrc32c: boolean expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates an EncryptResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.EncryptResponse} EncryptResponse + */ + EncryptResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.EncryptResponse) + return object; + var message = new $root.google.cloud.kms.v1.EncryptResponse(); + if (object.name != null) + message.name = String(object.name); + if (object.ciphertext != null) + if (typeof object.ciphertext === "string") + $util.base64.decode(object.ciphertext, message.ciphertext = $util.newBuffer($util.base64.length(object.ciphertext)), 0); + else if (object.ciphertext.length >= 0) + message.ciphertext = object.ciphertext; + if (object.ciphertextCrc32c != null) { + if (typeof object.ciphertextCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.EncryptResponse.ciphertextCrc32c: object expected"); + message.ciphertextCrc32c = $root.google.protobuf.Int64Value.fromObject(object.ciphertextCrc32c); + } + if (object.verifiedPlaintextCrc32c != null) + message.verifiedPlaintextCrc32c = Boolean(object.verifiedPlaintextCrc32c); + if (object.verifiedAdditionalAuthenticatedDataCrc32c != null) + message.verifiedAdditionalAuthenticatedDataCrc32c = Boolean(object.verifiedAdditionalAuthenticatedDataCrc32c); + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from an EncryptResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {google.cloud.kms.v1.EncryptResponse} message EncryptResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EncryptResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if (options.bytes === String) + object.ciphertext = ""; + else { + object.ciphertext = []; + if (options.bytes !== Array) + object.ciphertext = $util.newBuffer(object.ciphertext); + } + object.ciphertextCrc32c = null; + object.verifiedPlaintextCrc32c = false; + object.verifiedAdditionalAuthenticatedDataCrc32c = false; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.ciphertext != null && message.hasOwnProperty("ciphertext")) + object.ciphertext = options.bytes === String ? $util.base64.encode(message.ciphertext, 0, message.ciphertext.length) : options.bytes === Array ? Array.prototype.slice.call(message.ciphertext) : message.ciphertext; + if (message.ciphertextCrc32c != null && message.hasOwnProperty("ciphertextCrc32c")) + object.ciphertextCrc32c = $root.google.protobuf.Int64Value.toObject(message.ciphertextCrc32c, options); + if (message.verifiedPlaintextCrc32c != null && message.hasOwnProperty("verifiedPlaintextCrc32c")) + object.verifiedPlaintextCrc32c = message.verifiedPlaintextCrc32c; + if (message.verifiedAdditionalAuthenticatedDataCrc32c != null && message.hasOwnProperty("verifiedAdditionalAuthenticatedDataCrc32c")) + object.verifiedAdditionalAuthenticatedDataCrc32c = message.verifiedAdditionalAuthenticatedDataCrc32c; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + return object; + }; + + /** + * Converts this EncryptResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.EncryptResponse + * @instance + * @returns {Object.} JSON object + */ + EncryptResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EncryptResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.EncryptResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EncryptResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.EncryptResponse"; + }; + + return EncryptResponse; + })(); + + v1.DecryptResponse = (function() { + + /** + * Properties of a DecryptResponse. + * @memberof google.cloud.kms.v1 + * @interface IDecryptResponse + * @property {Uint8Array|null} [plaintext] DecryptResponse plaintext + * @property {google.protobuf.IInt64Value|null} [plaintextCrc32c] DecryptResponse plaintextCrc32c + * @property {boolean|null} [usedPrimary] DecryptResponse usedPrimary + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] DecryptResponse protectionLevel + */ + + /** + * Constructs a new DecryptResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a DecryptResponse. + * @implements IDecryptResponse + * @constructor + * @param {google.cloud.kms.v1.IDecryptResponse=} [properties] Properties to set + */ + function DecryptResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DecryptResponse plaintext. + * @member {Uint8Array} plaintext + * @memberof google.cloud.kms.v1.DecryptResponse + * @instance + */ + DecryptResponse.prototype.plaintext = $util.newBuffer([]); + + /** + * DecryptResponse plaintextCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} plaintextCrc32c + * @memberof google.cloud.kms.v1.DecryptResponse + * @instance + */ + DecryptResponse.prototype.plaintextCrc32c = null; + + /** + * DecryptResponse usedPrimary. + * @member {boolean} usedPrimary + * @memberof google.cloud.kms.v1.DecryptResponse + * @instance + */ + DecryptResponse.prototype.usedPrimary = false; + + /** + * DecryptResponse protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.DecryptResponse + * @instance + */ + DecryptResponse.prototype.protectionLevel = 0; + + /** + * Creates a new DecryptResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {google.cloud.kms.v1.IDecryptResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.DecryptResponse} DecryptResponse instance + */ + DecryptResponse.create = function create(properties) { + return new DecryptResponse(properties); + }; + + /** + * Encodes the specified DecryptResponse message. Does not implicitly {@link google.cloud.kms.v1.DecryptResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {google.cloud.kms.v1.IDecryptResponse} message DecryptResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DecryptResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.plaintext != null && Object.hasOwnProperty.call(message, "plaintext")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.plaintext); + if (message.plaintextCrc32c != null && Object.hasOwnProperty.call(message, "plaintextCrc32c")) + $root.google.protobuf.Int64Value.encode(message.plaintextCrc32c, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.usedPrimary != null && Object.hasOwnProperty.call(message, "usedPrimary")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.usedPrimary); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.protectionLevel); + return writer; + }; + + /** + * Encodes the specified DecryptResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.DecryptResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {google.cloud.kms.v1.IDecryptResponse} message DecryptResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DecryptResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DecryptResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.DecryptResponse} DecryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DecryptResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.DecryptResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.plaintext = reader.bytes(); + break; + } + case 2: { + message.plaintextCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 3: { + message.usedPrimary = reader.bool(); + break; + } + case 4: { + message.protectionLevel = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DecryptResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.DecryptResponse} DecryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DecryptResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DecryptResponse message. + * @function verify + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DecryptResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.plaintext != null && message.hasOwnProperty("plaintext")) + if (!(message.plaintext && typeof message.plaintext.length === "number" || $util.isString(message.plaintext))) + return "plaintext: buffer expected"; + if (message.plaintextCrc32c != null && message.hasOwnProperty("plaintextCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.plaintextCrc32c); + if (error) + return "plaintextCrc32c." + error; + } + if (message.usedPrimary != null && message.hasOwnProperty("usedPrimary")) + if (typeof message.usedPrimary !== "boolean") + return "usedPrimary: boolean expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a DecryptResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.DecryptResponse} DecryptResponse + */ + DecryptResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.DecryptResponse) + return object; + var message = new $root.google.cloud.kms.v1.DecryptResponse(); + if (object.plaintext != null) + if (typeof object.plaintext === "string") + $util.base64.decode(object.plaintext, message.plaintext = $util.newBuffer($util.base64.length(object.plaintext)), 0); + else if (object.plaintext.length >= 0) + message.plaintext = object.plaintext; + if (object.plaintextCrc32c != null) { + if (typeof object.plaintextCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.DecryptResponse.plaintextCrc32c: object expected"); + message.plaintextCrc32c = $root.google.protobuf.Int64Value.fromObject(object.plaintextCrc32c); + } + if (object.usedPrimary != null) + message.usedPrimary = Boolean(object.usedPrimary); + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a DecryptResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {google.cloud.kms.v1.DecryptResponse} message DecryptResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DecryptResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.plaintext = ""; + else { + object.plaintext = []; + if (options.bytes !== Array) + object.plaintext = $util.newBuffer(object.plaintext); + } + object.plaintextCrc32c = null; + object.usedPrimary = false; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + } + if (message.plaintext != null && message.hasOwnProperty("plaintext")) + object.plaintext = options.bytes === String ? $util.base64.encode(message.plaintext, 0, message.plaintext.length) : options.bytes === Array ? Array.prototype.slice.call(message.plaintext) : message.plaintext; + if (message.plaintextCrc32c != null && message.hasOwnProperty("plaintextCrc32c")) + object.plaintextCrc32c = $root.google.protobuf.Int64Value.toObject(message.plaintextCrc32c, options); + if (message.usedPrimary != null && message.hasOwnProperty("usedPrimary")) + object.usedPrimary = message.usedPrimary; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + return object; + }; + + /** + * Converts this DecryptResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.DecryptResponse + * @instance + * @returns {Object.} JSON object + */ + DecryptResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DecryptResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.DecryptResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DecryptResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.DecryptResponse"; + }; + + return DecryptResponse; + })(); + + v1.AsymmetricSignResponse = (function() { + + /** + * Properties of an AsymmetricSignResponse. + * @memberof google.cloud.kms.v1 + * @interface IAsymmetricSignResponse + * @property {Uint8Array|null} [signature] AsymmetricSignResponse signature + * @property {google.protobuf.IInt64Value|null} [signatureCrc32c] AsymmetricSignResponse signatureCrc32c + * @property {boolean|null} [verifiedDigestCrc32c] AsymmetricSignResponse verifiedDigestCrc32c + * @property {string|null} [name] AsymmetricSignResponse name + * @property {boolean|null} [verifiedDataCrc32c] AsymmetricSignResponse verifiedDataCrc32c + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] AsymmetricSignResponse protectionLevel + */ + + /** + * Constructs a new AsymmetricSignResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an AsymmetricSignResponse. + * @implements IAsymmetricSignResponse + * @constructor + * @param {google.cloud.kms.v1.IAsymmetricSignResponse=} [properties] Properties to set + */ + function AsymmetricSignResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AsymmetricSignResponse signature. + * @member {Uint8Array} signature + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @instance + */ + AsymmetricSignResponse.prototype.signature = $util.newBuffer([]); + + /** + * AsymmetricSignResponse signatureCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} signatureCrc32c + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @instance + */ + AsymmetricSignResponse.prototype.signatureCrc32c = null; + + /** + * AsymmetricSignResponse verifiedDigestCrc32c. + * @member {boolean} verifiedDigestCrc32c + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @instance + */ + AsymmetricSignResponse.prototype.verifiedDigestCrc32c = false; + + /** + * AsymmetricSignResponse name. + * @member {string} name + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @instance + */ + AsymmetricSignResponse.prototype.name = ""; + + /** + * AsymmetricSignResponse verifiedDataCrc32c. + * @member {boolean} verifiedDataCrc32c + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @instance + */ + AsymmetricSignResponse.prototype.verifiedDataCrc32c = false; + + /** + * AsymmetricSignResponse protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @instance + */ + AsymmetricSignResponse.prototype.protectionLevel = 0; + + /** + * Creates a new AsymmetricSignResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {google.cloud.kms.v1.IAsymmetricSignResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.AsymmetricSignResponse} AsymmetricSignResponse instance + */ + AsymmetricSignResponse.create = function create(properties) { + return new AsymmetricSignResponse(properties); + }; + + /** + * Encodes the specified AsymmetricSignResponse message. Does not implicitly {@link google.cloud.kms.v1.AsymmetricSignResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {google.cloud.kms.v1.IAsymmetricSignResponse} message AsymmetricSignResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AsymmetricSignResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.signature != null && Object.hasOwnProperty.call(message, "signature")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.signature); + if (message.signatureCrc32c != null && Object.hasOwnProperty.call(message, "signatureCrc32c")) + $root.google.protobuf.Int64Value.encode(message.signatureCrc32c, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.verifiedDigestCrc32c != null && Object.hasOwnProperty.call(message, "verifiedDigestCrc32c")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.verifiedDigestCrc32c); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + if (message.verifiedDataCrc32c != null && Object.hasOwnProperty.call(message, "verifiedDataCrc32c")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.verifiedDataCrc32c); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.protectionLevel); + return writer; + }; + + /** + * Encodes the specified AsymmetricSignResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.AsymmetricSignResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {google.cloud.kms.v1.IAsymmetricSignResponse} message AsymmetricSignResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AsymmetricSignResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AsymmetricSignResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.AsymmetricSignResponse} AsymmetricSignResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AsymmetricSignResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.AsymmetricSignResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.signature = reader.bytes(); + break; + } + case 2: { + message.signatureCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 3: { + message.verifiedDigestCrc32c = reader.bool(); + break; + } + case 4: { + message.name = reader.string(); + break; + } + case 5: { + message.verifiedDataCrc32c = reader.bool(); + break; + } + case 6: { + message.protectionLevel = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AsymmetricSignResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.AsymmetricSignResponse} AsymmetricSignResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AsymmetricSignResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AsymmetricSignResponse message. + * @function verify + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AsymmetricSignResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.signature != null && message.hasOwnProperty("signature")) + if (!(message.signature && typeof message.signature.length === "number" || $util.isString(message.signature))) + return "signature: buffer expected"; + if (message.signatureCrc32c != null && message.hasOwnProperty("signatureCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.signatureCrc32c); + if (error) + return "signatureCrc32c." + error; + } + if (message.verifiedDigestCrc32c != null && message.hasOwnProperty("verifiedDigestCrc32c")) + if (typeof message.verifiedDigestCrc32c !== "boolean") + return "verifiedDigestCrc32c: boolean expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.verifiedDataCrc32c != null && message.hasOwnProperty("verifiedDataCrc32c")) + if (typeof message.verifiedDataCrc32c !== "boolean") + return "verifiedDataCrc32c: boolean expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates an AsymmetricSignResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.AsymmetricSignResponse} AsymmetricSignResponse + */ + AsymmetricSignResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.AsymmetricSignResponse) + return object; + var message = new $root.google.cloud.kms.v1.AsymmetricSignResponse(); + if (object.signature != null) + if (typeof object.signature === "string") + $util.base64.decode(object.signature, message.signature = $util.newBuffer($util.base64.length(object.signature)), 0); + else if (object.signature.length >= 0) + message.signature = object.signature; + if (object.signatureCrc32c != null) { + if (typeof object.signatureCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.AsymmetricSignResponse.signatureCrc32c: object expected"); + message.signatureCrc32c = $root.google.protobuf.Int64Value.fromObject(object.signatureCrc32c); + } + if (object.verifiedDigestCrc32c != null) + message.verifiedDigestCrc32c = Boolean(object.verifiedDigestCrc32c); + if (object.name != null) + message.name = String(object.name); + if (object.verifiedDataCrc32c != null) + message.verifiedDataCrc32c = Boolean(object.verifiedDataCrc32c); + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from an AsymmetricSignResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {google.cloud.kms.v1.AsymmetricSignResponse} message AsymmetricSignResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AsymmetricSignResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.signature = ""; + else { + object.signature = []; + if (options.bytes !== Array) + object.signature = $util.newBuffer(object.signature); + } + object.signatureCrc32c = null; + object.verifiedDigestCrc32c = false; + object.name = ""; + object.verifiedDataCrc32c = false; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + } + if (message.signature != null && message.hasOwnProperty("signature")) + object.signature = options.bytes === String ? $util.base64.encode(message.signature, 0, message.signature.length) : options.bytes === Array ? Array.prototype.slice.call(message.signature) : message.signature; + if (message.signatureCrc32c != null && message.hasOwnProperty("signatureCrc32c")) + object.signatureCrc32c = $root.google.protobuf.Int64Value.toObject(message.signatureCrc32c, options); + if (message.verifiedDigestCrc32c != null && message.hasOwnProperty("verifiedDigestCrc32c")) + object.verifiedDigestCrc32c = message.verifiedDigestCrc32c; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.verifiedDataCrc32c != null && message.hasOwnProperty("verifiedDataCrc32c")) + object.verifiedDataCrc32c = message.verifiedDataCrc32c; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + return object; + }; + + /** + * Converts this AsymmetricSignResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @instance + * @returns {Object.} JSON object + */ + AsymmetricSignResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AsymmetricSignResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.AsymmetricSignResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AsymmetricSignResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.AsymmetricSignResponse"; + }; + + return AsymmetricSignResponse; + })(); + + v1.AsymmetricDecryptResponse = (function() { + + /** + * Properties of an AsymmetricDecryptResponse. + * @memberof google.cloud.kms.v1 + * @interface IAsymmetricDecryptResponse + * @property {Uint8Array|null} [plaintext] AsymmetricDecryptResponse plaintext + * @property {google.protobuf.IInt64Value|null} [plaintextCrc32c] AsymmetricDecryptResponse plaintextCrc32c + * @property {boolean|null} [verifiedCiphertextCrc32c] AsymmetricDecryptResponse verifiedCiphertextCrc32c + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] AsymmetricDecryptResponse protectionLevel + */ + + /** + * Constructs a new AsymmetricDecryptResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents an AsymmetricDecryptResponse. + * @implements IAsymmetricDecryptResponse + * @constructor + * @param {google.cloud.kms.v1.IAsymmetricDecryptResponse=} [properties] Properties to set + */ + function AsymmetricDecryptResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AsymmetricDecryptResponse plaintext. + * @member {Uint8Array} plaintext + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @instance + */ + AsymmetricDecryptResponse.prototype.plaintext = $util.newBuffer([]); + + /** + * AsymmetricDecryptResponse plaintextCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} plaintextCrc32c + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @instance + */ + AsymmetricDecryptResponse.prototype.plaintextCrc32c = null; + + /** + * AsymmetricDecryptResponse verifiedCiphertextCrc32c. + * @member {boolean} verifiedCiphertextCrc32c + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @instance + */ + AsymmetricDecryptResponse.prototype.verifiedCiphertextCrc32c = false; + + /** + * AsymmetricDecryptResponse protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @instance + */ + AsymmetricDecryptResponse.prototype.protectionLevel = 0; + + /** + * Creates a new AsymmetricDecryptResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {google.cloud.kms.v1.IAsymmetricDecryptResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.AsymmetricDecryptResponse} AsymmetricDecryptResponse instance + */ + AsymmetricDecryptResponse.create = function create(properties) { + return new AsymmetricDecryptResponse(properties); + }; + + /** + * Encodes the specified AsymmetricDecryptResponse message. Does not implicitly {@link google.cloud.kms.v1.AsymmetricDecryptResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {google.cloud.kms.v1.IAsymmetricDecryptResponse} message AsymmetricDecryptResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AsymmetricDecryptResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.plaintext != null && Object.hasOwnProperty.call(message, "plaintext")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.plaintext); + if (message.plaintextCrc32c != null && Object.hasOwnProperty.call(message, "plaintextCrc32c")) + $root.google.protobuf.Int64Value.encode(message.plaintextCrc32c, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.verifiedCiphertextCrc32c != null && Object.hasOwnProperty.call(message, "verifiedCiphertextCrc32c")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.verifiedCiphertextCrc32c); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.protectionLevel); + return writer; + }; + + /** + * Encodes the specified AsymmetricDecryptResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.AsymmetricDecryptResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {google.cloud.kms.v1.IAsymmetricDecryptResponse} message AsymmetricDecryptResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AsymmetricDecryptResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AsymmetricDecryptResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.AsymmetricDecryptResponse} AsymmetricDecryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AsymmetricDecryptResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.AsymmetricDecryptResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.plaintext = reader.bytes(); + break; + } + case 2: { + message.plaintextCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 3: { + message.verifiedCiphertextCrc32c = reader.bool(); + break; + } + case 4: { + message.protectionLevel = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AsymmetricDecryptResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.AsymmetricDecryptResponse} AsymmetricDecryptResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AsymmetricDecryptResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AsymmetricDecryptResponse message. + * @function verify + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AsymmetricDecryptResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.plaintext != null && message.hasOwnProperty("plaintext")) + if (!(message.plaintext && typeof message.plaintext.length === "number" || $util.isString(message.plaintext))) + return "plaintext: buffer expected"; + if (message.plaintextCrc32c != null && message.hasOwnProperty("plaintextCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.plaintextCrc32c); + if (error) + return "plaintextCrc32c." + error; + } + if (message.verifiedCiphertextCrc32c != null && message.hasOwnProperty("verifiedCiphertextCrc32c")) + if (typeof message.verifiedCiphertextCrc32c !== "boolean") + return "verifiedCiphertextCrc32c: boolean expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates an AsymmetricDecryptResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.AsymmetricDecryptResponse} AsymmetricDecryptResponse + */ + AsymmetricDecryptResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.AsymmetricDecryptResponse) + return object; + var message = new $root.google.cloud.kms.v1.AsymmetricDecryptResponse(); + if (object.plaintext != null) + if (typeof object.plaintext === "string") + $util.base64.decode(object.plaintext, message.plaintext = $util.newBuffer($util.base64.length(object.plaintext)), 0); + else if (object.plaintext.length >= 0) + message.plaintext = object.plaintext; + if (object.plaintextCrc32c != null) { + if (typeof object.plaintextCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.AsymmetricDecryptResponse.plaintextCrc32c: object expected"); + message.plaintextCrc32c = $root.google.protobuf.Int64Value.fromObject(object.plaintextCrc32c); + } + if (object.verifiedCiphertextCrc32c != null) + message.verifiedCiphertextCrc32c = Boolean(object.verifiedCiphertextCrc32c); + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from an AsymmetricDecryptResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {google.cloud.kms.v1.AsymmetricDecryptResponse} message AsymmetricDecryptResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AsymmetricDecryptResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.plaintext = ""; + else { + object.plaintext = []; + if (options.bytes !== Array) + object.plaintext = $util.newBuffer(object.plaintext); + } + object.plaintextCrc32c = null; + object.verifiedCiphertextCrc32c = false; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + } + if (message.plaintext != null && message.hasOwnProperty("plaintext")) + object.plaintext = options.bytes === String ? $util.base64.encode(message.plaintext, 0, message.plaintext.length) : options.bytes === Array ? Array.prototype.slice.call(message.plaintext) : message.plaintext; + if (message.plaintextCrc32c != null && message.hasOwnProperty("plaintextCrc32c")) + object.plaintextCrc32c = $root.google.protobuf.Int64Value.toObject(message.plaintextCrc32c, options); + if (message.verifiedCiphertextCrc32c != null && message.hasOwnProperty("verifiedCiphertextCrc32c")) + object.verifiedCiphertextCrc32c = message.verifiedCiphertextCrc32c; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + return object; + }; + + /** + * Converts this AsymmetricDecryptResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @instance + * @returns {Object.} JSON object + */ + AsymmetricDecryptResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AsymmetricDecryptResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.AsymmetricDecryptResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AsymmetricDecryptResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.AsymmetricDecryptResponse"; + }; + + return AsymmetricDecryptResponse; + })(); + + v1.MacSignResponse = (function() { + + /** + * Properties of a MacSignResponse. + * @memberof google.cloud.kms.v1 + * @interface IMacSignResponse + * @property {string|null} [name] MacSignResponse name + * @property {Uint8Array|null} [mac] MacSignResponse mac + * @property {google.protobuf.IInt64Value|null} [macCrc32c] MacSignResponse macCrc32c + * @property {boolean|null} [verifiedDataCrc32c] MacSignResponse verifiedDataCrc32c + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] MacSignResponse protectionLevel + */ + + /** + * Constructs a new MacSignResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a MacSignResponse. + * @implements IMacSignResponse + * @constructor + * @param {google.cloud.kms.v1.IMacSignResponse=} [properties] Properties to set + */ + function MacSignResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MacSignResponse name. + * @member {string} name + * @memberof google.cloud.kms.v1.MacSignResponse + * @instance + */ + MacSignResponse.prototype.name = ""; + + /** + * MacSignResponse mac. + * @member {Uint8Array} mac + * @memberof google.cloud.kms.v1.MacSignResponse + * @instance + */ + MacSignResponse.prototype.mac = $util.newBuffer([]); + + /** + * MacSignResponse macCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} macCrc32c + * @memberof google.cloud.kms.v1.MacSignResponse + * @instance + */ + MacSignResponse.prototype.macCrc32c = null; + + /** + * MacSignResponse verifiedDataCrc32c. + * @member {boolean} verifiedDataCrc32c + * @memberof google.cloud.kms.v1.MacSignResponse + * @instance + */ + MacSignResponse.prototype.verifiedDataCrc32c = false; + + /** + * MacSignResponse protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.MacSignResponse + * @instance + */ + MacSignResponse.prototype.protectionLevel = 0; + + /** + * Creates a new MacSignResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {google.cloud.kms.v1.IMacSignResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.MacSignResponse} MacSignResponse instance + */ + MacSignResponse.create = function create(properties) { + return new MacSignResponse(properties); + }; + + /** + * Encodes the specified MacSignResponse message. Does not implicitly {@link google.cloud.kms.v1.MacSignResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {google.cloud.kms.v1.IMacSignResponse} message MacSignResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MacSignResponse.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.mac != null && Object.hasOwnProperty.call(message, "mac")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.mac); + if (message.macCrc32c != null && Object.hasOwnProperty.call(message, "macCrc32c")) + $root.google.protobuf.Int64Value.encode(message.macCrc32c, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.verifiedDataCrc32c != null && Object.hasOwnProperty.call(message, "verifiedDataCrc32c")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.verifiedDataCrc32c); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.protectionLevel); + return writer; + }; + + /** + * Encodes the specified MacSignResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.MacSignResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {google.cloud.kms.v1.IMacSignResponse} message MacSignResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MacSignResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MacSignResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.MacSignResponse} MacSignResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MacSignResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.MacSignResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.mac = reader.bytes(); + break; + } + case 3: { + message.macCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 4: { + message.verifiedDataCrc32c = reader.bool(); + break; + } + case 5: { + message.protectionLevel = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MacSignResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.MacSignResponse} MacSignResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MacSignResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MacSignResponse message. + * @function verify + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MacSignResponse.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.mac != null && message.hasOwnProperty("mac")) + if (!(message.mac && typeof message.mac.length === "number" || $util.isString(message.mac))) + return "mac: buffer expected"; + if (message.macCrc32c != null && message.hasOwnProperty("macCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.macCrc32c); + if (error) + return "macCrc32c." + error; + } + if (message.verifiedDataCrc32c != null && message.hasOwnProperty("verifiedDataCrc32c")) + if (typeof message.verifiedDataCrc32c !== "boolean") + return "verifiedDataCrc32c: boolean expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a MacSignResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.MacSignResponse} MacSignResponse + */ + MacSignResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.MacSignResponse) + return object; + var message = new $root.google.cloud.kms.v1.MacSignResponse(); + if (object.name != null) + message.name = String(object.name); + if (object.mac != null) + if (typeof object.mac === "string") + $util.base64.decode(object.mac, message.mac = $util.newBuffer($util.base64.length(object.mac)), 0); + else if (object.mac.length >= 0) + message.mac = object.mac; + if (object.macCrc32c != null) { + if (typeof object.macCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.MacSignResponse.macCrc32c: object expected"); + message.macCrc32c = $root.google.protobuf.Int64Value.fromObject(object.macCrc32c); + } + if (object.verifiedDataCrc32c != null) + message.verifiedDataCrc32c = Boolean(object.verifiedDataCrc32c); + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a MacSignResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {google.cloud.kms.v1.MacSignResponse} message MacSignResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MacSignResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + if (options.bytes === String) + object.mac = ""; + else { + object.mac = []; + if (options.bytes !== Array) + object.mac = $util.newBuffer(object.mac); + } + object.macCrc32c = null; + object.verifiedDataCrc32c = false; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.mac != null && message.hasOwnProperty("mac")) + object.mac = options.bytes === String ? $util.base64.encode(message.mac, 0, message.mac.length) : options.bytes === Array ? Array.prototype.slice.call(message.mac) : message.mac; + if (message.macCrc32c != null && message.hasOwnProperty("macCrc32c")) + object.macCrc32c = $root.google.protobuf.Int64Value.toObject(message.macCrc32c, options); + if (message.verifiedDataCrc32c != null && message.hasOwnProperty("verifiedDataCrc32c")) + object.verifiedDataCrc32c = message.verifiedDataCrc32c; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + return object; + }; + + /** + * Converts this MacSignResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.MacSignResponse + * @instance + * @returns {Object.} JSON object + */ + MacSignResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MacSignResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.MacSignResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MacSignResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.MacSignResponse"; + }; + + return MacSignResponse; + })(); + + v1.MacVerifyResponse = (function() { + + /** + * Properties of a MacVerifyResponse. + * @memberof google.cloud.kms.v1 + * @interface IMacVerifyResponse + * @property {string|null} [name] MacVerifyResponse name + * @property {boolean|null} [success] MacVerifyResponse success + * @property {boolean|null} [verifiedDataCrc32c] MacVerifyResponse verifiedDataCrc32c + * @property {boolean|null} [verifiedMacCrc32c] MacVerifyResponse verifiedMacCrc32c + * @property {boolean|null} [verifiedSuccessIntegrity] MacVerifyResponse verifiedSuccessIntegrity + * @property {google.cloud.kms.v1.ProtectionLevel|null} [protectionLevel] MacVerifyResponse protectionLevel + */ + + /** + * Constructs a new MacVerifyResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a MacVerifyResponse. + * @implements IMacVerifyResponse + * @constructor + * @param {google.cloud.kms.v1.IMacVerifyResponse=} [properties] Properties to set + */ + function MacVerifyResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MacVerifyResponse name. + * @member {string} name + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @instance + */ + MacVerifyResponse.prototype.name = ""; + + /** + * MacVerifyResponse success. + * @member {boolean} success + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @instance + */ + MacVerifyResponse.prototype.success = false; + + /** + * MacVerifyResponse verifiedDataCrc32c. + * @member {boolean} verifiedDataCrc32c + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @instance + */ + MacVerifyResponse.prototype.verifiedDataCrc32c = false; + + /** + * MacVerifyResponse verifiedMacCrc32c. + * @member {boolean} verifiedMacCrc32c + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @instance + */ + MacVerifyResponse.prototype.verifiedMacCrc32c = false; + + /** + * MacVerifyResponse verifiedSuccessIntegrity. + * @member {boolean} verifiedSuccessIntegrity + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @instance + */ + MacVerifyResponse.prototype.verifiedSuccessIntegrity = false; + + /** + * MacVerifyResponse protectionLevel. + * @member {google.cloud.kms.v1.ProtectionLevel} protectionLevel + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @instance + */ + MacVerifyResponse.prototype.protectionLevel = 0; + + /** + * Creates a new MacVerifyResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {google.cloud.kms.v1.IMacVerifyResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.MacVerifyResponse} MacVerifyResponse instance + */ + MacVerifyResponse.create = function create(properties) { + return new MacVerifyResponse(properties); + }; + + /** + * Encodes the specified MacVerifyResponse message. Does not implicitly {@link google.cloud.kms.v1.MacVerifyResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {google.cloud.kms.v1.IMacVerifyResponse} message MacVerifyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MacVerifyResponse.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.success != null && Object.hasOwnProperty.call(message, "success")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.success); + if (message.verifiedDataCrc32c != null && Object.hasOwnProperty.call(message, "verifiedDataCrc32c")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.verifiedDataCrc32c); + if (message.verifiedMacCrc32c != null && Object.hasOwnProperty.call(message, "verifiedMacCrc32c")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.verifiedMacCrc32c); + if (message.verifiedSuccessIntegrity != null && Object.hasOwnProperty.call(message, "verifiedSuccessIntegrity")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.verifiedSuccessIntegrity); + if (message.protectionLevel != null && Object.hasOwnProperty.call(message, "protectionLevel")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.protectionLevel); + return writer; + }; + + /** + * Encodes the specified MacVerifyResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.MacVerifyResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {google.cloud.kms.v1.IMacVerifyResponse} message MacVerifyResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MacVerifyResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MacVerifyResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.MacVerifyResponse} MacVerifyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MacVerifyResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.MacVerifyResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.success = reader.bool(); + break; + } + case 3: { + message.verifiedDataCrc32c = reader.bool(); + break; + } + case 4: { + message.verifiedMacCrc32c = reader.bool(); + break; + } + case 5: { + message.verifiedSuccessIntegrity = reader.bool(); + break; + } + case 6: { + message.protectionLevel = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MacVerifyResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.MacVerifyResponse} MacVerifyResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MacVerifyResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MacVerifyResponse message. + * @function verify + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MacVerifyResponse.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.success != null && message.hasOwnProperty("success")) + if (typeof message.success !== "boolean") + return "success: boolean expected"; + if (message.verifiedDataCrc32c != null && message.hasOwnProperty("verifiedDataCrc32c")) + if (typeof message.verifiedDataCrc32c !== "boolean") + return "verifiedDataCrc32c: boolean expected"; + if (message.verifiedMacCrc32c != null && message.hasOwnProperty("verifiedMacCrc32c")) + if (typeof message.verifiedMacCrc32c !== "boolean") + return "verifiedMacCrc32c: boolean expected"; + if (message.verifiedSuccessIntegrity != null && message.hasOwnProperty("verifiedSuccessIntegrity")) + if (typeof message.verifiedSuccessIntegrity !== "boolean") + return "verifiedSuccessIntegrity: boolean expected"; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + switch (message.protectionLevel) { + default: + return "protectionLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a MacVerifyResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.MacVerifyResponse} MacVerifyResponse + */ + MacVerifyResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.MacVerifyResponse) + return object; + var message = new $root.google.cloud.kms.v1.MacVerifyResponse(); + if (object.name != null) + message.name = String(object.name); + if (object.success != null) + message.success = Boolean(object.success); + if (object.verifiedDataCrc32c != null) + message.verifiedDataCrc32c = Boolean(object.verifiedDataCrc32c); + if (object.verifiedMacCrc32c != null) + message.verifiedMacCrc32c = Boolean(object.verifiedMacCrc32c); + if (object.verifiedSuccessIntegrity != null) + message.verifiedSuccessIntegrity = Boolean(object.verifiedSuccessIntegrity); + switch (object.protectionLevel) { + default: + if (typeof object.protectionLevel === "number") { + message.protectionLevel = object.protectionLevel; + break; + } + break; + case "PROTECTION_LEVEL_UNSPECIFIED": + case 0: + message.protectionLevel = 0; + break; + case "SOFTWARE": + case 1: + message.protectionLevel = 1; + break; + case "HSM": + case 2: + message.protectionLevel = 2; + break; + case "EXTERNAL": + case 3: + message.protectionLevel = 3; + break; + case "EXTERNAL_VPC": + case 4: + message.protectionLevel = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a MacVerifyResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {google.cloud.kms.v1.MacVerifyResponse} message MacVerifyResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MacVerifyResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.success = false; + object.verifiedDataCrc32c = false; + object.verifiedMacCrc32c = false; + object.verifiedSuccessIntegrity = false; + object.protectionLevel = options.enums === String ? "PROTECTION_LEVEL_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.success != null && message.hasOwnProperty("success")) + object.success = message.success; + if (message.verifiedDataCrc32c != null && message.hasOwnProperty("verifiedDataCrc32c")) + object.verifiedDataCrc32c = message.verifiedDataCrc32c; + if (message.verifiedMacCrc32c != null && message.hasOwnProperty("verifiedMacCrc32c")) + object.verifiedMacCrc32c = message.verifiedMacCrc32c; + if (message.verifiedSuccessIntegrity != null && message.hasOwnProperty("verifiedSuccessIntegrity")) + object.verifiedSuccessIntegrity = message.verifiedSuccessIntegrity; + if (message.protectionLevel != null && message.hasOwnProperty("protectionLevel")) + object.protectionLevel = options.enums === String ? $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] === undefined ? message.protectionLevel : $root.google.cloud.kms.v1.ProtectionLevel[message.protectionLevel] : message.protectionLevel; + return object; + }; + + /** + * Converts this MacVerifyResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @instance + * @returns {Object.} JSON object + */ + MacVerifyResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MacVerifyResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.MacVerifyResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MacVerifyResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.MacVerifyResponse"; + }; + + return MacVerifyResponse; + })(); + + v1.GenerateRandomBytesResponse = (function() { + + /** + * Properties of a GenerateRandomBytesResponse. + * @memberof google.cloud.kms.v1 + * @interface IGenerateRandomBytesResponse + * @property {Uint8Array|null} [data] GenerateRandomBytesResponse data + * @property {google.protobuf.IInt64Value|null} [dataCrc32c] GenerateRandomBytesResponse dataCrc32c + */ + + /** + * Constructs a new GenerateRandomBytesResponse. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a GenerateRandomBytesResponse. + * @implements IGenerateRandomBytesResponse + * @constructor + * @param {google.cloud.kms.v1.IGenerateRandomBytesResponse=} [properties] Properties to set + */ + function GenerateRandomBytesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateRandomBytesResponse data. + * @member {Uint8Array} data + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @instance + */ + GenerateRandomBytesResponse.prototype.data = $util.newBuffer([]); + + /** + * GenerateRandomBytesResponse dataCrc32c. + * @member {google.protobuf.IInt64Value|null|undefined} dataCrc32c + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @instance + */ + GenerateRandomBytesResponse.prototype.dataCrc32c = null; + + /** + * Creates a new GenerateRandomBytesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {google.cloud.kms.v1.IGenerateRandomBytesResponse=} [properties] Properties to set + * @returns {google.cloud.kms.v1.GenerateRandomBytesResponse} GenerateRandomBytesResponse instance + */ + GenerateRandomBytesResponse.create = function create(properties) { + return new GenerateRandomBytesResponse(properties); + }; + + /** + * Encodes the specified GenerateRandomBytesResponse message. Does not implicitly {@link google.cloud.kms.v1.GenerateRandomBytesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {google.cloud.kms.v1.IGenerateRandomBytesResponse} message GenerateRandomBytesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateRandomBytesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.data != null && Object.hasOwnProperty.call(message, "data")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.data); + if (message.dataCrc32c != null && Object.hasOwnProperty.call(message, "dataCrc32c")) + $root.google.protobuf.Int64Value.encode(message.dataCrc32c, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateRandomBytesResponse message, length delimited. Does not implicitly {@link google.cloud.kms.v1.GenerateRandomBytesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {google.cloud.kms.v1.IGenerateRandomBytesResponse} message GenerateRandomBytesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateRandomBytesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateRandomBytesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.GenerateRandomBytesResponse} GenerateRandomBytesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateRandomBytesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.GenerateRandomBytesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.data = reader.bytes(); + break; + } + case 3: { + message.dataCrc32c = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateRandomBytesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.GenerateRandomBytesResponse} GenerateRandomBytesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateRandomBytesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateRandomBytesResponse message. + * @function verify + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateRandomBytesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.data != null && message.hasOwnProperty("data")) + if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data))) + return "data: buffer expected"; + if (message.dataCrc32c != null && message.hasOwnProperty("dataCrc32c")) { + var error = $root.google.protobuf.Int64Value.verify(message.dataCrc32c); + if (error) + return "dataCrc32c." + error; + } + return null; + }; + + /** + * Creates a GenerateRandomBytesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.GenerateRandomBytesResponse} GenerateRandomBytesResponse + */ + GenerateRandomBytesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.GenerateRandomBytesResponse) + return object; + var message = new $root.google.cloud.kms.v1.GenerateRandomBytesResponse(); + if (object.data != null) + if (typeof object.data === "string") + $util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0); + else if (object.data.length >= 0) + message.data = object.data; + if (object.dataCrc32c != null) { + if (typeof object.dataCrc32c !== "object") + throw TypeError(".google.cloud.kms.v1.GenerateRandomBytesResponse.dataCrc32c: object expected"); + message.dataCrc32c = $root.google.protobuf.Int64Value.fromObject(object.dataCrc32c); + } + return message; + }; + + /** + * Creates a plain object from a GenerateRandomBytesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {google.cloud.kms.v1.GenerateRandomBytesResponse} message GenerateRandomBytesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateRandomBytesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if (options.bytes === String) + object.data = ""; + else { + object.data = []; + if (options.bytes !== Array) + object.data = $util.newBuffer(object.data); + } + object.dataCrc32c = null; + } + if (message.data != null && message.hasOwnProperty("data")) + object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data; + if (message.dataCrc32c != null && message.hasOwnProperty("dataCrc32c")) + object.dataCrc32c = $root.google.protobuf.Int64Value.toObject(message.dataCrc32c, options); + return object; + }; + + /** + * Converts this GenerateRandomBytesResponse to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateRandomBytesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenerateRandomBytesResponse + * @function getTypeUrl + * @memberof google.cloud.kms.v1.GenerateRandomBytesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateRandomBytesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.GenerateRandomBytesResponse"; + }; + + return GenerateRandomBytesResponse; + })(); + + v1.Digest = (function() { + + /** + * Properties of a Digest. + * @memberof google.cloud.kms.v1 + * @interface IDigest + * @property {Uint8Array|null} [sha256] Digest sha256 + * @property {Uint8Array|null} [sha384] Digest sha384 + * @property {Uint8Array|null} [sha512] Digest sha512 + */ + + /** + * Constructs a new Digest. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a Digest. + * @implements IDigest + * @constructor + * @param {google.cloud.kms.v1.IDigest=} [properties] Properties to set + */ + function Digest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Digest sha256. + * @member {Uint8Array|null|undefined} sha256 + * @memberof google.cloud.kms.v1.Digest + * @instance + */ + Digest.prototype.sha256 = null; + + /** + * Digest sha384. + * @member {Uint8Array|null|undefined} sha384 + * @memberof google.cloud.kms.v1.Digest + * @instance + */ + Digest.prototype.sha384 = null; + + /** + * Digest sha512. + * @member {Uint8Array|null|undefined} sha512 + * @memberof google.cloud.kms.v1.Digest + * @instance + */ + Digest.prototype.sha512 = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Digest digest. + * @member {"sha256"|"sha384"|"sha512"|undefined} digest + * @memberof google.cloud.kms.v1.Digest + * @instance + */ + Object.defineProperty(Digest.prototype, "digest", { + get: $util.oneOfGetter($oneOfFields = ["sha256", "sha384", "sha512"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Digest instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {google.cloud.kms.v1.IDigest=} [properties] Properties to set + * @returns {google.cloud.kms.v1.Digest} Digest instance + */ + Digest.create = function create(properties) { + return new Digest(properties); + }; + + /** + * Encodes the specified Digest message. Does not implicitly {@link google.cloud.kms.v1.Digest.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {google.cloud.kms.v1.IDigest} message Digest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Digest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sha256 != null && Object.hasOwnProperty.call(message, "sha256")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.sha256); + if (message.sha384 != null && Object.hasOwnProperty.call(message, "sha384")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.sha384); + if (message.sha512 != null && Object.hasOwnProperty.call(message, "sha512")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.sha512); + return writer; + }; + + /** + * Encodes the specified Digest message, length delimited. Does not implicitly {@link google.cloud.kms.v1.Digest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {google.cloud.kms.v1.IDigest} message Digest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Digest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Digest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.Digest} Digest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Digest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.Digest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.sha256 = reader.bytes(); + break; + } + case 2: { + message.sha384 = reader.bytes(); + break; + } + case 3: { + message.sha512 = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Digest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.Digest} Digest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Digest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Digest message. + * @function verify + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Digest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.sha256 != null && message.hasOwnProperty("sha256")) { + properties.digest = 1; + if (!(message.sha256 && typeof message.sha256.length === "number" || $util.isString(message.sha256))) + return "sha256: buffer expected"; + } + if (message.sha384 != null && message.hasOwnProperty("sha384")) { + if (properties.digest === 1) + return "digest: multiple values"; + properties.digest = 1; + if (!(message.sha384 && typeof message.sha384.length === "number" || $util.isString(message.sha384))) + return "sha384: buffer expected"; + } + if (message.sha512 != null && message.hasOwnProperty("sha512")) { + if (properties.digest === 1) + return "digest: multiple values"; + properties.digest = 1; + if (!(message.sha512 && typeof message.sha512.length === "number" || $util.isString(message.sha512))) + return "sha512: buffer expected"; + } + return null; + }; + + /** + * Creates a Digest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.Digest} Digest + */ + Digest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.Digest) + return object; + var message = new $root.google.cloud.kms.v1.Digest(); + if (object.sha256 != null) + if (typeof object.sha256 === "string") + $util.base64.decode(object.sha256, message.sha256 = $util.newBuffer($util.base64.length(object.sha256)), 0); + else if (object.sha256.length >= 0) + message.sha256 = object.sha256; + if (object.sha384 != null) + if (typeof object.sha384 === "string") + $util.base64.decode(object.sha384, message.sha384 = $util.newBuffer($util.base64.length(object.sha384)), 0); + else if (object.sha384.length >= 0) + message.sha384 = object.sha384; + if (object.sha512 != null) + if (typeof object.sha512 === "string") + $util.base64.decode(object.sha512, message.sha512 = $util.newBuffer($util.base64.length(object.sha512)), 0); + else if (object.sha512.length >= 0) + message.sha512 = object.sha512; + return message; + }; + + /** + * Creates a plain object from a Digest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {google.cloud.kms.v1.Digest} message Digest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Digest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.sha256 != null && message.hasOwnProperty("sha256")) { + object.sha256 = options.bytes === String ? $util.base64.encode(message.sha256, 0, message.sha256.length) : options.bytes === Array ? Array.prototype.slice.call(message.sha256) : message.sha256; + if (options.oneofs) + object.digest = "sha256"; + } + if (message.sha384 != null && message.hasOwnProperty("sha384")) { + object.sha384 = options.bytes === String ? $util.base64.encode(message.sha384, 0, message.sha384.length) : options.bytes === Array ? Array.prototype.slice.call(message.sha384) : message.sha384; + if (options.oneofs) + object.digest = "sha384"; + } + if (message.sha512 != null && message.hasOwnProperty("sha512")) { + object.sha512 = options.bytes === String ? $util.base64.encode(message.sha512, 0, message.sha512.length) : options.bytes === Array ? Array.prototype.slice.call(message.sha512) : message.sha512; + if (options.oneofs) + object.digest = "sha512"; + } + return object; + }; + + /** + * Converts this Digest to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.Digest + * @instance + * @returns {Object.} JSON object + */ + Digest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Digest + * @function getTypeUrl + * @memberof google.cloud.kms.v1.Digest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Digest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.Digest"; + }; + + return Digest; + })(); + + v1.LocationMetadata = (function() { + + /** + * Properties of a LocationMetadata. + * @memberof google.cloud.kms.v1 + * @interface ILocationMetadata + * @property {boolean|null} [hsmAvailable] LocationMetadata hsmAvailable + * @property {boolean|null} [ekmAvailable] LocationMetadata ekmAvailable + */ + + /** + * Constructs a new LocationMetadata. + * @memberof google.cloud.kms.v1 + * @classdesc Represents a LocationMetadata. + * @implements ILocationMetadata + * @constructor + * @param {google.cloud.kms.v1.ILocationMetadata=} [properties] Properties to set + */ + function LocationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocationMetadata hsmAvailable. + * @member {boolean} hsmAvailable + * @memberof google.cloud.kms.v1.LocationMetadata + * @instance + */ + LocationMetadata.prototype.hsmAvailable = false; + + /** + * LocationMetadata ekmAvailable. + * @member {boolean} ekmAvailable + * @memberof google.cloud.kms.v1.LocationMetadata + * @instance + */ + LocationMetadata.prototype.ekmAvailable = false; + + /** + * Creates a new LocationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {google.cloud.kms.v1.ILocationMetadata=} [properties] Properties to set + * @returns {google.cloud.kms.v1.LocationMetadata} LocationMetadata instance + */ + LocationMetadata.create = function create(properties) { + return new LocationMetadata(properties); + }; + + /** + * Encodes the specified LocationMetadata message. Does not implicitly {@link google.cloud.kms.v1.LocationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {google.cloud.kms.v1.ILocationMetadata} message LocationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hsmAvailable != null && Object.hasOwnProperty.call(message, "hsmAvailable")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.hsmAvailable); + if (message.ekmAvailable != null && Object.hasOwnProperty.call(message, "ekmAvailable")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.ekmAvailable); + return writer; + }; + + /** + * Encodes the specified LocationMetadata message, length delimited. Does not implicitly {@link google.cloud.kms.v1.LocationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {google.cloud.kms.v1.ILocationMetadata} message LocationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.kms.v1.LocationMetadata} LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.kms.v1.LocationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.hsmAvailable = reader.bool(); + break; + } + case 2: { + message.ekmAvailable = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.kms.v1.LocationMetadata} LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationMetadata message. + * @function verify + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hsmAvailable != null && message.hasOwnProperty("hsmAvailable")) + if (typeof message.hsmAvailable !== "boolean") + return "hsmAvailable: boolean expected"; + if (message.ekmAvailable != null && message.hasOwnProperty("ekmAvailable")) + if (typeof message.ekmAvailable !== "boolean") + return "ekmAvailable: boolean expected"; + return null; + }; + + /** + * Creates a LocationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.kms.v1.LocationMetadata} LocationMetadata + */ + LocationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.kms.v1.LocationMetadata) + return object; + var message = new $root.google.cloud.kms.v1.LocationMetadata(); + if (object.hsmAvailable != null) + message.hsmAvailable = Boolean(object.hsmAvailable); + if (object.ekmAvailable != null) + message.ekmAvailable = Boolean(object.ekmAvailable); + return message; + }; + + /** + * Creates a plain object from a LocationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {google.cloud.kms.v1.LocationMetadata} message LocationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.hsmAvailable = false; + object.ekmAvailable = false; + } + if (message.hsmAvailable != null && message.hasOwnProperty("hsmAvailable")) + object.hsmAvailable = message.hsmAvailable; + if (message.ekmAvailable != null && message.hasOwnProperty("ekmAvailable")) + object.ekmAvailable = message.ekmAvailable; + return object; + }; + + /** + * Converts this LocationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.kms.v1.LocationMetadata + * @instance + * @returns {Object.} JSON object + */ + LocationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LocationMetadata + * @function getTypeUrl + * @memberof google.cloud.kms.v1.LocationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.kms.v1.LocationMetadata"; + }; + + return LocationMetadata; + })(); + + return v1; + })(); + + return kms; + })(); + + return cloud; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Http + * @function getTypeUrl + * @memberof google.api.Http + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Http"; + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string|null|undefined} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = null; + + /** + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = null; + + /** + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = null; + + /** + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = null; + + /** + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = null; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HttpRule + * @function getTypeUrl + * @memberof google.api.HttpRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpRule"; + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CustomHttpPattern"; + }; + + return CustomHttpPattern; + })(); + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + + return ResourceReference; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + + return FileDescriptorSet; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {string|null} [edition] FileDescriptorProto edition + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * FileDescriptorProto edition. + * @member {string} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = ""; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.edition); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 13: { + message.edition = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + if (!$util.isString(message.edition)) + return "edition: string expected"; + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + if (object.edition != null) + message.edition = String(object.edition); + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + object.edition = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = message.edition; + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [phpGenericServices] FileOptions phpGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions phpGenericServices. + * @member {boolean} phpGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpGenericServices != null && Object.hasOwnProperty.call(message, "phpGenericServices")) + writer.uint32(/* id 42, wireType 0 =*/336).bool(message.phpGenericServices); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 42: { + message.phpGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + if (typeof message.phpGenericServices !== "boolean") + return "phpGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.phpGenericServices != null) + message.phpGenericServices = Boolean(object.phpGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = true; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpGenericServices = false; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpGenericServices != null && message.hasOwnProperty("phpGenericServices")) + object.phpGenericServices = message.phpGenericServices; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) { + writer.uint32(/* id 1052, wireType 2 =*/8418).fork(); + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.int32(message[".google.api.fieldBehavior"][i]); + writer.ldelim(); + } + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 15: { + message.unverifiedLazy = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 10: { + message.weak = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1052: { + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; + } + } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object.unverifiedLazy = false; + object[".google.api.resourceReference"] = null; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldOptions + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions"; + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumOptions"; + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.deprecated = false; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceOptions + * @function getTypeUrl + * @memberof google.protobuf.ServiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + */ + + /** + * 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.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.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; + })(); + + return protobuf; + })(); + + return google; + })(); + + return $root; +}); diff --git a/packages/google-cloud-kms/protos/protos.json b/packages/google-cloud-kms/protos/protos.json new file mode 100644 index 00000000000..f9ebdff52ea --- /dev/null +++ b/packages/google-cloud-kms/protos/protos.json @@ -0,0 +1,3547 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "kms": { + "nested": { + "v1": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.Cloud.Kms.V1", + "go_package": "google.golang.org/genproto/googleapis/cloud/kms/v1;kms", + "java_multiple_files": true, + "java_outer_classname": "KmsProto", + "java_package": "com.google.cloud.kms.v1", + "php_namespace": "Google\\Cloud\\Kms\\V1", + "(google.api.resource_definition).type": "servicedirectory.googleapis.com/Service", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" + }, + "nested": { + "EkmService": { + "options": { + "(google.api.default_host)": "cloudkms.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloudkms" + }, + "methods": { + "ListEkmConnections": { + "requestType": "ListEkmConnectionsRequest", + "responseType": "ListEkmConnectionsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/ekmConnections", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/ekmConnections" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetEkmConnection": { + "requestType": "GetEkmConnectionRequest", + "responseType": "EkmConnection", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/ekmConnections/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/ekmConnections/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateEkmConnection": { + "requestType": "CreateEkmConnectionRequest", + "responseType": "EkmConnection", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/ekmConnections", + "(google.api.http).body": "ekm_connection", + "(google.api.method_signature)": "parent,ekm_connection_id,ekm_connection" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/ekmConnections", + "body": "ekm_connection" + } + }, + { + "(google.api.method_signature)": "parent,ekm_connection_id,ekm_connection" + } + ] + }, + "UpdateEkmConnection": { + "requestType": "UpdateEkmConnectionRequest", + "responseType": "EkmConnection", + "options": { + "(google.api.http).patch": "/v1/{ekm_connection.name=projects/*/locations/*/ekmConnections/*}", + "(google.api.http).body": "ekm_connection", + "(google.api.method_signature)": "ekm_connection,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{ekm_connection.name=projects/*/locations/*/ekmConnections/*}", + "body": "ekm_connection" + } + }, + { + "(google.api.method_signature)": "ekm_connection,update_mask" + } + ] + } + } + }, + "ListEkmConnectionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListEkmConnectionsResponse": { + "fields": { + "ekmConnections": { + "rule": "repeated", + "type": "EkmConnection", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "GetEkmConnectionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/EkmConnection" + } + } + } + }, + "CreateEkmConnectionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "ekmConnectionId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "ekmConnection": { + "type": "EkmConnection", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateEkmConnectionRequest": { + "fields": { + "ekmConnection": { + "type": "EkmConnection", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "Certificate": { + "fields": { + "rawDer": { + "type": "bytes", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parsed": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "issuer": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "subject": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "subjectAlternativeDnsNames": { + "rule": "repeated", + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "notBeforeTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "notAfterTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "serialNumber": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "sha256Fingerprint": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "EkmConnection": { + "options": { + "(google.api.resource).type": "cloudkms.googleapis.com/EkmConnection", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/ekmConnections/{ekm_connection}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "serviceResolvers": { + "rule": "repeated", + "type": "ServiceResolver", + "id": 3 + }, + "etag": { + "type": "string", + "id": 5 + } + }, + "nested": { + "ServiceResolver": { + "fields": { + "serviceDirectoryService": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "servicedirectory.googleapis.com/Service" + } + }, + "endpointFilter": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "hostname": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "serverCertificates": { + "rule": "repeated", + "type": "Certificate", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "KeyRing": { + "options": { + "(google.api.resource).type": "cloudkms.googleapis.com/KeyRing", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/keyRings/{key_ring}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CryptoKey": { + "options": { + "(google.api.resource).type": "cloudkms.googleapis.com/CryptoKey", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" + }, + "oneofs": { + "rotationSchedule": { + "oneof": [ + "rotationPeriod" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "primary": { + "type": "CryptoKeyVersion", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "purpose": { + "type": "CryptoKeyPurpose", + "id": 3, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "nextRotationTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "rotationPeriod": { + "type": "google.protobuf.Duration", + "id": 8 + }, + "versionTemplate": { + "type": "CryptoKeyVersionTemplate", + "id": 11 + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 10 + }, + "importOnly": { + "type": "bool", + "id": 13, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "destroyScheduledDuration": { + "type": "google.protobuf.Duration", + "id": 14, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "cryptoKeyBackend": { + "type": "string", + "id": 15, + "options": { + "(google.api.field_behavior)": "IMMUTABLE", + "(google.api.resource_reference).type": "*" + } + } + }, + "nested": { + "CryptoKeyPurpose": { + "values": { + "CRYPTO_KEY_PURPOSE_UNSPECIFIED": 0, + "ENCRYPT_DECRYPT": 1, + "ASYMMETRIC_SIGN": 5, + "ASYMMETRIC_DECRYPT": 6, + "MAC": 9 + } + } + } + }, + "CryptoKeyVersionTemplate": { + "fields": { + "protectionLevel": { + "type": "ProtectionLevel", + "id": 1 + }, + "algorithm": { + "type": "CryptoKeyVersion.CryptoKeyVersionAlgorithm", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "KeyOperationAttestation": { + "fields": { + "format": { + "type": "AttestationFormat", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "content": { + "type": "bytes", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "certChains": { + "type": "CertificateChains", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "AttestationFormat": { + "values": { + "ATTESTATION_FORMAT_UNSPECIFIED": 0, + "CAVIUM_V1_COMPRESSED": 3, + "CAVIUM_V2_COMPRESSED": 4 + } + }, + "CertificateChains": { + "fields": { + "caviumCerts": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "googleCardCerts": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "googlePartitionCerts": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + } + } + }, + "CryptoKeyVersion": { + "options": { + "(google.api.resource).type": "cloudkms.googleapis.com/CryptoKeyVersion", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "CryptoKeyVersionState", + "id": 3 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "algorithm": { + "type": "CryptoKeyVersionAlgorithm", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "attestation": { + "type": "KeyOperationAttestation", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "generateTime": { + "type": "google.protobuf.Timestamp", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "destroyTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "destroyEventTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "importJob": { + "type": "string", + "id": 14, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "importTime": { + "type": "google.protobuf.Timestamp", + "id": 15, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "importFailureReason": { + "type": "string", + "id": 16, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "externalProtectionLevelOptions": { + "type": "ExternalProtectionLevelOptions", + "id": 17 + }, + "reimportEligible": { + "type": "bool", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "CryptoKeyVersionAlgorithm": { + "values": { + "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED": 0, + "GOOGLE_SYMMETRIC_ENCRYPTION": 1, + "RSA_SIGN_PSS_2048_SHA256": 2, + "RSA_SIGN_PSS_3072_SHA256": 3, + "RSA_SIGN_PSS_4096_SHA256": 4, + "RSA_SIGN_PSS_4096_SHA512": 15, + "RSA_SIGN_PKCS1_2048_SHA256": 5, + "RSA_SIGN_PKCS1_3072_SHA256": 6, + "RSA_SIGN_PKCS1_4096_SHA256": 7, + "RSA_SIGN_PKCS1_4096_SHA512": 16, + "RSA_SIGN_RAW_PKCS1_2048": 28, + "RSA_SIGN_RAW_PKCS1_3072": 29, + "RSA_SIGN_RAW_PKCS1_4096": 30, + "RSA_DECRYPT_OAEP_2048_SHA256": 8, + "RSA_DECRYPT_OAEP_3072_SHA256": 9, + "RSA_DECRYPT_OAEP_4096_SHA256": 10, + "RSA_DECRYPT_OAEP_4096_SHA512": 17, + "RSA_DECRYPT_OAEP_2048_SHA1": 37, + "RSA_DECRYPT_OAEP_3072_SHA1": 38, + "RSA_DECRYPT_OAEP_4096_SHA1": 39, + "EC_SIGN_P256_SHA256": 12, + "EC_SIGN_P384_SHA384": 13, + "EC_SIGN_SECP256K1_SHA256": 31, + "HMAC_SHA256": 32, + "EXTERNAL_SYMMETRIC_ENCRYPTION": 18 + } + }, + "CryptoKeyVersionState": { + "values": { + "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED": 0, + "PENDING_GENERATION": 5, + "ENABLED": 1, + "DISABLED": 2, + "DESTROYED": 3, + "DESTROY_SCHEDULED": 4, + "PENDING_IMPORT": 6, + "IMPORT_FAILED": 7 + } + }, + "CryptoKeyVersionView": { + "values": { + "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED": 0, + "FULL": 1 + } + } + } + }, + "PublicKey": { + "options": { + "(google.api.resource).type": "cloudkms.googleapis.com/PublicKey", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey" + }, + "fields": { + "pem": { + "type": "string", + "id": 1 + }, + "algorithm": { + "type": "CryptoKeyVersion.CryptoKeyVersionAlgorithm", + "id": 2 + }, + "pemCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 3 + }, + "name": { + "type": "string", + "id": 4 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 5 + } + } + }, + "ImportJob": { + "options": { + "(google.api.resource).type": "cloudkms.googleapis.com/ImportJob", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "importMethod": { + "type": "ImportMethod", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 9, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "generateTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "expireTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "expireEventTime": { + "type": "google.protobuf.Timestamp", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "ImportJobState", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "publicKey": { + "type": "WrappingPublicKey", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "attestation": { + "type": "KeyOperationAttestation", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "ImportMethod": { + "values": { + "IMPORT_METHOD_UNSPECIFIED": 0, + "RSA_OAEP_3072_SHA1_AES_256": 1, + "RSA_OAEP_4096_SHA1_AES_256": 2 + } + }, + "ImportJobState": { + "values": { + "IMPORT_JOB_STATE_UNSPECIFIED": 0, + "PENDING_GENERATION": 1, + "ACTIVE": 2, + "EXPIRED": 3 + } + }, + "WrappingPublicKey": { + "fields": { + "pem": { + "type": "string", + "id": 1 + } + } + } + } + }, + "ExternalProtectionLevelOptions": { + "fields": { + "externalKeyUri": { + "type": "string", + "id": 1 + }, + "ekmConnectionKeyPath": { + "type": "string", + "id": 2 + } + } + }, + "ProtectionLevel": { + "values": { + "PROTECTION_LEVEL_UNSPECIFIED": 0, + "SOFTWARE": 1, + "HSM": 2, + "EXTERNAL": 3, + "EXTERNAL_VPC": 4 + } + }, + "KeyManagementService": { + "options": { + "(google.api.default_host)": "cloudkms.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloudkms" + }, + "methods": { + "ListKeyRings": { + "requestType": "ListKeyRingsRequest", + "responseType": "ListKeyRingsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/keyRings", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/keyRings" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListCryptoKeys": { + "requestType": "ListCryptoKeysRequest", + "responseType": "ListCryptoKeysResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListCryptoKeyVersions": { + "requestType": "ListCryptoKeyVersionsRequest", + "responseType": "ListCryptoKeyVersionsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListImportJobs": { + "requestType": "ListImportJobsRequest", + "responseType": "ListImportJobsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetKeyRing": { + "requestType": "GetKeyRingRequest", + "responseType": "KeyRing", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/keyRings/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/keyRings/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetCryptoKey": { + "requestType": "GetCryptoKeyRequest", + "responseType": "CryptoKey", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetCryptoKeyVersion": { + "requestType": "GetCryptoKeyVersionRequest", + "responseType": "CryptoKeyVersion", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetPublicKey": { + "requestType": "GetPublicKeyRequest", + "responseType": "PublicKey", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}/publicKey", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}/publicKey" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetImportJob": { + "requestType": "GetImportJobRequest", + "responseType": "ImportJob", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/keyRings/*/importJobs/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/keyRings/*/importJobs/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateKeyRing": { + "requestType": "CreateKeyRingRequest", + "responseType": "KeyRing", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/keyRings", + "(google.api.http).body": "key_ring", + "(google.api.method_signature)": "parent,key_ring_id,key_ring" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/keyRings", + "body": "key_ring" + } + }, + { + "(google.api.method_signature)": "parent,key_ring_id,key_ring" + } + ] + }, + "CreateCryptoKey": { + "requestType": "CreateCryptoKeyRequest", + "responseType": "CryptoKey", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys", + "(google.api.http).body": "crypto_key", + "(google.api.method_signature)": "parent,crypto_key_id,crypto_key" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys", + "body": "crypto_key" + } + }, + { + "(google.api.method_signature)": "parent,crypto_key_id,crypto_key" + } + ] + }, + "CreateCryptoKeyVersion": { + "requestType": "CreateCryptoKeyVersionRequest", + "responseType": "CryptoKeyVersion", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions", + "(google.api.http).body": "crypto_key_version", + "(google.api.method_signature)": "parent,crypto_key_version" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions", + "body": "crypto_key_version" + } + }, + { + "(google.api.method_signature)": "parent,crypto_key_version" + } + ] + }, + "ImportCryptoKeyVersion": { + "requestType": "ImportCryptoKeyVersionRequest", + "responseType": "CryptoKeyVersion", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions:import", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions:import", + "body": "*" + } + } + ] + }, + "CreateImportJob": { + "requestType": "CreateImportJobRequest", + "responseType": "ImportJob", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs", + "(google.api.http).body": "import_job", + "(google.api.method_signature)": "parent,import_job_id,import_job" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs", + "body": "import_job" + } + }, + { + "(google.api.method_signature)": "parent,import_job_id,import_job" + } + ] + }, + "UpdateCryptoKey": { + "requestType": "UpdateCryptoKeyRequest", + "responseType": "CryptoKey", + "options": { + "(google.api.http).patch": "/v1/{crypto_key.name=projects/*/locations/*/keyRings/*/cryptoKeys/*}", + "(google.api.http).body": "crypto_key", + "(google.api.method_signature)": "crypto_key,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{crypto_key.name=projects/*/locations/*/keyRings/*/cryptoKeys/*}", + "body": "crypto_key" + } + }, + { + "(google.api.method_signature)": "crypto_key,update_mask" + } + ] + }, + "UpdateCryptoKeyVersion": { + "requestType": "UpdateCryptoKeyVersionRequest", + "responseType": "CryptoKeyVersion", + "options": { + "(google.api.http).patch": "/v1/{crypto_key_version.name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}", + "(google.api.http).body": "crypto_key_version", + "(google.api.method_signature)": "crypto_key_version,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{crypto_key_version.name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}", + "body": "crypto_key_version" + } + }, + { + "(google.api.method_signature)": "crypto_key_version,update_mask" + } + ] + }, + "UpdateCryptoKeyPrimaryVersion": { + "requestType": "UpdateCryptoKeyPrimaryVersionRequest", + "responseType": "CryptoKey", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:updatePrimaryVersion", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,crypto_key_version_id" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:updatePrimaryVersion", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,crypto_key_version_id" + } + ] + }, + "DestroyCryptoKeyVersion": { + "requestType": "DestroyCryptoKeyVersionRequest", + "responseType": "CryptoKeyVersion", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:destroy", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:destroy", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "RestoreCryptoKeyVersion": { + "requestType": "RestoreCryptoKeyVersionRequest", + "responseType": "CryptoKeyVersion", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:restore", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:restore", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "Encrypt": { + "requestType": "EncryptRequest", + "responseType": "EncryptResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,plaintext" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,plaintext" + } + ] + }, + "Decrypt": { + "requestType": "DecryptRequest", + "responseType": "DecryptResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:decrypt", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,ciphertext" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:decrypt", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,ciphertext" + } + ] + }, + "AsymmetricSign": { + "requestType": "AsymmetricSignRequest", + "responseType": "AsymmetricSignResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricSign", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,digest" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricSign", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,digest" + } + ] + }, + "AsymmetricDecrypt": { + "requestType": "AsymmetricDecryptRequest", + "responseType": "AsymmetricDecryptResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricDecrypt", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,ciphertext" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricDecrypt", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,ciphertext" + } + ] + }, + "MacSign": { + "requestType": "MacSignRequest", + "responseType": "MacSignResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macSign", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,data" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macSign", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,data" + } + ] + }, + "MacVerify": { + "requestType": "MacVerifyRequest", + "responseType": "MacVerifyResponse", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macVerify", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name,data,mac" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:macVerify", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name,data,mac" + } + ] + }, + "GenerateRandomBytes": { + "requestType": "GenerateRandomBytesRequest", + "responseType": "GenerateRandomBytesResponse", + "options": { + "(google.api.http).post": "/v1/{location=projects/*/locations/*}:generateRandomBytes", + "(google.api.http).body": "*", + "(google.api.method_signature)": "location,length_bytes,protection_level" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{location=projects/*/locations/*}:generateRandomBytes", + "body": "*" + } + }, + { + "(google.api.method_signature)": "location,length_bytes,protection_level" + } + ] + } + } + }, + "ListKeyRingsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListCryptoKeysRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/KeyRing" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "versionView": { + "type": "CryptoKeyVersion.CryptoKeyVersionView", + "id": 4 + }, + "filter": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListCryptoKeyVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "view": { + "type": "CryptoKeyVersion.CryptoKeyVersionView", + "id": 4 + }, + "filter": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListImportJobsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/KeyRing" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListKeyRingsResponse": { + "fields": { + "keyRings": { + "rule": "repeated", + "type": "KeyRing", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "ListCryptoKeysResponse": { + "fields": { + "cryptoKeys": { + "rule": "repeated", + "type": "CryptoKey", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "ListCryptoKeyVersionsResponse": { + "fields": { + "cryptoKeyVersions": { + "rule": "repeated", + "type": "CryptoKeyVersion", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "ListImportJobsResponse": { + "fields": { + "importJobs": { + "rule": "repeated", + "type": "ImportJob", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "GetKeyRingRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/KeyRing" + } + } + } + }, + "GetCryptoKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + } + } + }, + "GetCryptoKeyVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + } + } + }, + "GetPublicKeyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + } + } + }, + "GetImportJobRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/ImportJob" + } + } + } + }, + "CreateKeyRingRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "keyRingId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "keyRing": { + "type": "KeyRing", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CreateCryptoKeyRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/KeyRing" + } + }, + "cryptoKeyId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "cryptoKey": { + "type": "CryptoKey", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "skipInitialVersionCreation": { + "type": "bool", + "id": 5 + } + } + }, + "CreateCryptoKeyVersionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + }, + "cryptoKeyVersion": { + "type": "CryptoKeyVersion", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportCryptoKeyVersionRequest": { + "oneofs": { + "wrappedKeyMaterial": { + "oneof": [ + "rsaAesWrappedKey" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + }, + "cryptoKeyVersion": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + }, + "algorithm": { + "type": "CryptoKeyVersion.CryptoKeyVersionAlgorithm", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "importJob": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "rsaAesWrappedKey": { + "type": "bytes", + "id": 5 + } + } + }, + "CreateImportJobRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/KeyRing" + } + }, + "importJobId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "importJob": { + "type": "ImportJob", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateCryptoKeyRequest": { + "fields": { + "cryptoKey": { + "type": "CryptoKey", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateCryptoKeyVersionRequest": { + "fields": { + "cryptoKeyVersion": { + "type": "CryptoKeyVersion", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateCryptoKeyPrimaryVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + }, + "cryptoKeyVersionId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DestroyCryptoKeyVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + } + } + }, + "RestoreCryptoKeyVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + } + } + }, + "EncryptRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "plaintext": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "additionalAuthenticatedData": { + "type": "bytes", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "plaintextCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "additionalAuthenticatedDataCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DecryptRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + }, + "ciphertext": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "additionalAuthenticatedData": { + "type": "bytes", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "ciphertextCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "additionalAuthenticatedDataCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "AsymmetricSignRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + }, + "digest": { + "type": "Digest", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "digestCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "data": { + "type": "bytes", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "dataCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "AsymmetricDecryptRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + }, + "ciphertext": { + "type": "bytes", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "ciphertextCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "MacSignRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + }, + "data": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "dataCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "MacVerifyRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + }, + "data": { + "type": "bytes", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "dataCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mac": { + "type": "bytes", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "macCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GenerateRandomBytesRequest": { + "fields": { + "location": { + "type": "string", + "id": 1 + }, + "lengthBytes": { + "type": "int32", + "id": 2 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 3 + } + } + }, + "EncryptResponse": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "ciphertext": { + "type": "bytes", + "id": 2 + }, + "ciphertextCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 4 + }, + "verifiedPlaintextCrc32c": { + "type": "bool", + "id": 5 + }, + "verifiedAdditionalAuthenticatedDataCrc32c": { + "type": "bool", + "id": 6 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 7 + } + } + }, + "DecryptResponse": { + "fields": { + "plaintext": { + "type": "bytes", + "id": 1 + }, + "plaintextCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 2 + }, + "usedPrimary": { + "type": "bool", + "id": 3 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 4 + } + } + }, + "AsymmetricSignResponse": { + "fields": { + "signature": { + "type": "bytes", + "id": 1 + }, + "signatureCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 2 + }, + "verifiedDigestCrc32c": { + "type": "bool", + "id": 3 + }, + "name": { + "type": "string", + "id": 4 + }, + "verifiedDataCrc32c": { + "type": "bool", + "id": 5 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 6 + } + } + }, + "AsymmetricDecryptResponse": { + "fields": { + "plaintext": { + "type": "bytes", + "id": 1 + }, + "plaintextCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 2 + }, + "verifiedCiphertextCrc32c": { + "type": "bool", + "id": 3 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 4 + } + } + }, + "MacSignResponse": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "mac": { + "type": "bytes", + "id": 2 + }, + "macCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 3 + }, + "verifiedDataCrc32c": { + "type": "bool", + "id": 4 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 5 + } + } + }, + "MacVerifyResponse": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "success": { + "type": "bool", + "id": 2 + }, + "verifiedDataCrc32c": { + "type": "bool", + "id": 3 + }, + "verifiedMacCrc32c": { + "type": "bool", + "id": 4 + }, + "verifiedSuccessIntegrity": { + "type": "bool", + "id": 5 + }, + "protectionLevel": { + "type": "ProtectionLevel", + "id": 6 + } + } + }, + "GenerateRandomBytesResponse": { + "fields": { + "data": { + "type": "bytes", + "id": 1 + }, + "dataCrc32c": { + "type": "google.protobuf.Int64Value", + "id": 3 + } + } + }, + "Digest": { + "oneofs": { + "digest": { + "oneof": [ + "sha256", + "sha384", + "sha512" + ] + } + }, + "fields": { + "sha256": { + "type": "bytes", + "id": 1 + }, + "sha384": { + "type": "bytes", + "id": 2 + }, + "sha512": { + "type": "bytes", + "id": 3 + } + } + }, + "LocationMetadata": { + "fields": { + "hsmAvailable": { + "type": "bool", + "id": 1 + }, + "ekmAvailable": { + "type": "bool", + "id": 2 + } + } + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "java_multiple_files": true, + "java_outer_classname": "ResourceProto", + "java_package": "com.google.api", + "objc_class_prefix": "GAPI", + "cc_enable_arenas": true + }, + "nested": { + "http": { + "type": "HttpRule", + "id": 72295728, + "extend": "google.protobuf.MethodOptions" + }, + "Http": { + "fields": { + "rules": { + "rule": "repeated", + "type": "HttpRule", + "id": 1 + }, + "fullyDecodeReservedExpansion": { + "type": "bool", + "id": 2 + } + } + }, + "HttpRule": { + "oneofs": { + "pattern": { + "oneof": [ + "get", + "put", + "post", + "delete", + "patch", + "custom" + ] + } + }, + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "get": { + "type": "string", + "id": 2 + }, + "put": { + "type": "string", + "id": 3 + }, + "post": { + "type": "string", + "id": 4 + }, + "delete": { + "type": "string", + "id": 5 + }, + "patch": { + "type": "string", + "id": 6 + }, + "custom": { + "type": "CustomHttpPattern", + "id": 8 + }, + "body": { + "type": "string", + "id": 7 + }, + "responseBody": { + "type": "string", + "id": 12 + }, + "additionalBindings": { + "rule": "repeated", + "type": "HttpRule", + "id": 11 + } + } + }, + "CustomHttpPattern": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" + }, + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions" + }, + "FieldBehavior": { + "values": { + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 + } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + } + } + }, + "protobuf": { + "options": { + "go_package": "google.golang.org/protobuf/types/descriptorpb", + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "csharp_namespace": "Google.Protobuf.Reflection", + "objc_class_prefix": "GPB", + "cc_enable_arenas": true, + "optimize_for": "SPEED" + }, + "nested": { + "FileDescriptorSet": { + "fields": { + "file": { + "rule": "repeated", + "type": "FileDescriptorProto", + "id": 1 + } + } + }, + "FileDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "package": { + "type": "string", + "id": 2 + }, + "dependency": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "publicDependency": { + "rule": "repeated", + "type": "int32", + "id": 10, + "options": { + "packed": false + } + }, + "weakDependency": { + "rule": "repeated", + "type": "int32", + "id": 11, + "options": { + "packed": false + } + }, + "messageType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 4 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 5 + }, + "service": { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "id": 6 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 7 + }, + "options": { + "type": "FileOptions", + "id": 8 + }, + "sourceCodeInfo": { + "type": "SourceCodeInfo", + "id": 9 + }, + "syntax": { + "type": "string", + "id": 12 + }, + "edition": { + "type": "string", + "id": 13 + } + } + }, + "DescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "field": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 2 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 6 + }, + "nestedType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 3 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 4 + }, + "extensionRange": { + "rule": "repeated", + "type": "ExtensionRange", + "id": 5 + }, + "oneofDecl": { + "rule": "repeated", + "type": "OneofDescriptorProto", + "id": 8 + }, + "options": { + "type": "MessageOptions", + "id": 7 + }, + "reservedRange": { + "rule": "repeated", + "type": "ReservedRange", + "id": 9 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 10 + } + }, + "nested": { + "ExtensionRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "ExtensionRangeOptions", + "id": 3 + } + } + }, + "ReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "ExtensionRangeOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "FieldDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 3 + }, + "label": { + "type": "Label", + "id": 4 + }, + "type": { + "type": "Type", + "id": 5 + }, + "typeName": { + "type": "string", + "id": 6 + }, + "extendee": { + "type": "string", + "id": 2 + }, + "defaultValue": { + "type": "string", + "id": 7 + }, + "oneofIndex": { + "type": "int32", + "id": 9 + }, + "jsonName": { + "type": "string", + "id": 10 + }, + "options": { + "type": "FieldOptions", + "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18 + } + }, + "Label": { + "values": { + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3 + } + } + } + }, + "OneofDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "options": { + "type": "OneofOptions", + "id": 2 + } + } + }, + "EnumDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "id": 2 + }, + "options": { + "type": "EnumOptions", + "id": 3 + }, + "reservedRange": { + "rule": "repeated", + "type": "EnumReservedRange", + "id": 4 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 5 + } + }, + "nested": { + "EnumReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "EnumValueDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "EnumValueOptions", + "id": 3 + } + } + }, + "ServiceDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "method": { + "rule": "repeated", + "type": "MethodDescriptorProto", + "id": 2 + }, + "options": { + "type": "ServiceOptions", + "id": 3 + } + } + }, + "MethodDescriptorProto": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "inputType": { + "type": "string", + "id": 2 + }, + "outputType": { + "type": "string", + "id": 3 + }, + "options": { + "type": "MethodOptions", + "id": 4 + }, + "clientStreaming": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "serverStreaming": { + "type": "bool", + "id": 6, + "options": { + "default": false + } + } + } + }, + "FileOptions": { + "fields": { + "javaPackage": { + "type": "string", + "id": 1 + }, + "javaOuterClassname": { + "type": "string", + "id": 8 + }, + "javaMultipleFiles": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "javaGenerateEqualsAndHash": { + "type": "bool", + "id": 20, + "options": { + "deprecated": true + } + }, + "javaStringCheckUtf8": { + "type": "bool", + "id": 27, + "options": { + "default": false + } + }, + "optimizeFor": { + "type": "OptimizeMode", + "id": 9, + "options": { + "default": "SPEED" + } + }, + "goPackage": { + "type": "string", + "id": 11 + }, + "ccGenericServices": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "javaGenericServices": { + "type": "bool", + "id": 17, + "options": { + "default": false + } + }, + "pyGenericServices": { + "type": "bool", + "id": 18, + "options": { + "default": false + } + }, + "phpGenericServices": { + "type": "bool", + "id": 42, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 23, + "options": { + "default": false + } + }, + "ccEnableArenas": { + "type": "bool", + "id": 31, + "options": { + "default": true + } + }, + "objcClassPrefix": { + "type": "string", + "id": 36 + }, + "csharpNamespace": { + "type": "string", + "id": 37 + }, + "swiftPrefix": { + "type": "string", + "id": 39 + }, + "phpClassPrefix": { + "type": "string", + "id": 40 + }, + "phpNamespace": { + "type": "string", + "id": 41 + }, + "phpMetadataNamespace": { + "type": "string", + "id": 44 + }, + "rubyPackage": { + "type": "string", + "id": 45 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 38, + 38 + ] + ], + "nested": { + "OptimizeMode": { + "values": { + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3 + } + } + } + }, + "MessageOptions": { + "fields": { + "messageSetWireFormat": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "noStandardDescriptorAccessor": { + "type": "bool", + "id": 2, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "mapEntry": { + "type": "bool", + "id": 7 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], + [ + 8, + 8 + ], + [ + 9, + 9 + ] + ] + }, + "FieldOptions": { + "fields": { + "ctype": { + "type": "CType", + "id": 1, + "options": { + "default": "STRING" + } + }, + "packed": { + "type": "bool", + "id": 2 + }, + "jstype": { + "type": "JSType", + "id": 6, + "options": { + "default": "JS_NORMAL" + } + }, + "lazy": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "weak": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ] + ], + "nested": { + "CType": { + "values": { + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2 + } + }, + "JSType": { + "values": { + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2 + } + } + } + }, + "OneofOptions": { + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "EnumOptions": { + "fields": { + "allowAlias": { + "type": "bool", + "id": 2 + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 5, + 5 + ] + ] + }, + "EnumValueOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "ServiceOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "MethodOptions": { + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "idempotencyLevel": { + "type": "IdempotencyLevel", + "id": 34, + "options": { + "default": "IDEMPOTENCY_UNKNOWN" + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "IdempotencyLevel": { + "values": { + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2 + } + } + } + }, + "UninterpretedOption": { + "fields": { + "name": { + "rule": "repeated", + "type": "NamePart", + "id": 2 + }, + "identifierValue": { + "type": "string", + "id": 3 + }, + "positiveIntValue": { + "type": "uint64", + "id": 4 + }, + "negativeIntValue": { + "type": "int64", + "id": 5 + }, + "doubleValue": { + "type": "double", + "id": 6 + }, + "stringValue": { + "type": "bytes", + "id": 7 + }, + "aggregateValue": { + "type": "string", + "id": 8 + } + }, + "nested": { + "NamePart": { + "fields": { + "namePart": { + "rule": "required", + "type": "string", + "id": 1 + }, + "isExtension": { + "rule": "required", + "type": "bool", + "id": 2 + } + } + } + } + }, + "SourceCodeInfo": { + "fields": { + "location": { + "rule": "repeated", + "type": "Location", + "id": 1 + } + }, + "nested": { + "Location": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "span": { + "rule": "repeated", + "type": "int32", + "id": 2 + }, + "leadingComments": { + "type": "string", + "id": 3 + }, + "trailingComments": { + "type": "string", + "id": 4 + }, + "leadingDetachedComments": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + } + } + }, + "GeneratedCodeInfo": { + "fields": { + "annotation": { + "rule": "repeated", + "type": "Annotation", + "id": 1 + } + }, + "nested": { + "Annotation": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1 + }, + "sourceFile": { + "type": "string", + "id": 2 + }, + "begin": { + "type": "int32", + "id": 3 + }, + "end": { + "type": "int32", + "id": 4 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } + } + } + } + } + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "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 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-kms/samples/README.md b/packages/google-cloud-kms/samples/README.md new file mode 100644 index 00000000000..bc64bbfe975 --- /dev/null +++ b/packages/google-cloud-kms/samples/README.md @@ -0,0 +1,608 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Google Cloud Key Management Service: 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) + * [Ekm_service.create_ekm_connection](#ekm_service.create_ekm_connection) + * [Ekm_service.get_ekm_connection](#ekm_service.get_ekm_connection) + * [Ekm_service.list_ekm_connections](#ekm_service.list_ekm_connections) + * [Ekm_service.update_ekm_connection](#ekm_service.update_ekm_connection) + * [Key_management_service.asymmetric_decrypt](#key_management_service.asymmetric_decrypt) + * [Key_management_service.asymmetric_sign](#key_management_service.asymmetric_sign) + * [Key_management_service.create_crypto_key](#key_management_service.create_crypto_key) + * [Key_management_service.create_crypto_key_version](#key_management_service.create_crypto_key_version) + * [Key_management_service.create_import_job](#key_management_service.create_import_job) + * [Key_management_service.create_key_ring](#key_management_service.create_key_ring) + * [Key_management_service.decrypt](#key_management_service.decrypt) + * [Key_management_service.destroy_crypto_key_version](#key_management_service.destroy_crypto_key_version) + * [Key_management_service.encrypt](#key_management_service.encrypt) + * [Key_management_service.generate_random_bytes](#key_management_service.generate_random_bytes) + * [Key_management_service.get_crypto_key](#key_management_service.get_crypto_key) + * [Key_management_service.get_crypto_key_version](#key_management_service.get_crypto_key_version) + * [Key_management_service.get_import_job](#key_management_service.get_import_job) + * [Key_management_service.get_key_ring](#key_management_service.get_key_ring) + * [Key_management_service.get_public_key](#key_management_service.get_public_key) + * [Key_management_service.import_crypto_key_version](#key_management_service.import_crypto_key_version) + * [Key_management_service.list_crypto_key_versions](#key_management_service.list_crypto_key_versions) + * [Key_management_service.list_crypto_keys](#key_management_service.list_crypto_keys) + * [Key_management_service.list_import_jobs](#key_management_service.list_import_jobs) + * [Key_management_service.list_key_rings](#key_management_service.list_key_rings) + * [Key_management_service.mac_sign](#key_management_service.mac_sign) + * [Key_management_service.mac_verify](#key_management_service.mac_verify) + * [Key_management_service.restore_crypto_key_version](#key_management_service.restore_crypto_key_version) + * [Key_management_service.update_crypto_key](#key_management_service.update_crypto_key) + * [Key_management_service.update_crypto_key_primary_version](#key_management_service.update_crypto_key_primary_version) + * [Key_management_service.update_crypto_key_version](#key_management_service.update_crypto_key_version) + * [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 + + + +### Ekm_service.create_ekm_connection + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.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-kms/samples/generated/v1/ekm_service.create_ekm_connection.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.js` + + +----- + + + + +### Ekm_service.get_ekm_connection + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.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-kms/samples/generated/v1/ekm_service.get_ekm_connection.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.js` + + +----- + + + + +### Ekm_service.list_ekm_connections + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.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-kms/samples/generated/v1/ekm_service.list_ekm_connections.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.js` + + +----- + + + + +### Ekm_service.update_ekm_connection + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.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-kms/samples/generated/v1/ekm_service.update_ekm_connection.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.js` + + +----- + + + + +### Key_management_service.asymmetric_decrypt + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.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-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js` + + +----- + + + + +### Key_management_service.asymmetric_sign + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.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-kms/samples/generated/v1/key_management_service.asymmetric_sign.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.js` + + +----- + + + + +### Key_management_service.create_crypto_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.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-kms/samples/generated/v1/key_management_service.create_crypto_key.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.js` + + +----- + + + + +### Key_management_service.create_crypto_key_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.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-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js` + + +----- + + + + +### Key_management_service.create_import_job + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.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-kms/samples/generated/v1/key_management_service.create_import_job.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.js` + + +----- + + + + +### Key_management_service.create_key_ring + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.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-kms/samples/generated/v1/key_management_service.create_key_ring.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.js` + + +----- + + + + +### Key_management_service.decrypt + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.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-kms/samples/generated/v1/key_management_service.decrypt.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.js` + + +----- + + + + +### Key_management_service.destroy_crypto_key_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.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-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js` + + +----- + + + + +### Key_management_service.encrypt + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.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-kms/samples/generated/v1/key_management_service.encrypt.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.js` + + +----- + + + + +### Key_management_service.generate_random_bytes + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.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-kms/samples/generated/v1/key_management_service.generate_random_bytes.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.js` + + +----- + + + + +### Key_management_service.get_crypto_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.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-kms/samples/generated/v1/key_management_service.get_crypto_key.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.js` + + +----- + + + + +### Key_management_service.get_crypto_key_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.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-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js` + + +----- + + + + +### Key_management_service.get_import_job + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.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-kms/samples/generated/v1/key_management_service.get_import_job.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.js` + + +----- + + + + +### Key_management_service.get_key_ring + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.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-kms/samples/generated/v1/key_management_service.get_key_ring.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.js` + + +----- + + + + +### Key_management_service.get_public_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.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-kms/samples/generated/v1/key_management_service.get_public_key.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.js` + + +----- + + + + +### Key_management_service.import_crypto_key_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.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-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js` + + +----- + + + + +### Key_management_service.list_crypto_key_versions + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.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-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js` + + +----- + + + + +### Key_management_service.list_crypto_keys + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.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-kms/samples/generated/v1/key_management_service.list_crypto_keys.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.js` + + +----- + + + + +### Key_management_service.list_import_jobs + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.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-kms/samples/generated/v1/key_management_service.list_import_jobs.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.js` + + +----- + + + + +### Key_management_service.list_key_rings + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.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-kms/samples/generated/v1/key_management_service.list_key_rings.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.js` + + +----- + + + + +### Key_management_service.mac_sign + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.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-kms/samples/generated/v1/key_management_service.mac_sign.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.js` + + +----- + + + + +### Key_management_service.mac_verify + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.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-kms/samples/generated/v1/key_management_service.mac_verify.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.js` + + +----- + + + + +### Key_management_service.restore_crypto_key_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.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-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js` + + +----- + + + + +### Key_management_service.update_crypto_key + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.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-kms/samples/generated/v1/key_management_service.update_crypto_key.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.js` + + +----- + + + + +### Key_management_service.update_crypto_key_primary_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.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-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js` + + +----- + + + + +### Key_management_service.update_crypto_key_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.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-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js` + + +----- + + + + +### Quickstart + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/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-kms/samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/samples/quickstart.js` + + +----- + + + + +### Quickstart.test + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/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-kms/samples/test/quickstart.test.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-kms/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/kms diff --git a/packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.js b/packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.js new file mode 100644 index 00000000000..20cf4e1d080 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/ekm_service.create_ekm_connection.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, ekmConnectionId, ekmConnection) { + // [START cloudkms_v1_generated_EkmService_CreateEkmConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * EkmConnection google.cloud.kms.v1.EkmConnection, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}`. + */ + // const ekmConnectionId = 'abc123' + /** + * Required. An EkmConnection google.cloud.kms.v1.EkmConnection with + * initial field values. + */ + // const ekmConnection = {} + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callCreateEkmConnection() { + // Construct request + const request = { + parent, + ekmConnectionId, + ekmConnection, + }; + + // Run request + const response = await kmsClient.createEkmConnection(request); + console.log(response); + } + + callCreateEkmConnection(); + // [END cloudkms_v1_generated_EkmService_CreateEkmConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.js b/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.js new file mode 100644 index 00000000000..80d65151dc5 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/ekm_service.get_ekm_connection.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_EkmService_GetEkmConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.EkmConnection.name of the + * EkmConnection google.cloud.kms.v1.EkmConnection to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callGetEkmConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getEkmConnection(request); + console.log(response); + } + + callGetEkmConnection(); + // [END cloudkms_v1_generated_EkmService_GetEkmConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.js b/packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.js new file mode 100644 index 00000000000..d3bac46d713 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/ekm_service.list_ekm_connections.js @@ -0,0 +1,94 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudkms_v1_generated_EkmService_ListEkmConnections_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * EkmConnections google.cloud.kms.v1.EkmConnection to list, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * EkmConnections google.cloud.kms.v1.EkmConnection to include in the + * response. Further EkmConnections google.cloud.kms.v1.EkmConnection can + * subsequently be obtained by including the + * ListEkmConnectionsResponse.next_page_token google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListEkmConnectionsResponse.next_page_token google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callListEkmConnections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listEkmConnectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEkmConnections(); + // [END cloudkms_v1_generated_EkmService_ListEkmConnections_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.js b/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.js new file mode 100644 index 00000000000..0fadde190c4 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/ekm_service.update_ekm_connection.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(ekmConnection, updateMask) { + // [START cloudkms_v1_generated_EkmService_UpdateEkmConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. EkmConnection google.cloud.kms.v1.EkmConnection with updated + * values. + */ + // const ekmConnection = {} + /** + * Required. List of fields to be updated in this request. + */ + // const updateMask = {} + + // Imports the Kms library + const {EkmServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new EkmServiceClient(); + + async function callUpdateEkmConnection() { + // Construct request + const request = { + ekmConnection, + updateMask, + }; + + // Run request + const response = await kmsClient.updateEkmConnection(request); + console.log(response); + } + + callUpdateEkmConnection(); + // [END cloudkms_v1_generated_EkmService_UpdateEkmConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js new file mode 100644 index 00000000000..6e772ba2b78 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js @@ -0,0 +1,92 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, ciphertext) { + // [START cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * decryption. + */ + // const name = 'abc123' + /** + * Required. The data encrypted with the named + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion's public key using + * OAEP. + */ + // const ciphertext = 'Buffer.from('string')' + /** + * Optional. An optional CRC32C checksum of the + * AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext) + * is equal to + * AsymmetricDecryptRequest.ciphertext_crc32c google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const ciphertextCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callAsymmetricDecrypt() { + // Construct request + const request = { + name, + ciphertext, + }; + + // Run request + const response = await kmsClient.asymmetricDecrypt(request); + console.log(response); + } + + callAsymmetricDecrypt(); + // [END cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.js new file mode 100644 index 00000000000..4e01afcc121 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.asymmetric_sign.js @@ -0,0 +1,123 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * signing. + */ + // const name = 'abc123' + /** + * Optional. The digest of the data to sign. The digest must be produced with + * the same digest algorithm as specified by the key version's + * algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm. + * This field may not be supplied if + * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data + * is supplied. + */ + // const digest = {} + /** + * Optional. An optional CRC32C checksum of the + * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest) + * is equal to + * AsymmetricSignRequest.digest_crc32c google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const digestCrc32c = {} + /** + * Optional. The data to sign. + * It can't be supplied if + * AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest + * is supplied. + */ + // const data = 'Buffer.from('string')' + /** + * Optional. An optional CRC32C checksum of the + * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data) + * is equal to + * AsymmetricSignRequest.data_crc32c google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const dataCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callAsymmetricSign() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.asymmetricSign(request); + console.log(response); + } + + callAsymmetricSign(); + // [END cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.js new file mode 100644 index 00000000000..2d9d8b43f30 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key.js @@ -0,0 +1,85 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, cryptoKeyId, cryptoKey) { + // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.KeyRing.name of the KeyRing + * associated with the CryptoKeys google.cloud.kms.v1.CryptoKey. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + */ + // const cryptoKeyId = 'abc123' + /** + * Required. A CryptoKey google.cloud.kms.v1.CryptoKey with initial field + * values. + */ + // const cryptoKey = {} + /** + * If set to true, the request will create a + * CryptoKey google.cloud.kms.v1.CryptoKey without any + * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. You must + * manually call + * CreateCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion + * or + * ImportCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion + * before you can use this CryptoKey google.cloud.kms.v1.CryptoKey. + */ + // const skipInitialVersionCreation = true + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callCreateCryptoKey() { + // Construct request + const request = { + parent, + cryptoKeyId, + cryptoKey, + }; + + // Run request + const response = await kmsClient.createCryptoKey(request); + console.log(response); + } + + callCreateCryptoKey(); + // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js new file mode 100644 index 00000000000..bda6f33b362 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_crypto_key_version.js @@ -0,0 +1,69 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, cryptoKeyVersion) { + // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKey.name of the + * CryptoKey google.cloud.kms.v1.CryptoKey associated with the + * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. + */ + // const parent = 'abc123' + /** + * Required. A CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with + * initial field values. + */ + // const cryptoKeyVersion = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callCreateCryptoKeyVersion() { + // Construct request + const request = { + parent, + cryptoKeyVersion, + }; + + // Run request + const response = await kmsClient.createCryptoKeyVersion(request); + console.log(response); + } + + callCreateCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.js new file mode 100644 index 00000000000..93b266b95a9 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_import_job.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, importJobId, importJob) { + // [START cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.KeyRing.name of the + * KeyRing google.cloud.kms.v1.KeyRing associated with the + * ImportJobs google.cloud.kms.v1.ImportJob. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + */ + // const importJobId = 'abc123' + /** + * Required. An ImportJob google.cloud.kms.v1.ImportJob with initial field + * values. + */ + // const importJob = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callCreateImportJob() { + // Construct request + const request = { + parent, + importJobId, + importJob, + }; + + // Run request + const response = await kmsClient.createImportJob(request); + console.log(response); + } + + callCreateImportJob(); + // [END cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.js new file mode 100644 index 00000000000..f27db38419a --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.create_key_ring.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, keyRingId, keyRing) { + // [START cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * KeyRings google.cloud.kms.v1.KeyRing, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + */ + // const keyRingId = 'abc123' + /** + * Required. A KeyRing google.cloud.kms.v1.KeyRing with initial field + * values. + */ + // const keyRing = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callCreateKeyRing() { + // Construct request + const request = { + parent, + keyRingId, + keyRing, + }; + + // Run request + const response = await kmsClient.createKeyRing(request); + console.log(response); + } + + callCreateKeyRing(); + // [END cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.js new file mode 100644 index 00000000000..fa70e8bf558 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.decrypt.js @@ -0,0 +1,118 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, ciphertext) { + // [START cloudkms_v1_generated_KeyManagementService_Decrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to use for decryption. The + * server will choose the appropriate version. + */ + // const name = 'abc123' + /** + * Required. The encrypted data originally returned in + * EncryptResponse.ciphertext google.cloud.kms.v1.EncryptResponse.ciphertext. + */ + // const ciphertext = 'Buffer.from('string')' + /** + * Optional. Optional data that must match the data originally supplied in + * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data. + */ + // const additionalAuthenticatedData = 'Buffer.from('string')' + /** + * Optional. An optional CRC32C checksum of the + * DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext) + * is equal to + * DecryptRequest.ciphertext_crc32c google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const ciphertextCrc32c = {} + /** + * Optional. An optional CRC32C checksum of the + * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data) + * is equal to + * DecryptRequest.additional_authenticated_data_crc32c google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const additionalAuthenticatedDataCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callDecrypt() { + // Construct request + const request = { + name, + ciphertext, + }; + + // Run request + const response = await kmsClient.decrypt(request); + console.log(response); + } + + callDecrypt(); + // [END cloudkms_v1_generated_KeyManagementService_Decrypt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js new file mode 100644 index 00000000000..62205e8e099 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to destroy. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callDestroyCryptoKeyVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.destroyCryptoKeyVersion(request); + console.log(response); + } + + callDestroyCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.js new file mode 100644 index 00000000000..b3a69376f2b --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.encrypt.js @@ -0,0 +1,135 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, plaintext) { + // [START cloudkms_v1_generated_KeyManagementService_Encrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey or + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * encryption. + * If a CryptoKey google.cloud.kms.v1.CryptoKey is specified, the server + * will use its primary version google.cloud.kms.v1.CryptoKey.primary. + */ + // const name = 'abc123' + /** + * Required. The data to encrypt. Must be no larger than 64KiB. + * The maximum size depends on the key version's + * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. + * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the + * plaintext must be no larger than 64KiB. For + * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + */ + // const plaintext = 'Buffer.from('string')' + /** + * Optional. Optional data that, if specified, must also be provided during + * decryption through + * DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data. + * The maximum size depends on the key version's + * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. + * For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the AAD + * must be no larger than 64KiB. For + * HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + */ + // const additionalAuthenticatedData = 'Buffer.from('string')' + /** + * Optional. An optional CRC32C checksum of the + * EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext) + * is equal to + * EncryptRequest.plaintext_crc32c google.cloud.kms.v1.EncryptRequest.plaintext_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const plaintextCrc32c = {} + /** + * Optional. An optional CRC32C checksum of the + * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data. + * If specified, + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * verify the integrity of the received + * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data + * using this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data) + * is equal to + * EncryptRequest.additional_authenticated_data_crc32c google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const additionalAuthenticatedDataCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callEncrypt() { + // Construct request + const request = { + name, + plaintext, + }; + + // Run request + const response = await kmsClient.encrypt(request); + console.log(response); + } + + callEncrypt(); + // [END cloudkms_v1_generated_KeyManagementService_Encrypt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.js new file mode 100644 index 00000000000..1136d8c30c5 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.generate_random_bytes.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The project-specific location in which to generate random bytes. + * For example, "projects/my-project/locations/us-central1". + */ + // const location = 'abc123' + /** + * The length in bytes of the amount of randomness to retrieve. Minimum 8 + * bytes, maximum 1024 bytes. + */ + // const lengthBytes = 1234 + /** + * The ProtectionLevel google.cloud.kms.v1.ProtectionLevel to use when + * generating the random data. Currently, only + * HSM google.cloud.kms.v1.ProtectionLevel.HSM protection level is + * supported. + */ + // const protectionLevel = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGenerateRandomBytes() { + // Construct request + const request = { + }; + + // Run request + const response = await kmsClient.generateRandomBytes(request); + console.log(response); + } + + callGenerateRandomBytes(); + // [END cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.js new file mode 100644 index 00000000000..feac5763327 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKey.name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetCryptoKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getCryptoKey(request); + console.log(response); + } + + callGetCryptoKey(); + // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js new file mode 100644 index 00000000000..45d20671715 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_crypto_key_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKeyVersion.name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetCryptoKeyVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getCryptoKeyVersion(request); + console.log(response); + } + + callGetCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.js new file mode 100644 index 00000000000..a2ad85f10fb --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_import_job.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_KeyManagementService_GetImportJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.ImportJob.name of the + * ImportJob google.cloud.kms.v1.ImportJob to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetImportJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getImportJob(request); + console.log(response); + } + + callGetImportJob(); + // [END cloudkms_v1_generated_KeyManagementService_GetImportJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.js new file mode 100644 index 00000000000..7b196a918a6 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_key_ring.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.KeyRing.name of the + * KeyRing google.cloud.kms.v1.KeyRing to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetKeyRing() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getKeyRing(request); + console.log(response); + } + + callGetKeyRing(); + // [END cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.js new file mode 100644 index 00000000000..4ed8b8f64a9 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.get_public_key.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKeyVersion.name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion public key to get. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callGetPublicKey() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.getPublicKey(request); + console.log(response); + } + + callGetPublicKey(); + // [END cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js new file mode 100644 index 00000000000..9aa2b37b0b8 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.import_crypto_key_version.js @@ -0,0 +1,126 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, algorithm, importJob) { + // [START cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name google.cloud.kms.v1.CryptoKey.name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to be imported into. + * The create permission is only required on this key when creating a new + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion. + */ + // const parent = 'abc123' + /** + * Optional. The optional name google.cloud.kms.v1.CryptoKeyVersion.name of + * an existing CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to + * target for an import operation. If this field is not present, a new + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion containing the + * supplied key material is created. + * If this field is present, the supplied key material is imported into + * the existing CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion. To + * import into an existing + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion, the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion must be a child of + * ImportCryptoKeyVersionRequest.parent google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent, + * have been previously created via ImportCryptoKeyVersion , and be in + * DESTROYED google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED + * or + * IMPORT_FAILED google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED + * state. The key material and algorithm must match the previous + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion exactly if the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion has ever contained + * key material. + */ + // const cryptoKeyVersion = 'abc123' + /** + * Required. The + * algorithm google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm + * of the key being imported. This does not need to match the + * version_template google.cloud.kms.v1.CryptoKey.version_template of the + * CryptoKey google.cloud.kms.v1.CryptoKey this version imports into. + */ + // const algorithm = {} + /** + * Required. The name google.cloud.kms.v1.ImportJob.name of the + * ImportJob google.cloud.kms.v1.ImportJob that was used to wrap this key + * material. + */ + // const importJob = 'abc123' + /** + * Wrapped key material produced with + * RSA_OAEP_3072_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256 + * or + * RSA_OAEP_4096_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256. + * This field contains the concatenation of two wrapped keys: + *
    + *
  1. An ephemeral AES-256 wrapping key wrapped with the + * public_key google.cloud.kms.v1.ImportJob.public_key using + * RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an + * empty label. + *
  2. + *
  3. The key to be imported, wrapped with the ephemeral AES-256 key + * using AES-KWP (RFC 5649). + *
  4. + *
+ * If importing symmetric key material, it is expected that the unwrapped + * key contains plain bytes. If importing asymmetric key material, it is + * expected that the unwrapped key is in PKCS#8-encoded DER format (the + * PrivateKeyInfo structure from RFC 5208). + * This format is the same as the format produced by PKCS#11 mechanism + * CKM_RSA_AES_KEY_WRAP. + */ + // const rsaAesWrappedKey = 'Buffer.from('string')' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callImportCryptoKeyVersion() { + // Construct request + const request = { + parent, + algorithm, + importJob, + }; + + // Run request + const response = await kmsClient.importCryptoKeyVersion(request); + console.log(response); + } + + callImportCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js new file mode 100644 index 00000000000..ac7a0f046d6 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js @@ -0,0 +1,98 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to list, in the format + * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion to include in the + * response. Further CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion + * can subsequently be obtained by including the + * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * The fields to include in the response. + */ + // const view = {} + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callListCryptoKeyVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listCryptoKeyVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCryptoKeyVersions(); + // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.js new file mode 100644 index 00000000000..697f55b014d --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_crypto_keys.js @@ -0,0 +1,97 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing + * to list, in the format `projects/* /locations/* /keyRings/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * CryptoKeys google.cloud.kms.v1.CryptoKey to include in the response. + * Further CryptoKeys google.cloud.kms.v1.CryptoKey can subsequently be + * obtained by including the + * ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * The fields of the primary version to include in the response. + */ + // const versionView = {} + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callListCryptoKeys() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listCryptoKeysAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCryptoKeys(); + // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.js new file mode 100644 index 00000000000..856ac38442a --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_import_jobs.js @@ -0,0 +1,93 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing + * to list, in the format `projects/* /locations/* /keyRings/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * ImportJobs google.cloud.kms.v1.ImportJob to include in the response. + * Further ImportJobs google.cloud.kms.v1.ImportJob can subsequently be + * obtained by including the + * ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callListImportJobs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listImportJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListImportJobs(); + // [END cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.js new file mode 100644 index 00000000000..3e835568813 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.list_key_rings.js @@ -0,0 +1,94 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the location associated with the + * KeyRings google.cloud.kms.v1.KeyRing, in the format + * `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * Optional. Optional limit on the number of + * KeyRings google.cloud.kms.v1.KeyRing to include in the response. Further + * KeyRings google.cloud.kms.v1.KeyRing can subsequently be obtained by + * including the + * ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + */ + // const pageSize = 1234 + /** + * Optional. Optional pagination token, returned earlier via + * ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Only include resources that match the filter in the response. For + * more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const filter = 'abc123' + /** + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * Sorting and filtering list + * results (https://cloud.google.com/kms/docs/sorting-and-filtering). + */ + // const orderBy = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callListKeyRings() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await kmsClient.listKeyRingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKeyRings(); + // [END cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.js new file mode 100644 index 00000000000..c9d0487a468 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_sign.js @@ -0,0 +1,89 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, data) { + // [START cloudkms_v1_generated_KeyManagementService_MacSign_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * signing. + */ + // const name = 'abc123' + /** + * Required. The data to sign. The MAC tag is computed over this data field + * based on the specific algorithm. + */ + // const data = 'Buffer.from('string')' + /** + * Optional. An optional CRC32C checksum of the + * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data. If + * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService + * will verify the integrity of the received + * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data using this + * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data) is + * equal to + * MacSignRequest.data_crc32c google.cloud.kms.v1.MacSignRequest.data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const dataCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callMacSign() { + // Construct request + const request = { + name, + data, + }; + + // Run request + const response = await kmsClient.macSign(request); + console.log(response); + } + + callMacSign(); + // [END cloudkms_v1_generated_KeyManagementService_MacSign_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.js new file mode 100644 index 00000000000..a21f154a09f --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.mac_verify.js @@ -0,0 +1,115 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, data, mac) { + // [START cloudkms_v1_generated_KeyManagementService_MacVerify_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for + * verification. + */ + // const name = 'abc123' + /** + * Required. The data used previously as a + * MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data to generate + * the MAC tag. + */ + // const data = 'Buffer.from('string')' + /** + * Optional. An optional CRC32C checksum of the + * MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data. If + * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService + * will verify the integrity of the received + * MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data using + * this checksum. + * KeyManagementService google.cloud.kms.v1.KeyManagementService will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data) + * is equal to + * MacVerifyRequest.data_crc32c google.cloud.kms.v1.MacVerifyRequest.data_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const dataCrc32c = {} + /** + * Required. The signature to verify. + */ + // const mac = 'Buffer.from('string')' + /** + * Optional. An optional CRC32C checksum of the + * MacVerifyRequest.mac google.cloud.kms.v1.MacVerifyRequest.mac. If + * specified, KeyManagementService google.cloud.kms.v1.KeyManagementService + * will verify the integrity of the received + * MacVerifyRequest.mac google.cloud.kms.v1.MacVerifyRequest.mac using this + * checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C(MacVerifyRequest.tag ) is equal to + * MacVerifyRequest.mac_crc32c google.cloud.kms.v1.MacVerifyRequest.mac_crc32c, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + */ + // const macCrc32c = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callMacVerify() { + // Construct request + const request = { + name, + data, + mac, + }; + + // Run request + const response = await kmsClient.macVerify(request); + console.log(response); + } + + callMacVerify(); + // [END cloudkms_v1_generated_KeyManagementService_MacVerify_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js new file mode 100644 index 00000000000..97abe6550e7 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to restore. + */ + // const name = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callRestoreCryptoKeyVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await kmsClient.restoreCryptoKeyVersion(request); + console.log(response); + } + + callRestoreCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.js new file mode 100644 index 00000000000..cd0b706adc3 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key.js @@ -0,0 +1,66 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(cryptoKey, updateMask) { + // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CryptoKey google.cloud.kms.v1.CryptoKey with updated values. + */ + // const cryptoKey = {} + /** + * Required. List of fields to be updated in this request. + */ + // const updateMask = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callUpdateCryptoKey() { + // Construct request + const request = { + cryptoKey, + updateMask, + }; + + // Run request + const response = await kmsClient.updateCryptoKey(request); + console.log(response); + } + + callUpdateCryptoKey(); + // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js new file mode 100644 index 00000000000..2fe88da644e --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name, cryptoKeyVersionId) { + // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the + * CryptoKey google.cloud.kms.v1.CryptoKey to update. + */ + // const name = 'abc123' + /** + * Required. The id of the child + * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use as primary. + */ + // const cryptoKeyVersionId = 'abc123' + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callUpdateCryptoKeyPrimaryVersion() { + // Construct request + const request = { + name, + cryptoKeyVersionId, + }; + + // Run request + const response = await kmsClient.updateCryptoKeyPrimaryVersion(request); + console.log(response); + } + + callUpdateCryptoKeyPrimaryVersion(); + // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js b/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js new file mode 100644 index 00000000000..c90e7dd2f19 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/key_management_service.update_crypto_key_version.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(cryptoKeyVersion, updateMask) { + // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with + * updated values. + */ + // const cryptoKeyVersion = {} + /** + * Required. List of fields to be updated in this request. + */ + // const updateMask = {} + + // Imports the Kms library + const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; + + // Instantiates a client + const kmsClient = new KeyManagementServiceClient(); + + async function callUpdateCryptoKeyVersion() { + // Construct request + const request = { + cryptoKeyVersion, + updateMask, + }; + + // Run request + const response = await kmsClient.updateCryptoKeyVersion(request); + console.log(response); + } + + callUpdateCryptoKeyVersion(); + // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-kms/samples/generated/v1/snippet_metadata.google.cloud.kms.v1.json b/packages/google-cloud-kms/samples/generated/v1/snippet_metadata.google.cloud.kms.v1.json new file mode 100644 index 00000000000..f243bc07aa5 --- /dev/null +++ b/packages/google-cloud-kms/samples/generated/v1/snippet_metadata.google.cloud.kms.v1.json @@ -0,0 +1,1463 @@ +{ + "clientLibrary": { + "name": "nodejs-kms", + "version": "3.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.kms.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudkms_v1_generated_EkmService_ListEkmConnections_async", + "title": "EkmService listEkmConnections Sample", + "origin": "API_DEFINITION", + "description": " Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].", + "canonical": true, + "file": "ekm_service.list_ekm_connections.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEkmConnections", + "fullName": "google.cloud.kms.v1.EkmService.ListEkmConnections", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListEkmConnectionsResponse", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "ListEkmConnections", + "fullName": "google.cloud.kms.v1.EkmService.ListEkmConnections", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_GetEkmConnection_async", + "title": "EkmService getEkmConnection Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].", + "canonical": true, + "file": "ekm_service.get_ekm_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.GetEkmConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.EkmConnection", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "GetEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.GetEkmConnection", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_CreateEkmConnection_async", + "title": "EkmService createEkmConnection Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and Location.", + "canonical": true, + "file": "ekm_service.create_ekm_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.CreateEkmConnection", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "ekm_connection_id", + "type": "TYPE_STRING" + }, + { + "name": "ekm_connection", + "type": ".google.cloud.kms.v1.EkmConnection" + } + ], + "resultType": ".google.cloud.kms.v1.EkmConnection", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "CreateEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.CreateEkmConnection", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_EkmService_UpdateEkmConnection_async", + "title": "EkmService updateEkmConnection Sample", + "origin": "API_DEFINITION", + "description": " Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.", + "canonical": true, + "file": "ekm_service.update_ekm_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConnection", + "async": true, + "parameters": [ + { + "name": "ekm_connection", + "type": ".google.cloud.kms.v1.EkmConnection" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.kms.v1.EkmConnection", + "client": { + "shortName": "EkmServiceClient", + "fullName": "google.cloud.kms.v1.EkmServiceClient" + }, + "method": { + "shortName": "UpdateEkmConnection", + "fullName": "google.cloud.kms.v1.EkmService.UpdateEkmConnection", + "service": { + "shortName": "EkmService", + "fullName": "google.cloud.kms.v1.EkmService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ListKeyRings_async", + "title": "EkmService listKeyRings Sample", + "origin": "API_DEFINITION", + "description": " Lists [KeyRings][google.cloud.kms.v1.KeyRing].", + "canonical": true, + "file": "key_management_service.list_key_rings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListKeyRings", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListKeyRingsResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ListKeyRings", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async", + "title": "EkmService listCryptoKeys Sample", + "origin": "API_DEFINITION", + "description": " Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].", + "canonical": true, + "file": "key_management_service.list_crypto_keys.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 89, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCryptoKeys", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "version_view", + "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListCryptoKeysResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ListCryptoKeys", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async", + "title": "EkmService listCryptoKeyVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].", + "canonical": true, + "file": "key_management_service.list_crypto_key_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 90, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCryptoKeyVersions", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListCryptoKeyVersionsResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ListCryptoKeyVersions", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ListImportJobs_async", + "title": "EkmService listImportJobs Sample", + "origin": "API_DEFINITION", + "description": " Lists [ImportJobs][google.cloud.kms.v1.ImportJob].", + "canonical": true, + "file": "key_management_service.list_import_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListImportJobs", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ListImportJobsResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ListImportJobs", + "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetKeyRing_async", + "title": "EkmService getKeyRing Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].", + "canonical": true, + "file": "key_management_service.get_key_ring.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetKeyRing", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.KeyRing", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetKeyRing", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async", + "title": "EkmService getCryptoKey Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", + "canonical": true, + "file": "key_management_service.get_crypto_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async", + "title": "EkmService getCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", + "canonical": true, + "file": "key_management_service.get_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetPublicKey_async", + "title": "EkmService getPublicKey Sample", + "origin": "API_DEFINITION", + "description": " Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].", + "canonical": true, + "file": "key_management_service.get_public_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPublicKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.PublicKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetPublicKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GetImportJob_async", + "title": "EkmService getImportJob Sample", + "origin": "API_DEFINITION", + "description": " Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].", + "canonical": true, + "file": "key_management_service.get_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetImportJob", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.ImportJob", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GetImportJob", + "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async", + "title": "EkmService createKeyRing Sample", + "origin": "API_DEFINITION", + "description": " Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.", + "canonical": true, + "file": "key_management_service.create_key_ring.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateKeyRing", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "key_ring_id", + "type": "TYPE_STRING" + }, + { + "name": "key_ring", + "type": ".google.cloud.kms.v1.KeyRing" + } + ], + "resultType": ".google.cloud.kms.v1.KeyRing", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "CreateKeyRing", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async", + "title": "EkmService createCryptoKey Sample", + "origin": "API_DEFINITION", + "description": " Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.", + "canonical": true, + "file": "key_management_service.create_crypto_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key_id", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key", + "type": ".google.cloud.kms.v1.CryptoKey" + }, + { + "name": "skip_initial_version_creation", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "CreateCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async", + "title": "EkmService createCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].", + "canonical": true, + "file": "key_management_service.create_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key_version", + "type": ".google.cloud.kms.v1.CryptoKeyVersion" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "CreateCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async", + "title": "EkmService importCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] is additionally specified in the request, key material will be reimported into that version. Otherwise, a new version will be created, and will be assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].", + "canonical": true, + "file": "key_management_service.import_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 118, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key_version", + "type": "TYPE_STRING" + }, + { + "name": "algorithm", + "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm" + }, + { + "name": "import_job", + "type": "TYPE_STRING" + }, + { + "name": "rsa_aes_wrapped_key", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "ImportCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateImportJob_async", + "title": "EkmService createImportJob Sample", + "origin": "API_DEFINITION", + "description": " Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.", + "canonical": true, + "file": "key_management_service.create_import_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateImportJob", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "import_job_id", + "type": "TYPE_STRING" + }, + { + "name": "import_job", + "type": ".google.cloud.kms.v1.ImportJob" + } + ], + "resultType": ".google.cloud.kms.v1.ImportJob", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "CreateImportJob", + "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async", + "title": "EkmService updateCryptoKey Sample", + "origin": "API_DEFINITION", + "description": " Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].", + "canonical": true, + "file": "key_management_service.update_crypto_key.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", + "async": true, + "parameters": [ + { + "name": "crypto_key", + "type": ".google.cloud.kms.v1.CryptoKey" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "UpdateCryptoKey", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async", + "title": "EkmService updateCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.", + "canonical": true, + "file": "key_management_service.update_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "crypto_key_version", + "type": ".google.cloud.kms.v1.CryptoKeyVersion" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "UpdateCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async", + "title": "EkmService updateCryptoKeyPrimaryVersion Sample", + "origin": "API_DEFINITION", + "description": " Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", + "canonical": true, + "file": "key_management_service.update_crypto_key_primary_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateCryptoKeyPrimaryVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "crypto_key_version_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKey", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "UpdateCryptoKeyPrimaryVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async", + "title": "EkmService destroyCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed. Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.", + "canonical": true, + "file": "key_management_service.destroy_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DestroyCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "DestroyCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async", + "title": "EkmService restoreCryptoKeyVersion Sample", + "origin": "API_DEFINITION", + "description": " Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state. Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.", + "canonical": true, + "file": "key_management_service.restore_crypto_key_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "RestoreCryptoKeyVersion", + "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_Encrypt_async", + "title": "EkmService encrypt Sample", + "origin": "API_DEFINITION", + "description": " Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", + "canonical": true, + "file": "key_management_service.encrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 127, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Encrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "plaintext", + "type": "TYPE_BYTES" + }, + { + "name": "additional_authenticated_data", + "type": "TYPE_BYTES" + }, + { + "name": "plaintext_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "additional_authenticated_data_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.EncryptResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "Encrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_Decrypt_async", + "title": "EkmService decrypt Sample", + "origin": "API_DEFINITION", + "description": " Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", + "canonical": true, + "file": "key_management_service.decrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 110, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Decrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ciphertext", + "type": "TYPE_BYTES" + }, + { + "name": "additional_authenticated_data", + "type": "TYPE_BYTES" + }, + { + "name": "ciphertext_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "additional_authenticated_data_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.DecryptResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "Decrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async", + "title": "EkmService asymmetricSign Sample", + "origin": "API_DEFINITION", + "description": " Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].", + "canonical": true, + "file": "key_management_service.asymmetric_sign.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 115, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AsymmetricSign", + "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "digest", + "type": ".google.cloud.kms.v1.Digest" + }, + { + "name": "digest_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "data_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.AsymmetricSignResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "AsymmetricSign", + "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async", + "title": "EkmService asymmetricDecrypt Sample", + "origin": "API_DEFINITION", + "description": " Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.", + "canonical": true, + "file": "key_management_service.asymmetric_decrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AsymmetricDecrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "ciphertext", + "type": "TYPE_BYTES" + }, + { + "name": "ciphertext_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.AsymmetricDecryptResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "AsymmetricDecrypt", + "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_MacSign_async", + "title": "EkmService macSign Sample", + "origin": "API_DEFINITION", + "description": " Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.", + "canonical": true, + "file": "key_management_service.mac_sign.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MacSign", + "fullName": "google.cloud.kms.v1.KeyManagementService.MacSign", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "data_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.MacSignResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "MacSign", + "fullName": "google.cloud.kms.v1.KeyManagementService.MacSign", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_MacVerify_async", + "title": "EkmService macVerify Sample", + "origin": "API_DEFINITION", + "description": " Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.", + "canonical": true, + "file": "key_management_service.mac_verify.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "MacVerify", + "fullName": "google.cloud.kms.v1.KeyManagementService.MacVerify", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "data", + "type": "TYPE_BYTES" + }, + { + "name": "data_crc32c", + "type": ".google.protobuf.Int64Value" + }, + { + "name": "mac", + "type": "TYPE_BYTES" + }, + { + "name": "mac_crc32c", + "type": ".google.protobuf.Int64Value" + } + ], + "resultType": ".google.cloud.kms.v1.MacVerifyResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "MacVerify", + "fullName": "google.cloud.kms.v1.KeyManagementService.MacVerify", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + }, + { + "regionTag": "cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async", + "title": "EkmService generateRandomBytes Sample", + "origin": "API_DEFINITION", + "description": " Generate random bytes using the Cloud KMS randomness source in the provided location.", + "canonical": true, + "file": "key_management_service.generate_random_bytes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateRandomBytes", + "fullName": "google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes", + "async": true, + "parameters": [ + { + "name": "location", + "type": "TYPE_STRING" + }, + { + "name": "length_bytes", + "type": "TYPE_INT32" + }, + { + "name": "protection_level", + "type": ".google.cloud.kms.v1.ProtectionLevel" + } + ], + "resultType": ".google.cloud.kms.v1.GenerateRandomBytesResponse", + "client": { + "shortName": "KeyManagementServiceClient", + "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" + }, + "method": { + "shortName": "GenerateRandomBytes", + "fullName": "google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes", + "service": { + "shortName": "KeyManagementService", + "fullName": "google.cloud.kms.v1.KeyManagementService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-kms/samples/package.json b/packages/google-cloud-kms/samples/package.json new file mode 100644 index 00000000000..89d0d86f2ee --- /dev/null +++ b/packages/google-cloud-kms/samples/package.json @@ -0,0 +1,27 @@ +{ + "name": "nodejs-kms-samples", + "private": true, + "license": "Apache-2.0", + "files": [ + "*.js" + ], + "author": "Google LLC", + "repository": "googleapis/nodejs-kms", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "test": "c8 mocha --recursive test/ --timeout=800000" + }, + "dependencies": { + "@google-cloud/kms": "^3.1.0", + "fast-crc32c": "^2.0.0", + "jslint": "^0.12.1" + }, + "devDependencies": { + "c8": "^7.0.0", + "chai": "^4.2.0", + "mocha": "^8.0.0", + "uuid": "^9.0.0" + } +} diff --git a/packages/google-cloud-kms/samples/quickstart.js b/packages/google-cloud-kms/samples/quickstart.js new file mode 100644 index 00000000000..9253bd221d6 --- /dev/null +++ b/packages/google-cloud-kms/samples/quickstart.js @@ -0,0 +1,61 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +async function main(projectId = 'my-project', locationId = 'us-east1') { + // [START kms_quickstart] + // + // TODO(developer): Uncomment these variables before running the sample. + // + // const projectId = 'my-project'; + // const locationId = 'us-east1'; + + // Imports the Cloud KMS library + const {KeyManagementServiceClient} = require('@google-cloud/kms'); + + // Instantiates a client + const client = new KeyManagementServiceClient(); + + // Build the location name + const locationName = client.locationPath(projectId, locationId); + + async function listKeyRings() { + const [keyRings] = await client.listKeyRings({ + parent: locationName, + }); + + for (const keyRing of keyRings) { + console.log(keyRing.name); + } + + return keyRings; + } + + return listKeyRings(); + // [END kms_quickstart] +} +module.exports.main = main; + +/* c8 ignore next 10 */ +if (require.main === module) { + main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; + }); + process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; + }); +} diff --git a/packages/google-cloud-kms/samples/test/quickstart.test.js b/packages/google-cloud-kms/samples/test/quickstart.test.js new file mode 100644 index 00000000000..cf8fa6e840a --- /dev/null +++ b/packages/google-cloud-kms/samples/test/quickstart.test.js @@ -0,0 +1,46 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {describe, it, before, beforeEach, afterEach} = require('mocha'); +const {assert} = require('chai'); + +const {KeyManagementServiceClient} = require('@google-cloud/kms'); +const client = new KeyManagementServiceClient(); + +const locationId = 'us-east1'; +const originalConsoleLog = console.log; + +describe('Cloud KMS samples', () => { + let projectId; + before(async () => { + projectId = await client.getProjectId(); + }); + + beforeEach(async () => { + console.log = () => {}; + }); + + afterEach(async () => { + console.log = originalConsoleLog; + }); + + it('quickstarts', async () => { + const sample = require('../quickstart'); + const keyRings = await sample.main(projectId, locationId); + + assert.isNotEmpty(keyRings); + }); +}); diff --git a/packages/google-cloud-kms/src/index.ts b/packages/google-cloud-kms/src/index.ts new file mode 100644 index 00000000000..30409150916 --- /dev/null +++ b/packages/google-cloud-kms/src/index.ts @@ -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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; + +const EkmServiceClient = v1.EkmServiceClient; +type EkmServiceClient = v1.EkmServiceClient; +const KeyManagementServiceClient = v1.KeyManagementServiceClient; +type KeyManagementServiceClient = v1.KeyManagementServiceClient; + +export {v1, EkmServiceClient, KeyManagementServiceClient}; +export default {v1, EkmServiceClient, KeyManagementServiceClient}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-kms/src/v1/ekm_service_client.ts b/packages/google-cloud-kms/src/v1/ekm_service_client.ts new file mode 100644 index 00000000000..3780f4ecbee --- /dev/null +++ b/packages/google-cloud-kms/src/v1/ekm_service_client.ts @@ -0,0 +1,1575 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/ekm_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './ekm_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Key Management EKM Service + * + * Manages external cryptographic keys and operations using those keys. + * Implements a REST model with the following objects: + * * {@link google.cloud.kms.v1.EkmConnection|EkmConnection} + * @class + * @memberof v1 + */ +export class EkmServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + ekmServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EkmServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new EkmServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof EkmServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' + ), + ekmConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/ekmConnections/{ekm_connection}' + ), + importJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' + ), + keyRingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + publicKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' + ), + }; + + // 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 = { + listEkmConnections: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'ekmConnections' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.kms.v1.EkmService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.ekmServiceStub) { + return this.ekmServiceStub; + } + + // Put together the "service stub" for + // google.cloud.kms.v1.EkmService. + this.ekmServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.kms.v1.EkmService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.kms.v1.EkmService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const ekmServiceStubMethods = [ + 'listEkmConnections', + 'getEkmConnection', + 'createEkmConnection', + 'updateEkmConnection', + ]; + for (const methodName of ekmServiceStubMethods) { + const callPromise = this.ekmServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.ekmServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudkms.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 'cloudkms.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/cloudkms', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Returns metadata for a given + * {@link google.cloud.kms.v1.EkmConnection|EkmConnection}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.kms.v1.EkmConnection.name|name} of the + * {@link google.cloud.kms.v1.EkmConnection|EkmConnection} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EkmConnection]{@link google.cloud.kms.v1.EkmConnection}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.get_ekm_connection.js + * region_tag:cloudkms_v1_generated_EkmService_GetEkmConnection_async + */ + getEkmConnection( + request?: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest | undefined, + {} | undefined + ] + >; + getEkmConnection( + request: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): void; + getEkmConnection( + request: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): void; + getEkmConnection( + request?: protos.google.cloud.kms.v1.IGetEkmConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IEkmConnection, + | protos.google.cloud.kms.v1.IGetEkmConnectionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IGetEkmConnectionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getEkmConnection(request, options, callback); + } + /** + * Creates a new {@link google.cloud.kms.v1.EkmConnection|EkmConnection} in a given + * Project and Location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link google.cloud.kms.v1.EkmConnection|EkmConnection}, in the format + * `projects/* /locations/*`. + * @param {string} request.ekmConnectionId + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}`. + * @param {google.cloud.kms.v1.EkmConnection} request.ekmConnection + * Required. An {@link google.cloud.kms.v1.EkmConnection|EkmConnection} with + * initial field values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EkmConnection]{@link google.cloud.kms.v1.EkmConnection}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.create_ekm_connection.js + * region_tag:cloudkms_v1_generated_EkmService_CreateEkmConnection_async + */ + createEkmConnection( + request?: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest | undefined, + {} | undefined + ] + >; + createEkmConnection( + request: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): void; + createEkmConnection( + request: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): void; + createEkmConnection( + request?: protos.google.cloud.kms.v1.ICreateEkmConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IEkmConnection, + | protos.google.cloud.kms.v1.ICreateEkmConnectionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.ICreateEkmConnectionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createEkmConnection(request, options, callback); + } + /** + * Updates an {@link google.cloud.kms.v1.EkmConnection|EkmConnection}'s metadata. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.kms.v1.EkmConnection} request.ekmConnection + * Required. {@link google.cloud.kms.v1.EkmConnection|EkmConnection} with updated + * values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. List of fields to be updated in this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [EkmConnection]{@link google.cloud.kms.v1.EkmConnection}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.update_ekm_connection.js + * region_tag:cloudkms_v1_generated_EkmService_UpdateEkmConnection_async + */ + updateEkmConnection( + request?: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest | undefined, + {} | undefined + ] + >; + updateEkmConnection( + request: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): void; + updateEkmConnection( + request: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): void; + updateEkmConnection( + request?: protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IEkmConnection, + | protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IEkmConnection, + protos.google.cloud.kms.v1.IUpdateEkmConnectionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'ekm_connection.name': request.ekmConnection!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEkmConnection(request, options, callback); + } + + /** + * Lists {@link google.cloud.kms.v1.EkmConnection|EkmConnections}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the + * response. Further {@link google.cloud.kms.v1.EkmConnection|EkmConnections} can + * subsequently be obtained by including the + * {@link google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [EkmConnection]{@link google.cloud.kms.v1.EkmConnection}. + * 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 `listEkmConnectionsAsync()` + * 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. + */ + listEkmConnections( + request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IEkmConnection[], + protos.google.cloud.kms.v1.IListEkmConnectionsRequest | null, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse + ] + >; + listEkmConnections( + request: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse | null | undefined, + protos.google.cloud.kms.v1.IEkmConnection + > + ): void; + listEkmConnections( + request: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse | null | undefined, + protos.google.cloud.kms.v1.IEkmConnection + > + ): void; + listEkmConnections( + request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + | protos.google.cloud.kms.v1.IListEkmConnectionsResponse + | null + | undefined, + protos.google.cloud.kms.v1.IEkmConnection + >, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse | null | undefined, + protos.google.cloud.kms.v1.IEkmConnection + > + ): Promise< + [ + protos.google.cloud.kms.v1.IEkmConnection[], + protos.google.cloud.kms.v1.IListEkmConnectionsRequest | null, + protos.google.cloud.kms.v1.IListEkmConnectionsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listEkmConnections(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 resource name of the location associated with the + * {@link google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the + * response. Further {@link google.cloud.kms.v1.EkmConnection|EkmConnections} can + * subsequently be obtained by including the + * {@link google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 [EkmConnection]{@link google.cloud.kms.v1.EkmConnection} 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 `listEkmConnectionsAsync()` + * 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. + */ + listEkmConnectionsStream( + request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEkmConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEkmConnections.createStream( + this.innerApiCalls.listEkmConnections as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEkmConnections`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link google.cloud.kms.v1.EkmConnection|EkmConnections} to list, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.EkmConnection|EkmConnections} to include in the + * response. Further {@link google.cloud.kms.v1.EkmConnection|EkmConnections} can + * subsequently be obtained by including the + * {@link google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token|ListEkmConnectionsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 + * [EkmConnection]{@link google.cloud.kms.v1.EkmConnection}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/ekm_service.list_ekm_connections.js + * region_tag:cloudkms_v1_generated_EkmService_ListEkmConnections_async + */ + listEkmConnectionsAsync( + request?: protos.google.cloud.kms.v1.IListEkmConnectionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEkmConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEkmConnections.asyncIterate( + this.innerApiCalls['listEkmConnections'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string + ) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .crypto_key; + } + + /** + * Return a fully-qualified cryptoKeyVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + cryptoKeyVersionPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string, + cryptoKeyVersion: string + ) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).project; + } + + /** + * Parse the location from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).location; + } + + /** + * Parse the key_ring from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).key_ring; + } + + /** + * Parse the crypto_key from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).crypto_key; + } + + /** + * Parse the crypto_key_version from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).crypto_key_version; + } + + /** + * Return a fully-qualified ekmConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} ekm_connection + * @returns {string} Resource name string. + */ + ekmConnectionPath(project: string, location: string, ekmConnection: string) { + return this.pathTemplates.ekmConnectionPathTemplate.render({ + project: project, + location: location, + ekm_connection: ekmConnection, + }); + } + + /** + * Parse the project from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName) + .project; + } + + /** + * Parse the location from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName) + .location; + } + + /** + * Parse the ekm_connection from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the ekm_connection. + */ + matchEkmConnectionFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName) + .ekm_connection; + } + + /** + * Return a fully-qualified importJob resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} import_job + * @returns {string} Resource name string. + */ + importJobPath( + project: string, + location: string, + keyRing: string, + importJob: string + ) { + return this.pathTemplates.importJobPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + import_job: importJob, + }); + } + + /** + * Parse the project from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the project. + */ + matchProjectFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName) + .project; + } + + /** + * Parse the location from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the location. + */ + matchLocationFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName) + .location; + } + + /** + * Parse the key_ring from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName) + .key_ring; + } + + /** + * Parse the import_job from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the import_job. + */ + matchImportJobFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName) + .import_job; + } + + /** + * Return a fully-qualified keyRing resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @returns {string} Resource name string. + */ + keyRingPath(project: string, location: string, keyRing: string) { + return this.pathTemplates.keyRingPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + }); + } + + /** + * Parse the project from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the project. + */ + matchProjectFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; + } + + /** + * Parse the location from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the location. + */ + matchLocationFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; + } + + /** + * Parse the key_ring from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified publicKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + publicKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string, + cryptoKeyVersion: string + ) { + return this.pathTemplates.publicKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .project; + } + + /** + * Parse the location from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .location; + } + + /** + * Parse the key_ring from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .key_ring; + } + + /** + * Parse the crypto_key from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .crypto_key; + } + + /** + * Parse the crypto_key_version from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .crypto_key_version; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.ekmServiceStub && !this._terminated) { + return this.ekmServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-kms/src/v1/ekm_service_client_config.json b/packages/google-cloud-kms/src/v1/ekm_service_client_config.json new file mode 100644 index 00000000000..583df8ce1d9 --- /dev/null +++ b/packages/google-cloud-kms/src/v1/ekm_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.kms.v1.EkmService": { + "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": { + "ListEkmConnections": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetEkmConnection": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateEkmConnection": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateEkmConnection": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-kms/src/v1/ekm_service_proto_list.json b/packages/google-cloud-kms/src/v1/ekm_service_proto_list.json new file mode 100644 index 00000000000..ad57fc558ee --- /dev/null +++ b/packages/google-cloud-kms/src/v1/ekm_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/kms/v1/ekm_service.proto", + "../../protos/google/cloud/kms/v1/resources.proto", + "../../protos/google/cloud/kms/v1/service.proto" +] diff --git a/packages/google-cloud-kms/src/v1/gapic_metadata.json b/packages/google-cloud-kms/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..587790c2d1d --- /dev/null +++ b/packages/google-cloud-kms/src/v1/gapic_metadata.json @@ -0,0 +1,357 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.kms.v1", + "libraryPackage": "@google-cloud/kms", + "services": { + "EkmService": { + "clients": { + "grpc": { + "libraryClient": "EkmServiceClient", + "rpcs": { + "GetEkmConnection": { + "methods": [ + "getEkmConnection" + ] + }, + "CreateEkmConnection": { + "methods": [ + "createEkmConnection" + ] + }, + "UpdateEkmConnection": { + "methods": [ + "updateEkmConnection" + ] + }, + "ListEkmConnections": { + "methods": [ + "listEkmConnections", + "listEkmConnectionsStream", + "listEkmConnectionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EkmServiceClient", + "rpcs": { + "GetEkmConnection": { + "methods": [ + "getEkmConnection" + ] + }, + "CreateEkmConnection": { + "methods": [ + "createEkmConnection" + ] + }, + "UpdateEkmConnection": { + "methods": [ + "updateEkmConnection" + ] + }, + "ListEkmConnections": { + "methods": [ + "listEkmConnections", + "listEkmConnectionsStream", + "listEkmConnectionsAsync" + ] + } + } + } + } + }, + "KeyManagementService": { + "clients": { + "grpc": { + "libraryClient": "KeyManagementServiceClient", + "rpcs": { + "GetKeyRing": { + "methods": [ + "getKeyRing" + ] + }, + "GetCryptoKey": { + "methods": [ + "getCryptoKey" + ] + }, + "GetCryptoKeyVersion": { + "methods": [ + "getCryptoKeyVersion" + ] + }, + "GetPublicKey": { + "methods": [ + "getPublicKey" + ] + }, + "GetImportJob": { + "methods": [ + "getImportJob" + ] + }, + "CreateKeyRing": { + "methods": [ + "createKeyRing" + ] + }, + "CreateCryptoKey": { + "methods": [ + "createCryptoKey" + ] + }, + "CreateCryptoKeyVersion": { + "methods": [ + "createCryptoKeyVersion" + ] + }, + "ImportCryptoKeyVersion": { + "methods": [ + "importCryptoKeyVersion" + ] + }, + "CreateImportJob": { + "methods": [ + "createImportJob" + ] + }, + "UpdateCryptoKey": { + "methods": [ + "updateCryptoKey" + ] + }, + "UpdateCryptoKeyVersion": { + "methods": [ + "updateCryptoKeyVersion" + ] + }, + "UpdateCryptoKeyPrimaryVersion": { + "methods": [ + "updateCryptoKeyPrimaryVersion" + ] + }, + "DestroyCryptoKeyVersion": { + "methods": [ + "destroyCryptoKeyVersion" + ] + }, + "RestoreCryptoKeyVersion": { + "methods": [ + "restoreCryptoKeyVersion" + ] + }, + "Encrypt": { + "methods": [ + "encrypt" + ] + }, + "Decrypt": { + "methods": [ + "decrypt" + ] + }, + "AsymmetricSign": { + "methods": [ + "asymmetricSign" + ] + }, + "AsymmetricDecrypt": { + "methods": [ + "asymmetricDecrypt" + ] + }, + "MacSign": { + "methods": [ + "macSign" + ] + }, + "MacVerify": { + "methods": [ + "macVerify" + ] + }, + "GenerateRandomBytes": { + "methods": [ + "generateRandomBytes" + ] + }, + "ListKeyRings": { + "methods": [ + "listKeyRings", + "listKeyRingsStream", + "listKeyRingsAsync" + ] + }, + "ListCryptoKeys": { + "methods": [ + "listCryptoKeys", + "listCryptoKeysStream", + "listCryptoKeysAsync" + ] + }, + "ListCryptoKeyVersions": { + "methods": [ + "listCryptoKeyVersions", + "listCryptoKeyVersionsStream", + "listCryptoKeyVersionsAsync" + ] + }, + "ListImportJobs": { + "methods": [ + "listImportJobs", + "listImportJobsStream", + "listImportJobsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "KeyManagementServiceClient", + "rpcs": { + "GetKeyRing": { + "methods": [ + "getKeyRing" + ] + }, + "GetCryptoKey": { + "methods": [ + "getCryptoKey" + ] + }, + "GetCryptoKeyVersion": { + "methods": [ + "getCryptoKeyVersion" + ] + }, + "GetPublicKey": { + "methods": [ + "getPublicKey" + ] + }, + "GetImportJob": { + "methods": [ + "getImportJob" + ] + }, + "CreateKeyRing": { + "methods": [ + "createKeyRing" + ] + }, + "CreateCryptoKey": { + "methods": [ + "createCryptoKey" + ] + }, + "CreateCryptoKeyVersion": { + "methods": [ + "createCryptoKeyVersion" + ] + }, + "ImportCryptoKeyVersion": { + "methods": [ + "importCryptoKeyVersion" + ] + }, + "CreateImportJob": { + "methods": [ + "createImportJob" + ] + }, + "UpdateCryptoKey": { + "methods": [ + "updateCryptoKey" + ] + }, + "UpdateCryptoKeyVersion": { + "methods": [ + "updateCryptoKeyVersion" + ] + }, + "UpdateCryptoKeyPrimaryVersion": { + "methods": [ + "updateCryptoKeyPrimaryVersion" + ] + }, + "DestroyCryptoKeyVersion": { + "methods": [ + "destroyCryptoKeyVersion" + ] + }, + "RestoreCryptoKeyVersion": { + "methods": [ + "restoreCryptoKeyVersion" + ] + }, + "Encrypt": { + "methods": [ + "encrypt" + ] + }, + "Decrypt": { + "methods": [ + "decrypt" + ] + }, + "AsymmetricSign": { + "methods": [ + "asymmetricSign" + ] + }, + "AsymmetricDecrypt": { + "methods": [ + "asymmetricDecrypt" + ] + }, + "MacSign": { + "methods": [ + "macSign" + ] + }, + "MacVerify": { + "methods": [ + "macVerify" + ] + }, + "GenerateRandomBytes": { + "methods": [ + "generateRandomBytes" + ] + }, + "ListKeyRings": { + "methods": [ + "listKeyRings", + "listKeyRingsStream", + "listKeyRingsAsync" + ] + }, + "ListCryptoKeys": { + "methods": [ + "listCryptoKeys", + "listCryptoKeysStream", + "listCryptoKeysAsync" + ] + }, + "ListCryptoKeyVersions": { + "methods": [ + "listCryptoKeyVersions", + "listCryptoKeyVersionsStream", + "listCryptoKeyVersionsAsync" + ] + }, + "ListImportJobs": { + "methods": [ + "listImportJobs", + "listImportJobsStream", + "listImportJobsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-kms/src/v1/index.ts b/packages/google-cloud-kms/src/v1/index.ts new file mode 100644 index 00000000000..e6c52a0385e --- /dev/null +++ b/packages/google-cloud-kms/src/v1/index.ts @@ -0,0 +1,20 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {EkmServiceClient} from './ekm_service_client'; +export {KeyManagementServiceClient} from './key_management_service_client'; diff --git a/packages/google-cloud-kms/src/v1/key_management_service_client.ts b/packages/google-cloud-kms/src/v1/key_management_service_client.ts new file mode 100644 index 00000000000..6ef11fde1a0 --- /dev/null +++ b/packages/google-cloud-kms/src/v1/key_management_service_client.ts @@ -0,0 +1,4466 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/key_management_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './key_management_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Google Cloud Key Management Service + * + * Manages cryptographic keys and operations using those keys. Implements a REST + * model with the following objects: + * + * * {@link google.cloud.kms.v1.KeyRing|KeyRing} + * * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} + * * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} + * * {@link google.cloud.kms.v1.ImportJob|ImportJob} + * + * If you are using manual gRPC libraries, see + * [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). + * @class + * @memberof v1 + */ +export class KeyManagementServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + keyManagementServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of KeyManagementServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new KeyManagementServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof KeyManagementServiceClient; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + ), + cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}' + ), + ekmConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/ekmConnections/{ekm_connection}' + ), + importJobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}' + ), + keyRingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + publicKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}/publicKey' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listKeyRings: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'keyRings' + ), + listCryptoKeys: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'cryptoKeys' + ), + listCryptoKeyVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'cryptoKeyVersions' + ), + listImportJobs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'importJobs' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.kms.v1.KeyManagementService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.keyManagementServiceStub) { + return this.keyManagementServiceStub; + } + + // Put together the "service stub" for + // google.cloud.kms.v1.KeyManagementService. + this.keyManagementServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.kms.v1.KeyManagementService' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.kms.v1.KeyManagementService, + this._opts, + this._providedCustomServicePath + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const keyManagementServiceStubMethods = [ + 'listKeyRings', + 'listCryptoKeys', + 'listCryptoKeyVersions', + 'listImportJobs', + 'getKeyRing', + 'getCryptoKey', + 'getCryptoKeyVersion', + 'getPublicKey', + 'getImportJob', + 'createKeyRing', + 'createCryptoKey', + 'createCryptoKeyVersion', + 'importCryptoKeyVersion', + 'createImportJob', + 'updateCryptoKey', + 'updateCryptoKeyVersion', + 'updateCryptoKeyPrimaryVersion', + 'destroyCryptoKeyVersion', + 'restoreCryptoKeyVersion', + 'encrypt', + 'decrypt', + 'asymmetricSign', + 'asymmetricDecrypt', + 'macSign', + 'macVerify', + 'generateRandomBytes', + ]; + for (const methodName of keyManagementServiceStubMethods) { + const callPromise = this.keyManagementServiceStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.keyManagementServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudkms.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 'cloudkms.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/cloudkms', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Returns metadata for a given {@link google.cloud.kms.v1.KeyRing|KeyRing}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.kms.v1.KeyRing.name|name} of the + * {@link google.cloud.kms.v1.KeyRing|KeyRing} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [KeyRing]{@link google.cloud.kms.v1.KeyRing}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_key_ring.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetKeyRing_async + */ + getKeyRing( + request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest | undefined, + {} | undefined + ] + >; + getKeyRing( + request: protos.google.cloud.kms.v1.IGetKeyRingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest | null | undefined, + {} | null | undefined + > + ): void; + getKeyRing( + request: protos.google.cloud.kms.v1.IGetKeyRingRequest, + callback: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest | null | undefined, + {} | null | undefined + > + ): void; + getKeyRing( + request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.IGetKeyRingRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getKeyRing(request, options, callback); + } + /** + * Returns metadata for a given {@link google.cloud.kms.v1.CryptoKey|CryptoKey}, as + * well as its {@link google.cloud.kms.v1.CryptoKey.primary|primary} + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.kms.v1.CryptoKey.name|name} of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKey]{@link google.cloud.kms.v1.CryptoKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_crypto_key.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async + */ + getCryptoKey( + request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest | undefined, + {} | undefined + ] + >; + getCryptoKey( + request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): void; + getCryptoKey( + request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): void; + getCryptoKey( + request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IGetCryptoKeyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCryptoKey(request, options, callback); + } + /** + * Returns metadata for a given + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.kms.v1.CryptoKeyVersion.name|name} of the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async + */ + getCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | undefined, + {} | undefined + ] + >; + getCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | null | undefined, + {} | null | undefined + > + ): void; + getCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | null | undefined, + {} | null | undefined + > + ): void; + getCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getCryptoKeyVersion(request, options, callback); + } + /** + * Returns the public key for the given + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. The + * {@link google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be + * {@link google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN|ASYMMETRIC_SIGN} + * or + * {@link google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT|ASYMMETRIC_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.kms.v1.CryptoKeyVersion.name|name} of the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} public key to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PublicKey]{@link google.cloud.kms.v1.PublicKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_public_key.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetPublicKey_async + */ + getPublicKey( + request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest | undefined, + {} | undefined + ] + >; + getPublicKey( + request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest | null | undefined, + {} | null | undefined + > + ): void; + getPublicKey( + request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, + callback: Callback< + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest | null | undefined, + {} | null | undefined + > + ): void; + getPublicKey( + request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IPublicKey, + protos.google.cloud.kms.v1.IGetPublicKeyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPublicKey(request, options, callback); + } + /** + * Returns metadata for a given {@link google.cloud.kms.v1.ImportJob|ImportJob}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The {@link google.cloud.kms.v1.ImportJob.name|name} of the + * {@link google.cloud.kms.v1.ImportJob|ImportJob} to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ImportJob]{@link google.cloud.kms.v1.ImportJob}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.get_import_job.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GetImportJob_async + */ + getImportJob( + request?: protos.google.cloud.kms.v1.IGetImportJobRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest | undefined, + {} | undefined + ] + >; + getImportJob( + request: protos.google.cloud.kms.v1.IGetImportJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest | null | undefined, + {} | null | undefined + > + ): void; + getImportJob( + request: protos.google.cloud.kms.v1.IGetImportJobRequest, + callback: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest | null | undefined, + {} | null | undefined + > + ): void; + getImportJob( + request?: protos.google.cloud.kms.v1.IGetImportJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.IGetImportJobRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getImportJob(request, options, callback); + } + /** + * Create a new {@link google.cloud.kms.v1.KeyRing|KeyRing} in a given Project and + * Location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link google.cloud.kms.v1.KeyRing|KeyRings}, in the format + * `projects/* /locations/*`. + * @param {string} request.keyRingId + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.kms.v1.KeyRing} request.keyRing + * Required. A {@link google.cloud.kms.v1.KeyRing|KeyRing} with initial field + * values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [KeyRing]{@link google.cloud.kms.v1.KeyRing}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.create_key_ring.js + * region_tag:cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async + */ + createKeyRing( + request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest | undefined, + {} | undefined + ] + >; + createKeyRing( + request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest | null | undefined, + {} | null | undefined + > + ): void; + createKeyRing( + request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, + callback: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest | null | undefined, + {} | null | undefined + > + ): void; + createKeyRing( + request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IKeyRing, + protos.google.cloud.kms.v1.ICreateKeyRingRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createKeyRing(request, options, callback); + } + /** + * Create a new {@link google.cloud.kms.v1.CryptoKey|CryptoKey} within a + * {@link google.cloud.kms.v1.KeyRing|KeyRing}. + * + * {@link google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} and + * {@link google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm|CryptoKey.version_template.algorithm} + * are required. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.kms.v1.KeyRing.name|name} of the KeyRing + * associated with the {@link google.cloud.kms.v1.CryptoKey|CryptoKeys}. + * @param {string} request.cryptoKeyId + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey + * Required. A {@link google.cloud.kms.v1.CryptoKey|CryptoKey} with initial field + * values. + * @param {boolean} request.skipInitialVersionCreation + * If set to true, the request will create a + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} without any + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. You must + * manually call + * {@link google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion|CreateCryptoKeyVersion} + * or + * {@link google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion|ImportCryptoKeyVersion} + * before you can use this {@link google.cloud.kms.v1.CryptoKey|CryptoKey}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKey]{@link google.cloud.kms.v1.CryptoKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.create_crypto_key.js + * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async + */ + createCryptoKey( + request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | undefined, + {} | undefined + ] + >; + createCryptoKey( + request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): void; + createCryptoKey( + request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): void; + createCryptoKey( + request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCryptoKey(request, options, callback); + } + /** + * Create a new {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in a + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey}. + * + * The server will assign the next sequential id. If unset, + * {@link google.cloud.kms.v1.CryptoKeyVersion.state|state} will be set to + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.kms.v1.CryptoKey.name|name} of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} associated with the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. + * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion + * Required. A {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with + * initial field values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.create_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async + */ + createCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest | undefined, + {} | undefined + ] + >; + createCryptoKeyVersion( + request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createCryptoKeyVersion( + request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createCryptoKeyVersion( + request, + options, + callback + ); + } + /** + * Import wrapped key material into a + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * + * All requests must specify a {@link google.cloud.kms.v1.CryptoKey|CryptoKey}. If + * a {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} is additionally + * specified in the request, key material will be reimported into that + * version. Otherwise, a new version will be created, and will be assigned the + * next sequential id within the {@link google.cloud.kms.v1.CryptoKey|CryptoKey}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.kms.v1.CryptoKey.name|name} of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} to be imported into. + * + * The create permission is only required on this key when creating a new + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. + * @param {string} [request.cryptoKeyVersion] + * Optional. The optional {@link google.cloud.kms.v1.CryptoKeyVersion.name|name} of + * an existing {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to + * target for an import operation. If this field is not present, a new + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} containing the + * supplied key material is created. + * + * If this field is present, the supplied key material is imported into + * the existing {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. To + * import into an existing + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}, the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} must be a child of + * {@link google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent|ImportCryptoKeyVersionRequest.parent}, + * have been previously created via {@link |ImportCryptoKeyVersion}, and be in + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED|DESTROYED} + * or + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED|IMPORT_FAILED} + * state. The key material and algorithm must match the previous + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} exactly if the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} has ever contained + * key material. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} request.algorithm + * Required. The + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|algorithm} + * of the key being imported. This does not need to match the + * {@link google.cloud.kms.v1.CryptoKey.version_template|version_template} of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} this version imports into. + * @param {string} request.importJob + * Required. The {@link google.cloud.kms.v1.ImportJob.name|name} of the + * {@link google.cloud.kms.v1.ImportJob|ImportJob} that was used to wrap this key + * material. + * @param {Buffer} request.rsaAesWrappedKey + * Wrapped key material produced with + * {@link google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256|RSA_OAEP_3072_SHA1_AES_256} + * or + * {@link google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256|RSA_OAEP_4096_SHA1_AES_256}. + * + * This field contains the concatenation of two wrapped keys: + *
    + *
  1. An ephemeral AES-256 wrapping key wrapped with the + * {@link google.cloud.kms.v1.ImportJob.public_key|public_key} using + * RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an + * empty label. + *
  2. + *
  3. The key to be imported, wrapped with the ephemeral AES-256 key + * using AES-KWP (RFC 5649). + *
  4. + *
+ * + * If importing symmetric key material, it is expected that the unwrapped + * key contains plain bytes. If importing asymmetric key material, it is + * expected that the unwrapped key is in PKCS#8-encoded DER format (the + * PrivateKeyInfo structure from RFC 5208). + * + * This format is the same as the format produced by PKCS#11 mechanism + * CKM_RSA_AES_KEY_WRAP. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.import_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async + */ + importCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest | undefined, + {} | undefined + ] + >; + importCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + importCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + importCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.importCryptoKeyVersion( + request, + options, + callback + ); + } + /** + * Create a new {@link google.cloud.kms.v1.ImportJob|ImportJob} within a + * {@link google.cloud.kms.v1.KeyRing|KeyRing}. + * + * {@link google.cloud.kms.v1.ImportJob.import_method|ImportJob.import_method} is + * required. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The {@link google.cloud.kms.v1.KeyRing.name|name} of the + * {@link google.cloud.kms.v1.KeyRing|KeyRing} associated with the + * {@link google.cloud.kms.v1.ImportJob|ImportJobs}. + * @param {string} request.importJobId + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param {google.cloud.kms.v1.ImportJob} request.importJob + * Required. An {@link google.cloud.kms.v1.ImportJob|ImportJob} with initial field + * values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ImportJob]{@link google.cloud.kms.v1.ImportJob}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.create_import_job.js + * region_tag:cloudkms_v1_generated_KeyManagementService_CreateImportJob_async + */ + createImportJob( + request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest | undefined, + {} | undefined + ] + >; + createImportJob( + request: protos.google.cloud.kms.v1.ICreateImportJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest | null | undefined, + {} | null | undefined + > + ): void; + createImportJob( + request: protos.google.cloud.kms.v1.ICreateImportJobRequest, + callback: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest | null | undefined, + {} | null | undefined + > + ): void; + createImportJob( + request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IImportJob, + protos.google.cloud.kms.v1.ICreateImportJobRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createImportJob(request, options, callback); + } + /** + * Update a {@link google.cloud.kms.v1.CryptoKey|CryptoKey}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey + * Required. {@link google.cloud.kms.v1.CryptoKey|CryptoKey} with updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. List of fields to be updated in this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKey]{@link google.cloud.kms.v1.CryptoKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.update_crypto_key.js + * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async + */ + updateCryptoKey( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | undefined, + {} | undefined + ] + >; + updateCryptoKey( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): void; + updateCryptoKey( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): void; + updateCryptoKey( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey, + protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'crypto_key.name': request.cryptoKey!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCryptoKey(request, options, callback); + } + /** + * Update a {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s + * metadata. + * + * {@link google.cloud.kms.v1.CryptoKeyVersion.state|state} may be changed between + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED} + * and + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED} + * using this method. See + * {@link google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion|DestroyCryptoKeyVersion} + * and + * {@link google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} + * to move between other states. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion + * Required. {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with + * updated values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. List of fields to be updated in this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.update_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async + */ + updateCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest | undefined, + {} | undefined + ] + >; + updateCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'crypto_key_version.name': request.cryptoKeyVersion!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCryptoKeyVersion( + request, + options, + callback + ); + } + /** + * Update the version of a {@link google.cloud.kms.v1.CryptoKey|CryptoKey} that + * will be used in + * {@link google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. + * + * Returns an error if called on a key whose purpose is not + * {@link google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} to update. + * @param {string} request.cryptoKeyVersionId + * Required. The id of the child + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use as primary. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKey]{@link google.cloud.kms.v1.CryptoKey}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.update_crypto_key_primary_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async + */ + updateCryptoKeyPrimaryVersion( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey, + ( + | protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest + | undefined + ), + {} | undefined + ] + >; + updateCryptoKeyPrimaryVersion( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + | protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCryptoKeyPrimaryVersion( + request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + | protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateCryptoKeyPrimaryVersion( + request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKey, + | protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKey, + | protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey, + ( + | protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateCryptoKeyPrimaryVersion( + request, + options, + callback + ); + } + /** + * Schedule a {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} for + * destruction. + * + * Upon calling this method, + * {@link google.cloud.kms.v1.CryptoKeyVersion.state|CryptoKeyVersion.state} will + * be set to + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED}, + * and {@link google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will + * be set to the time + * {@link google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration|destroy_scheduled_duration} + * in the future. At that time, the + * {@link google.cloud.kms.v1.CryptoKeyVersion.state|state} will automatically + * change to + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED|DESTROYED}, + * and the key material will be irrevocably destroyed. + * + * Before the + * {@link google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} is + * reached, + * {@link google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} + * may be called to reverse the process. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to destroy. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.destroy_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async + */ + destroyCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest | undefined, + {} | undefined + ] + >; + destroyCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + destroyCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + destroyCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.destroyCryptoKeyVersion( + request, + options, + callback + ); + } + /** + * Restore a {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in the + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED} + * state. + * + * Upon restoration of the CryptoKeyVersion, + * {@link google.cloud.kms.v1.CryptoKeyVersion.state|state} will be set to + * {@link google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED}, + * and {@link google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will + * be cleared. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to restore. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.restore_crypto_key_version.js + * region_tag:cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async + */ + restoreCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest | undefined, + {} | undefined + ] + >; + restoreCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + restoreCryptoKeyVersion( + request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, + callback: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + restoreCryptoKeyVersion( + request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.ICryptoKeyVersion, + | protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion, + protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.restoreCryptoKeyVersion( + request, + options, + callback + ); + } + /** + * Encrypts data, so that it can only be recovered by a call to + * {@link google.cloud.kms.v1.KeyManagementService.Decrypt|Decrypt}. The + * {@link google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be + * {@link google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} or + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * encryption. + * + * If a {@link google.cloud.kms.v1.CryptoKey|CryptoKey} is specified, the server + * will use its {@link google.cloud.kms.v1.CryptoKey.primary|primary version}. + * @param {Buffer} request.plaintext + * Required. The data to encrypt. Must be no larger than 64KiB. + * + * The maximum size depends on the key version's + * {@link google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. + * For {@link google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the + * plaintext must be no larger than 64KiB. For + * {@link google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + * @param {Buffer} [request.additionalAuthenticatedData] + * Optional. Optional data that, if specified, must also be provided during + * decryption through + * {@link google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}. + * + * The maximum size depends on the key version's + * {@link google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. + * For {@link google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the AAD + * must be no larger than 64KiB. For + * {@link google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of + * the plaintext and additional_authenticated_data fields must be no larger + * than 8KiB. + * @param {google.protobuf.Int64Value} [request.plaintextCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext}. + * If specified, + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext} + * using this checksum. + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.EncryptRequest.plaintext|EncryptRequest.plaintext}) + * is equal to + * {@link google.cloud.kms.v1.EncryptRequest.plaintext_crc32c|EncryptRequest.plaintext_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}. + * If specified, + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data} + * using this checksum. + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}) + * is equal to + * {@link google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c|EncryptRequest.additional_authenticated_data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this 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 [EncryptResponse]{@link google.cloud.kms.v1.EncryptResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.encrypt.js + * region_tag:cloudkms_v1_generated_KeyManagementService_Encrypt_async + */ + encrypt( + request?: protos.google.cloud.kms.v1.IEncryptRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest | undefined, + {} | undefined + ] + >; + encrypt( + request: protos.google.cloud.kms.v1.IEncryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest | null | undefined, + {} | null | undefined + > + ): void; + encrypt( + request: protos.google.cloud.kms.v1.IEncryptRequest, + callback: Callback< + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest | null | undefined, + {} | null | undefined + > + ): void; + encrypt( + request?: protos.google.cloud.kms.v1.IEncryptRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IEncryptResponse, + protos.google.cloud.kms.v1.IEncryptRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.encrypt(request, options, callback); + } + /** + * Decrypts data that was protected by + * {@link google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. The + * {@link google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be + * {@link google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} to use for decryption. The + * server will choose the appropriate version. + * @param {Buffer} request.ciphertext + * Required. The encrypted data originally returned in + * {@link google.cloud.kms.v1.EncryptResponse.ciphertext|EncryptResponse.ciphertext}. + * @param {Buffer} [request.additionalAuthenticatedData] + * Optional. Optional data that must match the data originally supplied in + * {@link google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}. + * @param {google.protobuf.Int64Value} [request.ciphertextCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext}. + * If specified, + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext} + * using this checksum. + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.DecryptRequest.ciphertext|DecryptRequest.ciphertext}) + * is equal to + * {@link google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c|DecryptRequest.ciphertext_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {google.protobuf.Int64Value} [request.additionalAuthenticatedDataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}. + * If specified, + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data} + * using this checksum. + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}) + * is equal to + * {@link google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c|DecryptRequest.additional_authenticated_data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this 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 [DecryptResponse]{@link google.cloud.kms.v1.DecryptResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.decrypt.js + * region_tag:cloudkms_v1_generated_KeyManagementService_Decrypt_async + */ + decrypt( + request?: protos.google.cloud.kms.v1.IDecryptRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest | undefined, + {} | undefined + ] + >; + decrypt( + request: protos.google.cloud.kms.v1.IDecryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest | null | undefined, + {} | null | undefined + > + ): void; + decrypt( + request: protos.google.cloud.kms.v1.IDecryptRequest, + callback: Callback< + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest | null | undefined, + {} | null | undefined + > + ): void; + decrypt( + request?: protos.google.cloud.kms.v1.IDecryptRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IDecryptResponse, + protos.google.cloud.kms.v1.IDecryptRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.decrypt(request, options, callback); + } + /** + * Signs data using a {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} + * with {@link google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} + * ASYMMETRIC_SIGN, producing a signature that can be verified with the public + * key retrieved from + * {@link google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * signing. + * @param {google.cloud.kms.v1.Digest} [request.digest] + * Optional. The digest of the data to sign. The digest must be produced with + * the same digest algorithm as specified by the key version's + * {@link google.cloud.kms.v1.CryptoKeyVersion.algorithm|algorithm}. + * + * This field may not be supplied if + * {@link google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data} + * is supplied. + * @param {google.protobuf.Int64Value} [request.digestCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest}. + * If specified, + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest} + * using this checksum. + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest}) + * is equal to + * {@link google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c|AsymmetricSignRequest.digest_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {Buffer} [request.data] + * Optional. The data to sign. + * It can't be supplied if + * {@link google.cloud.kms.v1.AsymmetricSignRequest.digest|AsymmetricSignRequest.digest} + * is supplied. + * @param {google.protobuf.Int64Value} [request.dataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data}. + * If specified, + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data} + * using this checksum. + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.AsymmetricSignRequest.data|AsymmetricSignRequest.data}) + * is equal to + * {@link google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c|AsymmetricSignRequest.data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this 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 [AsymmetricSignResponse]{@link google.cloud.kms.v1.AsymmetricSignResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.asymmetric_sign.js + * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async + */ + asymmetricSign( + request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest | undefined, + {} | undefined + ] + >; + asymmetricSign( + request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest | null | undefined, + {} | null | undefined + > + ): void; + asymmetricSign( + request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, + callback: Callback< + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest | null | undefined, + {} | null | undefined + > + ): void; + asymmetricSign( + request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IAsymmetricSignResponse, + protos.google.cloud.kms.v1.IAsymmetricSignRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.asymmetricSign(request, options, callback); + } + /** + * Decrypts data that was encrypted with a public key retrieved from + * {@link google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey} + * corresponding to a {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} + * with {@link google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} + * ASYMMETRIC_DECRYPT. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * decryption. + * @param {Buffer} request.ciphertext + * Required. The data encrypted with the named + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s public key using + * OAEP. + * @param {google.protobuf.Int64Value} [request.ciphertextCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext}. + * If specified, + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * verify the integrity of the received + * {@link google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext} + * using this checksum. + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext|AsymmetricDecryptRequest.ciphertext}) + * is equal to + * {@link google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c|AsymmetricDecryptRequest.ciphertext_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this 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 [AsymmetricDecryptResponse]{@link google.cloud.kms.v1.AsymmetricDecryptResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.asymmetric_decrypt.js + * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async + */ + asymmetricDecrypt( + request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | undefined, + {} | undefined + ] + >; + asymmetricDecrypt( + request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | null | undefined, + {} | null | undefined + > + ): void; + asymmetricDecrypt( + request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, + callback: Callback< + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | null | undefined, + {} | null | undefined + > + ): void; + asymmetricDecrypt( + request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + | protos.google.cloud.kms.v1.IAsymmetricDecryptRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, + protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.asymmetricDecrypt(request, options, callback); + } + /** + * Signs data using a {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} + * with {@link google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} MAC, + * producing a tag that can be verified by another source with the same key. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * signing. + * @param {Buffer} request.data + * Required. The data to sign. The MAC tag is computed over this data field + * based on the specific algorithm. + * @param {google.protobuf.Int64Value} [request.dataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data}. If + * specified, {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will verify the integrity of the received + * {@link google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data} using this + * checksum. {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data}) is + * equal to + * {@link google.cloud.kms.v1.MacSignRequest.data_crc32c|MacSignRequest.data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this 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 [MacSignResponse]{@link google.cloud.kms.v1.MacSignResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.mac_sign.js + * region_tag:cloudkms_v1_generated_KeyManagementService_MacSign_async + */ + macSign( + request?: protos.google.cloud.kms.v1.IMacSignRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest | undefined, + {} | undefined + ] + >; + macSign( + request: protos.google.cloud.kms.v1.IMacSignRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest | null | undefined, + {} | null | undefined + > + ): void; + macSign( + request: protos.google.cloud.kms.v1.IMacSignRequest, + callback: Callback< + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest | null | undefined, + {} | null | undefined + > + ): void; + macSign( + request?: protos.google.cloud.kms.v1.IMacSignRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IMacSignResponse, + protos.google.cloud.kms.v1.IMacSignRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.macSign(request, options, callback); + } + /** + * Verifies MAC tag using a + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with + * {@link google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} MAC, and returns + * a response that indicates whether or not the verification was successful. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for + * verification. + * @param {Buffer} request.data + * Required. The data used previously as a + * {@link google.cloud.kms.v1.MacSignRequest.data|MacSignRequest.data} to generate + * the MAC tag. + * @param {google.protobuf.Int64Value} [request.dataCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data}. If + * specified, {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will verify the integrity of the received + * {@link google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data} using + * this checksum. + * {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} will + * report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link google.cloud.kms.v1.MacVerifyRequest.data|MacVerifyRequest.data}) + * is equal to + * {@link google.cloud.kms.v1.MacVerifyRequest.data_crc32c|MacVerifyRequest.data_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this type. + * @param {Buffer} request.mac + * Required. The signature to verify. + * @param {google.protobuf.Int64Value} [request.macCrc32c] + * Optional. An optional CRC32C checksum of the + * {@link google.cloud.kms.v1.MacVerifyRequest.mac|MacVerifyRequest.mac}. If + * specified, {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will verify the integrity of the received + * {@link google.cloud.kms.v1.MacVerifyRequest.mac|MacVerifyRequest.mac} using this + * checksum. {@link google.cloud.kms.v1.KeyManagementService|KeyManagementService} + * will report an error if the checksum verification fails. If you receive a + * checksum error, your client should verify that + * CRC32C({@link |MacVerifyRequest.tag}) is equal to + * {@link google.cloud.kms.v1.MacVerifyRequest.mac_crc32c|MacVerifyRequest.mac_crc32c}, + * and if so, perform a limited number of retries. A persistent mismatch may + * indicate an issue in your computation of the CRC32C checksum. Note: This + * field is defined as int64 for reasons of compatibility across different + * languages. However, it is a non-negative integer, which will never exceed + * 2^32-1, and can be safely downconverted to uint32 in languages that support + * this 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 [MacVerifyResponse]{@link google.cloud.kms.v1.MacVerifyResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.mac_verify.js + * region_tag:cloudkms_v1_generated_KeyManagementService_MacVerify_async + */ + macVerify( + request?: protos.google.cloud.kms.v1.IMacVerifyRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest | undefined, + {} | undefined + ] + >; + macVerify( + request: protos.google.cloud.kms.v1.IMacVerifyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest | null | undefined, + {} | null | undefined + > + ): void; + macVerify( + request: protos.google.cloud.kms.v1.IMacVerifyRequest, + callback: Callback< + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest | null | undefined, + {} | null | undefined + > + ): void; + macVerify( + request?: protos.google.cloud.kms.v1.IMacVerifyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IMacVerifyResponse, + protos.google.cloud.kms.v1.IMacVerifyRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.macVerify(request, options, callback); + } + /** + * Generate random bytes using the Cloud KMS randomness source in the provided + * location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.location + * The project-specific location in which to generate random bytes. + * For example, "projects/my-project/locations/us-central1". + * @param {number} request.lengthBytes + * The length in bytes of the amount of randomness to retrieve. Minimum 8 + * bytes, maximum 1024 bytes. + * @param {google.cloud.kms.v1.ProtectionLevel} request.protectionLevel + * The {@link google.cloud.kms.v1.ProtectionLevel|ProtectionLevel} to use when + * generating the random data. Currently, only + * {@link google.cloud.kms.v1.ProtectionLevel.HSM|HSM} protection level is + * supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [GenerateRandomBytesResponse]{@link google.cloud.kms.v1.GenerateRandomBytesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.generate_random_bytes.js + * region_tag:cloudkms_v1_generated_KeyManagementService_GenerateRandomBytes_async + */ + generateRandomBytes( + request?: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | undefined, + {} | undefined + ] + >; + generateRandomBytes( + request: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | null | undefined, + {} | null | undefined + > + ): void; + generateRandomBytes( + request: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, + callback: Callback< + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | null | undefined, + {} | null | undefined + > + ): void; + generateRandomBytes( + request?: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + | protos.google.cloud.kms.v1.IGenerateRandomBytesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, + protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + location: request.location ?? '', + }); + this.initialize(); + return this.innerApiCalls.generateRandomBytes(request, options, callback); + } + + /** + * Lists {@link google.cloud.kms.v1.KeyRing|KeyRings}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link google.cloud.kms.v1.KeyRing|KeyRings}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further + * {@link google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by + * including the + * {@link google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [KeyRing]{@link google.cloud.kms.v1.KeyRing}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listKeyRingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listKeyRings( + request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IKeyRing[], + protos.google.cloud.kms.v1.IListKeyRingsRequest | null, + protos.google.cloud.kms.v1.IListKeyRingsResponse + ] + >; + listKeyRings( + request: protos.google.cloud.kms.v1.IListKeyRingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListKeyRingsRequest, + protos.google.cloud.kms.v1.IListKeyRingsResponse | null | undefined, + protos.google.cloud.kms.v1.IKeyRing + > + ): void; + listKeyRings( + request: protos.google.cloud.kms.v1.IListKeyRingsRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListKeyRingsRequest, + protos.google.cloud.kms.v1.IListKeyRingsResponse | null | undefined, + protos.google.cloud.kms.v1.IKeyRing + > + ): void; + listKeyRings( + request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.kms.v1.IListKeyRingsRequest, + protos.google.cloud.kms.v1.IListKeyRingsResponse | null | undefined, + protos.google.cloud.kms.v1.IKeyRing + >, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListKeyRingsRequest, + protos.google.cloud.kms.v1.IListKeyRingsResponse | null | undefined, + protos.google.cloud.kms.v1.IKeyRing + > + ): Promise< + [ + protos.google.cloud.kms.v1.IKeyRing[], + protos.google.cloud.kms.v1.IListKeyRingsRequest | null, + protos.google.cloud.kms.v1.IListKeyRingsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listKeyRings(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 resource name of the location associated with the + * {@link google.cloud.kms.v1.KeyRing|KeyRings}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further + * {@link google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by + * including the + * {@link google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 [KeyRing]{@link google.cloud.kms.v1.KeyRing} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listKeyRingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listKeyRingsStream( + request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listKeyRings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKeyRings.createStream( + this.innerApiCalls.listKeyRings as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listKeyRings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location associated with the + * {@link google.cloud.kms.v1.KeyRing|KeyRings}, in the format + * `projects/* /locations/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.KeyRing|KeyRings} to include in the response. Further + * {@link google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by + * including the + * {@link google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 + * [KeyRing]{@link google.cloud.kms.v1.KeyRing}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.list_key_rings.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ListKeyRings_async + */ + listKeyRingsAsync( + request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listKeyRings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKeyRings.asyncIterate( + this.innerApiCalls['listKeyRings'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.kms.v1.CryptoKey|CryptoKeys}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. + * Further {@link google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be + * obtained by including the + * {@link google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView + * The fields of the primary version to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CryptoKey]{@link google.cloud.kms.v1.CryptoKey}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCryptoKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCryptoKeys( + request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey[], + protos.google.cloud.kms.v1.IListCryptoKeysRequest | null, + protos.google.cloud.kms.v1.IListCryptoKeysResponse + ] + >; + listCryptoKeys( + request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.v1.IListCryptoKeysResponse | null | undefined, + protos.google.cloud.kms.v1.ICryptoKey + > + ): void; + listCryptoKeys( + request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.v1.IListCryptoKeysResponse | null | undefined, + protos.google.cloud.kms.v1.ICryptoKey + > + ): void; + listCryptoKeys( + request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.v1.IListCryptoKeysResponse | null | undefined, + protos.google.cloud.kms.v1.ICryptoKey + >, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeysRequest, + protos.google.cloud.kms.v1.IListCryptoKeysResponse | null | undefined, + protos.google.cloud.kms.v1.ICryptoKey + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKey[], + protos.google.cloud.kms.v1.IListCryptoKeysRequest | null, + protos.google.cloud.kms.v1.IListCryptoKeysResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCryptoKeys(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 resource name of the {@link google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. + * Further {@link google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be + * obtained by including the + * {@link google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView + * The fields of the primary version to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 [CryptoKey]{@link google.cloud.kms.v1.CryptoKey} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCryptoKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCryptoKeysStream( + request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeys.createStream( + this.innerApiCalls.listCryptoKeys as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listCryptoKeys`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the response. + * Further {@link google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be + * obtained by including the + * {@link google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView + * The fields of the primary version to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 + * [CryptoKey]{@link google.cloud.kms.v1.CryptoKey}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.list_crypto_keys.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async + */ + listCryptoKeysAsync( + request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeys']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeys.asyncIterate( + this.innerApiCalls['listCryptoKeys'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format + * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the + * response. Further {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} + * can subsequently be obtained by including the + * {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view + * The fields to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCryptoKeyVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCryptoKeyVersions( + request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion[], + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest | null, + protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse + ] + >; + listCryptoKeyVersions( + request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + | protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse + | null + | undefined, + protos.google.cloud.kms.v1.ICryptoKeyVersion + > + ): void; + listCryptoKeyVersions( + request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + | protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse + | null + | undefined, + protos.google.cloud.kms.v1.ICryptoKeyVersion + > + ): void; + listCryptoKeyVersions( + request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + | protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse + | null + | undefined, + protos.google.cloud.kms.v1.ICryptoKeyVersion + >, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + | protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse + | null + | undefined, + protos.google.cloud.kms.v1.ICryptoKeyVersion + > + ): Promise< + [ + protos.google.cloud.kms.v1.ICryptoKeyVersion[], + protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest | null, + protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listCryptoKeyVersions(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 resource name of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format + * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the + * response. Further {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} + * can subsequently be obtained by including the + * {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view + * The fields to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCryptoKeyVersionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listCryptoKeyVersionsStream( + request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeyVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeyVersions.createStream( + this.innerApiCalls.listCryptoKeyVersions as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listCryptoKeyVersions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the + * {@link google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format + * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to include in the + * response. Further {@link google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} + * can subsequently be obtained by including the + * {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. + * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view + * The fields to include in the response. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 + * [CryptoKeyVersion]{@link google.cloud.kms.v1.CryptoKeyVersion}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.list_crypto_key_versions.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async + */ + listCryptoKeyVersionsAsync( + request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listCryptoKeyVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCryptoKeyVersions.asyncIterate( + this.innerApiCalls['listCryptoKeyVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.kms.v1.ImportJob|ImportJobs}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. + * Further {@link google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be + * obtained by including the + * {@link google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [ImportJob]{@link google.cloud.kms.v1.ImportJob}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listImportJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listImportJobs( + request?: protos.google.cloud.kms.v1.IListImportJobsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.kms.v1.IImportJob[], + protos.google.cloud.kms.v1.IListImportJobsRequest | null, + protos.google.cloud.kms.v1.IListImportJobsResponse + ] + >; + listImportJobs( + request: protos.google.cloud.kms.v1.IListImportJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListImportJobsRequest, + protos.google.cloud.kms.v1.IListImportJobsResponse | null | undefined, + protos.google.cloud.kms.v1.IImportJob + > + ): void; + listImportJobs( + request: protos.google.cloud.kms.v1.IListImportJobsRequest, + callback: PaginationCallback< + protos.google.cloud.kms.v1.IListImportJobsRequest, + protos.google.cloud.kms.v1.IListImportJobsResponse | null | undefined, + protos.google.cloud.kms.v1.IImportJob + > + ): void; + listImportJobs( + request?: protos.google.cloud.kms.v1.IListImportJobsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.kms.v1.IListImportJobsRequest, + protos.google.cloud.kms.v1.IListImportJobsResponse | null | undefined, + protos.google.cloud.kms.v1.IImportJob + >, + callback?: PaginationCallback< + protos.google.cloud.kms.v1.IListImportJobsRequest, + protos.google.cloud.kms.v1.IListImportJobsResponse | null | undefined, + protos.google.cloud.kms.v1.IImportJob + > + ): Promise< + [ + protos.google.cloud.kms.v1.IImportJob[], + protos.google.cloud.kms.v1.IListImportJobsRequest | null, + protos.google.cloud.kms.v1.IListImportJobsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listImportJobs(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 resource name of the {@link google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. + * Further {@link google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be + * obtained by including the + * {@link google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 [ImportJob]{@link google.cloud.kms.v1.ImportJob} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listImportJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listImportJobsStream( + request?: protos.google.cloud.kms.v1.IListImportJobsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listImportJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listImportJobs.createStream( + this.innerApiCalls.listImportJobs as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listImportJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.kms.v1.KeyRing|KeyRing} + * to list, in the format `projects/* /locations/* /keyRings/*`. + * @param {number} [request.pageSize] + * Optional. Optional limit on the number of + * {@link google.cloud.kms.v1.ImportJob|ImportJobs} to include in the response. + * Further {@link google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be + * obtained by including the + * {@link google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} + * in a subsequent request. If unspecified, the server will pick an + * appropriate default. + * @param {string} [request.pageToken] + * Optional. Optional pagination token, returned earlier via + * {@link google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Only include resources that match the filter in the response. For + * more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @param {string} [request.orderBy] + * Optional. Specify how the results should be sorted. If not specified, the + * results will be sorted in the default order. For more information, see + * [Sorting and filtering list + * results](https://cloud.google.com/kms/docs/sorting-and-filtering). + * @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 + * [ImportJob]{@link google.cloud.kms.v1.ImportJob}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/key_management_service.list_import_jobs.js + * region_tag:cloudkms_v1_generated_KeyManagementService_ListImportJobs_async + */ + listImportJobsAsync( + request?: protos.google.cloud.kms.v1.IListImportJobsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listImportJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listImportJobs.asyncIterate( + this.innerApiCalls['listImportJobs'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as [GetPolicyOptions]{@link google.iam.v1.GetPolicyOptions} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [Policy]{@link google.iam.v1.Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ): Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ): Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @returns {string} Resource name string. + */ + cryptoKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string + ) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .location; + } + + /** + * Parse the key_ring from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .key_ring; + } + + /** + * Parse the crypto_key from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .crypto_key; + } + + /** + * Return a fully-qualified cryptoKeyVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + cryptoKeyVersionPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string, + cryptoKeyVersion: string + ) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).project; + } + + /** + * Parse the location from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).location; + } + + /** + * Parse the key_ring from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).key_ring; + } + + /** + * Parse the crypto_key from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).crypto_key; + } + + /** + * Parse the crypto_key_version from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName + ).crypto_key_version; + } + + /** + * Return a fully-qualified ekmConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} ekm_connection + * @returns {string} Resource name string. + */ + ekmConnectionPath(project: string, location: string, ekmConnection: string) { + return this.pathTemplates.ekmConnectionPathTemplate.render({ + project: project, + location: location, + ekm_connection: ekmConnection, + }); + } + + /** + * Parse the project from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName) + .project; + } + + /** + * Parse the location from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName) + .location; + } + + /** + * Parse the ekm_connection from EkmConnection resource. + * + * @param {string} ekmConnectionName + * A fully-qualified path representing EkmConnection resource. + * @returns {string} A string representing the ekm_connection. + */ + matchEkmConnectionFromEkmConnectionName(ekmConnectionName: string) { + return this.pathTemplates.ekmConnectionPathTemplate.match(ekmConnectionName) + .ekm_connection; + } + + /** + * Return a fully-qualified importJob resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} import_job + * @returns {string} Resource name string. + */ + importJobPath( + project: string, + location: string, + keyRing: string, + importJob: string + ) { + return this.pathTemplates.importJobPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + import_job: importJob, + }); + } + + /** + * Parse the project from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the project. + */ + matchProjectFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName) + .project; + } + + /** + * Parse the location from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the location. + */ + matchLocationFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName) + .location; + } + + /** + * Parse the key_ring from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName) + .key_ring; + } + + /** + * Parse the import_job from ImportJob resource. + * + * @param {string} importJobName + * A fully-qualified path representing ImportJob resource. + * @returns {string} A string representing the import_job. + */ + matchImportJobFromImportJobName(importJobName: string) { + return this.pathTemplates.importJobPathTemplate.match(importJobName) + .import_job; + } + + /** + * Return a fully-qualified keyRing resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @returns {string} Resource name string. + */ + keyRingPath(project: string, location: string, keyRing: string) { + return this.pathTemplates.keyRingPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + }); + } + + /** + * Parse the project from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the project. + */ + matchProjectFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).project; + } + + /** + * Parse the location from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the location. + */ + matchLocationFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).location; + } + + /** + * Parse the key_ring from KeyRing resource. + * + * @param {string} keyRingName + * A fully-qualified path representing KeyRing resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromKeyRingName(keyRingName: string) { + return this.pathTemplates.keyRingPathTemplate.match(keyRingName).key_ring; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified publicKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} key_ring + * @param {string} crypto_key + * @param {string} crypto_key_version + * @returns {string} Resource name string. + */ + publicKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string, + cryptoKeyVersion: string + ) { + return this.pathTemplates.publicKeyPathTemplate.render({ + project: project, + location: location, + key_ring: keyRing, + crypto_key: cryptoKey, + crypto_key_version: cryptoKeyVersion, + }); + } + + /** + * Parse the project from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .project; + } + + /** + * Parse the location from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .location; + } + + /** + * Parse the key_ring from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the key_ring. + */ + matchKeyRingFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .key_ring; + } + + /** + * Parse the crypto_key from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key. + */ + matchCryptoKeyFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .crypto_key; + } + + /** + * Parse the crypto_key_version from PublicKey resource. + * + * @param {string} publicKeyName + * A fully-qualified path representing PublicKey resource. + * @returns {string} A string representing the crypto_key_version. + */ + matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string) { + return this.pathTemplates.publicKeyPathTemplate.match(publicKeyName) + .crypto_key_version; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.keyManagementServiceStub && !this._terminated) { + return this.keyManagementServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-kms/src/v1/key_management_service_client_config.json b/packages/google-cloud-kms/src/v1/key_management_service_client_config.json new file mode 100644 index 00000000000..1ab6bc64592 --- /dev/null +++ b/packages/google-cloud-kms/src/v1/key_management_service_client_config.json @@ -0,0 +1,156 @@ +{ + "interfaces": { + "google.cloud.kms.v1.KeyManagementService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListKeyRings": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListCryptoKeys": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListCryptoKeyVersions": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListImportJobs": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetKeyRing": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetCryptoKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetPublicKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateKeyRing": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateCryptoKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ImportCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateImportJob": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCryptoKey": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateCryptoKeyPrimaryVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DestroyCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RestoreCryptoKeyVersion": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "Encrypt": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "Decrypt": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AsymmetricSign": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "AsymmetricDecrypt": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "MacSign": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "MacVerify": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GenerateRandomBytes": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-kms/src/v1/key_management_service_proto_list.json b/packages/google-cloud-kms/src/v1/key_management_service_proto_list.json new file mode 100644 index 00000000000..ad57fc558ee --- /dev/null +++ b/packages/google-cloud-kms/src/v1/key_management_service_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/kms/v1/ekm_service.proto", + "../../protos/google/cloud/kms/v1/resources.proto", + "../../protos/google/cloud/kms/v1/service.proto" +] diff --git a/packages/google-cloud-kms/system-test/.eslintrc.yml b/packages/google-cloud-kms/system-test/.eslintrc.yml new file mode 100644 index 00000000000..6db2a46c535 --- /dev/null +++ b/packages/google-cloud-kms/system-test/.eslintrc.yml @@ -0,0 +1,3 @@ +--- +env: + mocha: true diff --git a/packages/google-cloud-kms/system-test/fixtures/sample/src/index.js b/packages/google-cloud-kms/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..cc5a0983f19 --- /dev/null +++ b/packages/google-cloud-kms/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const kms = require('@google-cloud/kms'); + +function main() { + const ekmServiceClient = new kms.EkmServiceClient(); + const keyManagementServiceClient = new kms.KeyManagementServiceClient(); +} + +main(); diff --git a/packages/google-cloud-kms/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-kms/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..afdd4f93351 --- /dev/null +++ b/packages/google-cloud-kms/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,40 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {EkmServiceClient, KeyManagementServiceClient} from '@google-cloud/kms'; + +// check that the client class type name can be used +function doStuffWithEkmServiceClient(client: EkmServiceClient) { + client.close(); +} +function doStuffWithKeyManagementServiceClient( + client: KeyManagementServiceClient +) { + client.close(); +} + +function main() { + // check that the client instance can be created + const ekmServiceClient = new EkmServiceClient(); + doStuffWithEkmServiceClient(ekmServiceClient); + // check that the client instance can be created + const keyManagementServiceClient = new KeyManagementServiceClient(); + doStuffWithKeyManagementServiceClient(keyManagementServiceClient); +} + +main(); diff --git a/packages/google-cloud-kms/system-test/install.ts b/packages/google-cloud-kms/system-test/install.ts new file mode 100644 index 00000000000..6dd1eaadafa --- /dev/null +++ b/packages/google-cloud-kms/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, + }; + await packNTest(options); + }); + + it('JavaScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, + }; + await packNTest(options); + }); +}); diff --git a/packages/google-cloud-kms/test/.eslintrc.yml b/packages/google-cloud-kms/test/.eslintrc.yml new file mode 100644 index 00000000000..cd088a97818 --- /dev/null +++ b/packages/google-cloud-kms/test/.eslintrc.yml @@ -0,0 +1,3 @@ +--- +rules: + node/no-unpublished-require: off diff --git a/packages/google-cloud-kms/test/gapic_ekm_service_v1.ts b/packages/google-cloud-kms/test/gapic_ekm_service_v1.ts new file mode 100644 index 00000000000..6ef32a5acac --- /dev/null +++ b/packages/google-cloud-kms/test/gapic_ekm_service_v1.ts @@ -0,0 +1,1958 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as ekmserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.EkmServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = ekmserviceModule.v1.EkmServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = ekmserviceModule.v1.EkmServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = ekmserviceModule.v1.EkmServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new ekmserviceModule.v1.EkmServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.ekmServiceStub, undefined); + await client.initialize(); + assert(client.ekmServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.ekmServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.ekmServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new ekmserviceModule.v1.EkmServiceClient({ + 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 ekmserviceModule.v1.EkmServiceClient({ + 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('getEkmConnection', () => { + it('invokes getEkmConnection without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConnectionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetEkmConnectionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.getEkmConnection = stubSimpleCall(expectedResponse); + const [response] = await client.getEkmConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConnection without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConnectionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetEkmConnectionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.getEkmConnection = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEkmConnection( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IEkmConnection | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConnection with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConnectionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetEkmConnectionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEkmConnection = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getEkmConnection(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEkmConnection with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetEkmConnectionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetEkmConnectionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEkmConnection(request), expectedError); + }); + }); + + describe('createEkmConnection', () => { + it('invokes createEkmConnection without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateEkmConnectionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.createEkmConnection = + stubSimpleCall(expectedResponse); + const [response] = await client.createEkmConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEkmConnection without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateEkmConnectionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.createEkmConnection = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEkmConnection( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IEkmConnection | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEkmConnection with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateEkmConnectionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEkmConnection = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createEkmConnection(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEkmConnection with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateEkmConnectionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateEkmConnectionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEkmConnection(request), expectedError); + }); + }); + + describe('updateEkmConnection', () => { + it('invokes updateEkmConnection without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() + ); + request.ekmConnection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateEkmConnectionRequest', + ['ekmConnection', 'name'] + ); + request.ekmConnection.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.updateEkmConnection = + stubSimpleCall(expectedResponse); + const [response] = await client.updateEkmConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConnection without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() + ); + request.ekmConnection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateEkmConnectionRequest', + ['ekmConnection', 'name'] + ); + request.ekmConnection.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EkmConnection() + ); + client.innerApiCalls.updateEkmConnection = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEkmConnection( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IEkmConnection | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConnection with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() + ); + request.ekmConnection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateEkmConnectionRequest', + ['ekmConnection', 'name'] + ); + request.ekmConnection.name = defaultValue1; + const expectedHeaderRequestParams = `ekm_connection.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEkmConnection = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateEkmConnection(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEkmConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEkmConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEkmConnection with closed client', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateEkmConnectionRequest() + ); + request.ekmConnection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateEkmConnectionRequest', + ['ekmConnection', 'name'] + ); + request.ekmConnection.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEkmConnection(request), expectedError); + }); + }); + + describe('listEkmConnections', () => { + it('invokes listEkmConnections without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListEkmConnectionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + ]; + client.innerApiCalls.listEkmConnections = + stubSimpleCall(expectedResponse); + const [response] = await client.listEkmConnections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEkmConnections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEkmConnections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEkmConnections without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListEkmConnectionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + ]; + client.innerApiCalls.listEkmConnections = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEkmConnections( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IEkmConnection[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEkmConnections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEkmConnections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEkmConnections with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListEkmConnectionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEkmConnections = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listEkmConnections(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listEkmConnections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEkmConnections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEkmConnectionsStream without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListEkmConnectionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + ]; + client.descriptors.page.listEkmConnections.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listEkmConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.EkmConnection[] = []; + stream.on( + 'data', + (response: protos.google.cloud.kms.v1.EkmConnection) => { + 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.listEkmConnections.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEkmConnections, request) + ); + assert( + (client.descriptors.page.listEkmConnections.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listEkmConnectionsStream with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListEkmConnectionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEkmConnections.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listEkmConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.EkmConnection[] = []; + stream.on( + 'data', + (response: protos.google.cloud.kms.v1.EkmConnection) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEkmConnections.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEkmConnections, request) + ); + assert( + (client.descriptors.page.listEkmConnections.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEkmConnections without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListEkmConnectionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + generateSampleMessage(new protos.google.cloud.kms.v1.EkmConnection()), + ]; + client.descriptors.page.listEkmConnections.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.IEkmConnection[] = []; + const iterable = client.listEkmConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listEkmConnections.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEkmConnections with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListEkmConnectionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListEkmConnectionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEkmConnections.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEkmConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.IEkmConnection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listEkmConnections.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEkmConnections.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('cryptoKey', () => { + const fakePath = '/rendered/path/cryptoKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('cryptoKeyVersion', () => { + const fakePath = '/rendered/path/cryptoKeyVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + crypto_key_version: 'cryptoKeyVersionValue', + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyVersionPath', () => { + const result = client.cryptoKeyVersionPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue', + 'cryptoKeyVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.cryptoKeyVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCryptoKeyVersionName', () => { + const result = client.matchProjectFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCryptoKeyVersionName', () => { + const result = client.matchLocationFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromCryptoKeyVersionName', () => { + const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { + const result = + client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'cryptoKeyVersionValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('ekmConnection', () => { + const fakePath = '/rendered/path/ekmConnection'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + ekm_connection: 'ekmConnectionValue', + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.ekmConnectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.ekmConnectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('ekmConnectionPath', () => { + const result = client.ekmConnectionPath( + 'projectValue', + 'locationValue', + 'ekmConnectionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.ekmConnectionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEkmConnectionName', () => { + const result = client.matchProjectFromEkmConnectionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEkmConnectionName', () => { + const result = client.matchLocationFromEkmConnectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEkmConnectionFromEkmConnectionName', () => { + const result = client.matchEkmConnectionFromEkmConnectionName(fakePath); + assert.strictEqual(result, 'ekmConnectionValue'); + assert( + (client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('importJob', () => { + const fakePath = '/rendered/path/importJob'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + import_job: 'importJobValue', + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.importJobPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.importJobPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('importJobPath', () => { + const result = client.importJobPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'importJobValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.importJobPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromImportJobName', () => { + const result = client.matchProjectFromImportJobName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromImportJobName', () => { + const result = client.matchLocationFromImportJobName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromImportJobName', () => { + const result = client.matchKeyRingFromImportJobName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchImportJobFromImportJobName', () => { + const result = client.matchImportJobFromImportJobName(fakePath); + assert.strictEqual(result, 'importJobValue'); + assert( + (client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('keyRing', () => { + const fakePath = '/rendered/path/keyRing'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.keyRingPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.keyRingPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('keyRingPath', () => { + const result = client.keyRingPath( + 'projectValue', + 'locationValue', + 'keyRingValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.keyRingPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromKeyRingName', () => { + const result = client.matchProjectFromKeyRingName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromKeyRingName', () => { + const result = client.matchLocationFromKeyRingName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromKeyRingName', () => { + const result = client.matchKeyRingFromKeyRingName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('publicKey', () => { + const fakePath = '/rendered/path/publicKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + crypto_key_version: 'cryptoKeyVersionValue', + }; + const client = new ekmserviceModule.v1.EkmServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.publicKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.publicKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('publicKeyPath', () => { + const result = client.publicKeyPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue', + 'cryptoKeyVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.publicKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPublicKeyName', () => { + const result = client.matchProjectFromPublicKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPublicKeyName', () => { + const result = client.matchLocationFromPublicKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromPublicKeyName', () => { + const result = client.matchKeyRingFromPublicKeyName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyFromPublicKeyName', () => { + const result = client.matchCryptoKeyFromPublicKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyVersionFromPublicKeyName', () => { + const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyVersionValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-kms/test/gapic_key_management_service_v1.ts b/packages/google-cloud-kms/test/gapic_key_management_service_v1.ts new file mode 100644 index 00000000000..120669ccafb --- /dev/null +++ b/packages/google-cloud-kms/test/gapic_key_management_service_v1.ts @@ -0,0 +1,5543 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as keymanagementserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json') +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.KeyManagementServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + keymanagementserviceModule.v1.KeyManagementServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + keymanagementserviceModule.v1.KeyManagementServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + keymanagementserviceModule.v1.KeyManagementServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.keyManagementServiceStub, undefined); + await client.initialize(); + assert(client.keyManagementServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.keyManagementServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.keyManagementServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getKeyRing', () => { + it('invokes getKeyRing without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetKeyRingRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetKeyRingRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.KeyRing() + ); + client.innerApiCalls.getKeyRing = stubSimpleCall(expectedResponse); + const [response] = await client.getKeyRing(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getKeyRing as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKeyRing as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKeyRing without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetKeyRingRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetKeyRingRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.KeyRing() + ); + client.innerApiCalls.getKeyRing = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getKeyRing( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IKeyRing | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getKeyRing as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKeyRing as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKeyRing with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetKeyRingRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetKeyRingRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getKeyRing = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getKeyRing(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getKeyRing as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKeyRing as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKeyRing with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetKeyRingRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetKeyRingRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getKeyRing(request), expectedError); + }); + }); + + describe('getCryptoKey', () => { + it('invokes getCryptoKey without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetCryptoKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.getCryptoKey = stubSimpleCall(expectedResponse); + const [response] = await client.getCryptoKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKey without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetCryptoKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.getCryptoKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCryptoKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKey with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetCryptoKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCryptoKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getCryptoKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKey with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetCryptoKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCryptoKey(request), expectedError); + }); + }); + + describe('getCryptoKeyVersion', () => { + it('invokes getCryptoKeyVersion without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.getCryptoKeyVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.getCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKeyVersion without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.getCryptoKeyVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCryptoKeyVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKeyVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKeyVersion with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getCryptoKeyVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getCryptoKeyVersion with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getCryptoKeyVersion(request), expectedError); + }); + }); + + describe('getPublicKey', () => { + it('invokes getPublicKey without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetPublicKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.PublicKey() + ); + client.innerApiCalls.getPublicKey = stubSimpleCall(expectedResponse); + const [response] = await client.getPublicKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPublicKey without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetPublicKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.PublicKey() + ); + client.innerApiCalls.getPublicKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPublicKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IPublicKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPublicKey with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetPublicKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPublicKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getPublicKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getPublicKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPublicKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPublicKey with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetPublicKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetPublicKeyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPublicKey(request), expectedError); + }); + }); + + describe('getImportJob', () => { + it('invokes getImportJob without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetImportJobRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetImportJobRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportJob() + ); + client.innerApiCalls.getImportJob = stubSimpleCall(expectedResponse); + const [response] = await client.getImportJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetImportJobRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetImportJobRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportJob() + ); + client.innerApiCalls.getImportJob = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getImportJob( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IImportJob | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetImportJobRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetImportJobRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getImportJob = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getImportJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getImportJob with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GetImportJobRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GetImportJobRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getImportJob(request), expectedError); + }); + }); + + describe('createKeyRing', () => { + it('invokes createKeyRing without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateKeyRingRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateKeyRingRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.KeyRing() + ); + client.innerApiCalls.createKeyRing = stubSimpleCall(expectedResponse); + const [response] = await client.createKeyRing(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createKeyRing as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKeyRing as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKeyRing without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateKeyRingRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateKeyRingRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.KeyRing() + ); + client.innerApiCalls.createKeyRing = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createKeyRing( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IKeyRing | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createKeyRing as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKeyRing as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKeyRing with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateKeyRingRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateKeyRingRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createKeyRing = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createKeyRing(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createKeyRing as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKeyRing as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKeyRing with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateKeyRingRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateKeyRingRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createKeyRing(request), expectedError); + }); + }); + + describe('createCryptoKey', () => { + it('invokes createCryptoKey without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateCryptoKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.createCryptoKey = stubSimpleCall(expectedResponse); + const [response] = await client.createCryptoKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKey without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateCryptoKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.createCryptoKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCryptoKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKey with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateCryptoKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCryptoKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createCryptoKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKey with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateCryptoKeyRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createCryptoKey(request), expectedError); + }); + }); + + describe('createCryptoKeyVersion', () => { + it('invokes createCryptoKeyVersion without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.createCryptoKeyVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.createCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKeyVersion without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.createCryptoKeyVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCryptoKeyVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKeyVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKeyVersion with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createCryptoKeyVersion(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createCryptoKeyVersion with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.createCryptoKeyVersion(request), + expectedError + ); + }); + }); + + describe('importCryptoKeyVersion', () => { + it('invokes importCryptoKeyVersion without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.importCryptoKeyVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.importCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importCryptoKeyVersion without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.importCryptoKeyVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importCryptoKeyVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKeyVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importCryptoKeyVersion with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.importCryptoKeyVersion(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.importCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importCryptoKeyVersion with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.importCryptoKeyVersion(request), + expectedError + ); + }); + }); + + describe('createImportJob', () => { + it('invokes createImportJob without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateImportJobRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateImportJobRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportJob() + ); + client.innerApiCalls.createImportJob = stubSimpleCall(expectedResponse); + const [response] = await client.createImportJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateImportJobRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateImportJobRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.ImportJob() + ); + client.innerApiCalls.createImportJob = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createImportJob( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IImportJob | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateImportJobRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateImportJobRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createImportJob = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createImportJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createImportJob with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.CreateImportJobRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.CreateImportJobRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createImportJob(request), expectedError); + }); + }); + + describe('updateCryptoKey', () => { + it('invokes updateCryptoKey without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() + ); + request.cryptoKey ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyRequest', + ['cryptoKey', 'name'] + ); + request.cryptoKey.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.updateCryptoKey = stubSimpleCall(expectedResponse); + const [response] = await client.updateCryptoKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKey without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() + ); + request.cryptoKey ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyRequest', + ['cryptoKey', 'name'] + ); + request.cryptoKey.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.updateCryptoKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCryptoKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKey with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() + ); + request.cryptoKey ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyRequest', + ['cryptoKey', 'name'] + ); + request.cryptoKey.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCryptoKey = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateCryptoKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateCryptoKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKey with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() + ); + request.cryptoKey ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyRequest', + ['cryptoKey', 'name'] + ); + request.cryptoKey.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateCryptoKey(request), expectedError); + }); + }); + + describe('updateCryptoKeyVersion', () => { + it('invokes updateCryptoKeyVersion without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() + ); + request.cryptoKeyVersion ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', + ['cryptoKeyVersion', 'name'] + ); + request.cryptoKeyVersion.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.updateCryptoKeyVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.updateCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyVersion without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() + ); + request.cryptoKeyVersion ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', + ['cryptoKeyVersion', 'name'] + ); + request.cryptoKeyVersion.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.updateCryptoKeyVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCryptoKeyVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKeyVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyVersion with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() + ); + request.cryptoKeyVersion ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', + ['cryptoKeyVersion', 'name'] + ); + request.cryptoKeyVersion.name = defaultValue1; + const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateCryptoKeyVersion(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyVersion with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() + ); + request.cryptoKeyVersion ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', + ['cryptoKeyVersion', 'name'] + ); + request.cryptoKeyVersion.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateCryptoKeyVersion(request), + expectedError + ); + }); + }); + + describe('updateCryptoKeyPrimaryVersion', () => { + it('invokes updateCryptoKeyPrimaryVersion without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.updateCryptoKeyPrimaryVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.updateCryptoKeyPrimaryVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyPrimaryVersion without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKey() + ); + client.innerApiCalls.updateCryptoKeyPrimaryVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCryptoKeyPrimaryVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKey | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyPrimaryVersion with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateCryptoKeyPrimaryVersion(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateCryptoKeyPrimaryVersion with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateCryptoKeyPrimaryVersion(request), + expectedError + ); + }); + }); + + describe('destroyCryptoKeyVersion', () => { + it('invokes destroyCryptoKeyVersion without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.destroyCryptoKeyVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.destroyCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.destroyCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.destroyCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes destroyCryptoKeyVersion without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.destroyCryptoKeyVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.destroyCryptoKeyVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKeyVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.destroyCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.destroyCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes destroyCryptoKeyVersion with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.destroyCryptoKeyVersion(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.destroyCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.destroyCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes destroyCryptoKeyVersion with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.destroyCryptoKeyVersion(request), + expectedError + ); + }); + }); + + describe('restoreCryptoKeyVersion', () => { + it('invokes restoreCryptoKeyVersion without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.restoreCryptoKeyVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.restoreCryptoKeyVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreCryptoKeyVersion without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ); + client.innerApiCalls.restoreCryptoKeyVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreCryptoKeyVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKeyVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreCryptoKeyVersion with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.restoreCryptoKeyVersion(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.restoreCryptoKeyVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreCryptoKeyVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreCryptoKeyVersion with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.restoreCryptoKeyVersion(request), + expectedError + ); + }); + }); + + describe('encrypt', () => { + it('invokes encrypt without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.EncryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptResponse() + ); + client.innerApiCalls.encrypt = stubSimpleCall(expectedResponse); + const [response] = await client.encrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.encrypt as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.encrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes encrypt without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.EncryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptResponse() + ); + client.innerApiCalls.encrypt = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.encrypt( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IEncryptResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.encrypt as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.encrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes encrypt with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.EncryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.encrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.encrypt(request), expectedError); + const actualRequest = (client.innerApiCalls.encrypt as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.encrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes encrypt with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.EncryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.EncryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.encrypt(request), expectedError); + }); + }); + + describe('decrypt', () => { + it('invokes decrypt without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.DecryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptResponse() + ); + client.innerApiCalls.decrypt = stubSimpleCall(expectedResponse); + const [response] = await client.decrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.decrypt as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.decrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes decrypt without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.DecryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptResponse() + ); + client.innerApiCalls.decrypt = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.decrypt( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IDecryptResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.decrypt as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.decrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes decrypt with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.DecryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.decrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.decrypt(request), expectedError); + const actualRequest = (client.innerApiCalls.decrypt as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.decrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes decrypt with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.DecryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.DecryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.decrypt(request), expectedError); + }); + }); + + describe('asymmetricSign', () => { + it('invokes asymmetricSign without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.AsymmetricSignRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignResponse() + ); + client.innerApiCalls.asymmetricSign = stubSimpleCall(expectedResponse); + const [response] = await client.asymmetricSign(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.asymmetricSign as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.asymmetricSign as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricSign without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.AsymmetricSignRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignResponse() + ); + client.innerApiCalls.asymmetricSign = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.asymmetricSign( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IAsymmetricSignResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.asymmetricSign as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.asymmetricSign as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricSign with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.AsymmetricSignRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.asymmetricSign = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.asymmetricSign(request), expectedError); + const actualRequest = ( + client.innerApiCalls.asymmetricSign as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.asymmetricSign as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricSign with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricSignRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.AsymmetricSignRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.asymmetricSign(request), expectedError); + }); + }); + + describe('asymmetricDecrypt', () => { + it('invokes asymmetricDecrypt without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.AsymmetricDecryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() + ); + client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(expectedResponse); + const [response] = await client.asymmetricDecrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.asymmetricDecrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.asymmetricDecrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricDecrypt without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.AsymmetricDecryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() + ); + client.innerApiCalls.asymmetricDecrypt = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.asymmetricDecrypt( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IAsymmetricDecryptResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.asymmetricDecrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.asymmetricDecrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricDecrypt with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.AsymmetricDecryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.asymmetricDecrypt = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.asymmetricDecrypt(request), expectedError); + const actualRequest = ( + client.innerApiCalls.asymmetricDecrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.asymmetricDecrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes asymmetricDecrypt with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.AsymmetricDecryptRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.asymmetricDecrypt(request), expectedError); + }); + }); + + describe('macSign', () => { + it('invokes macSign without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.MacSignRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignResponse() + ); + client.innerApiCalls.macSign = stubSimpleCall(expectedResponse); + const [response] = await client.macSign(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.macSign as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.macSign as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macSign without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.MacSignRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignResponse() + ); + client.innerApiCalls.macSign = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.macSign( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IMacSignResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.macSign as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.macSign as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macSign with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.MacSignRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.macSign = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.macSign(request), expectedError); + const actualRequest = (client.innerApiCalls.macSign as SinonStub).getCall( + 0 + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.macSign as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macSign with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacSignRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.MacSignRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.macSign(request), expectedError); + }); + }); + + describe('macVerify', () => { + it('invokes macVerify without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.MacVerifyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyResponse() + ); + client.innerApiCalls.macVerify = stubSimpleCall(expectedResponse); + const [response] = await client.macVerify(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.macVerify as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.macVerify as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macVerify without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.MacVerifyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyResponse() + ); + client.innerApiCalls.macVerify = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.macVerify( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IMacVerifyResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.macVerify as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.macVerify as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macVerify with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.MacVerifyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.macVerify = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.macVerify(request), expectedError); + const actualRequest = ( + client.innerApiCalls.macVerify as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.macVerify as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes macVerify with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.MacVerifyRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.MacVerifyRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.macVerify(request), expectedError); + }); + }); + + describe('generateRandomBytes', () => { + it('invokes generateRandomBytes without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GenerateRandomBytesRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesResponse() + ); + client.innerApiCalls.generateRandomBytes = + stubSimpleCall(expectedResponse); + const [response] = await client.generateRandomBytes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateRandomBytes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateRandomBytes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateRandomBytes without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GenerateRandomBytesRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesResponse() + ); + client.innerApiCalls.generateRandomBytes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateRandomBytes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IGenerateRandomBytesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateRandomBytes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateRandomBytes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateRandomBytes with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GenerateRandomBytesRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedHeaderRequestParams = `location=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateRandomBytes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.generateRandomBytes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.generateRandomBytes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateRandomBytes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateRandomBytes with closed client', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.GenerateRandomBytesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.GenerateRandomBytesRequest', + ['location'] + ); + request.location = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.generateRandomBytes(request), expectedError); + }); + }); + + describe('listKeyRings', () => { + it('invokes listKeyRings without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListKeyRingsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + ]; + client.innerApiCalls.listKeyRings = stubSimpleCall(expectedResponse); + const [response] = await client.listKeyRings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listKeyRings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKeyRings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeyRings without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListKeyRingsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + ]; + client.innerApiCalls.listKeyRings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listKeyRings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IKeyRing[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listKeyRings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKeyRings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeyRings with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListKeyRingsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listKeyRings = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listKeyRings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listKeyRings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKeyRings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKeyRingsStream without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListKeyRingsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + ]; + client.descriptors.page.listKeyRings.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listKeyRingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.KeyRing[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listKeyRings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listKeyRings, request) + ); + assert( + (client.descriptors.page.listKeyRings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listKeyRingsStream with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListKeyRingsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listKeyRingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.KeyRing[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listKeyRings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listKeyRings, request) + ); + assert( + (client.descriptors.page.listKeyRings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKeyRings without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListKeyRingsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), + ]; + client.descriptors.page.listKeyRings.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; + const iterable = client.listKeyRingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listKeyRings.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKeyRings with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListKeyRingsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListKeyRingsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKeyRings.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listKeyRingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listKeyRings.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listCryptoKeys', () => { + it('invokes listCryptoKeys without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.innerApiCalls.listCryptoKeys = stubSimpleCall(expectedResponse); + const [response] = await client.listCryptoKeys(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCryptoKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCryptoKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeys without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.innerApiCalls.listCryptoKeys = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCryptoKeys( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKey[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCryptoKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCryptoKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeys with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCryptoKeys = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listCryptoKeys(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCryptoKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCryptoKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeysStream without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.descriptors.page.listCryptoKeys.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCryptoKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCryptoKeys, request) + ); + assert( + (client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCryptoKeysStream with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeys.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCryptoKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCryptoKeys, request) + ); + assert( + (client.descriptors.page.listCryptoKeys.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeys without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), + ]; + client.descriptors.page.listCryptoKeys.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; + const iterable = client.listCryptoKeysAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeys with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeysRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeysRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeys.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCryptoKeysAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listCryptoKeyVersions', () => { + it('invokes listCryptoKeyVersions without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + ]; + client.innerApiCalls.listCryptoKeyVersions = + stubSimpleCall(expectedResponse); + const [response] = await client.listCryptoKeyVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCryptoKeyVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCryptoKeyVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeyVersions without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + ]; + client.innerApiCalls.listCryptoKeyVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCryptoKeyVersions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.ICryptoKeyVersion[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCryptoKeyVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCryptoKeyVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeyVersions with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listCryptoKeyVersions(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listCryptoKeyVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCryptoKeyVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCryptoKeyVersionsStream without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + ]; + client.descriptors.page.listCryptoKeyVersions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCryptoKeyVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; + stream.on( + 'data', + (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listCryptoKeyVersions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listCryptoKeyVersions, request) + ); + assert( + ( + client.descriptors.page.listCryptoKeyVersions + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listCryptoKeyVersionsStream with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeyVersions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCryptoKeyVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; + stream.on( + 'data', + (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listCryptoKeyVersions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listCryptoKeyVersions, request) + ); + assert( + ( + client.descriptors.page.listCryptoKeyVersions + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeyVersions without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + generateSampleMessage( + new protos.google.cloud.kms.v1.CryptoKeyVersion() + ), + ]; + client.descriptors.page.listCryptoKeyVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; + const iterable = client.listCryptoKeyVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCryptoKeyVersions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listCryptoKeyVersions + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listCryptoKeyVersions with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCryptoKeyVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCryptoKeyVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCryptoKeyVersions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listCryptoKeyVersions + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listImportJobs', () => { + it('invokes listImportJobs without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListImportJobsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + ]; + client.innerApiCalls.listImportJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listImportJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listImportJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImportJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobs without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListImportJobsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + ]; + client.innerApiCalls.listImportJobs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listImportJobs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.kms.v1.IImportJob[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listImportJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImportJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobs with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListImportJobsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listImportJobs = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listImportJobs(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listImportJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImportJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listImportJobsStream without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListImportJobsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + ]; + client.descriptors.page.listImportJobs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listImportJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.ImportJob[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listImportJobs, request) + ); + assert( + (client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listImportJobsStream with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListImportJobsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImportJobs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listImportJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.kms.v1.ImportJob[] = []; + stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listImportJobs, request) + ); + assert( + (client.descriptors.page.listImportJobs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listImportJobs without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListImportJobsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), + ]; + client.descriptors.page.listImportJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.kms.v1.IImportJob[] = []; + const iterable = client.listImportJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listImportJobs.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listImportJobs with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.kms.v1.ListImportJobsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.kms.v1.ListImportJobsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImportJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listImportJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.kms.v1.IImportJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listImportJobs.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('cryptoKey', () => { + const fakePath = '/rendered/path/cryptoKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + }; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('cryptoKeyVersion', () => { + const fakePath = '/rendered/path/cryptoKeyVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + crypto_key_version: 'cryptoKeyVersionValue', + }; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cryptoKeyVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyVersionPath', () => { + const result = client.cryptoKeyVersionPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue', + 'cryptoKeyVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.cryptoKeyVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCryptoKeyVersionName', () => { + const result = client.matchProjectFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCryptoKeyVersionName', () => { + const result = client.matchLocationFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromCryptoKeyVersionName', () => { + const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { + const result = + client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'cryptoKeyVersionValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('ekmConnection', () => { + const fakePath = '/rendered/path/ekmConnection'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + ekm_connection: 'ekmConnectionValue', + }; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.ekmConnectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.ekmConnectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('ekmConnectionPath', () => { + const result = client.ekmConnectionPath( + 'projectValue', + 'locationValue', + 'ekmConnectionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.ekmConnectionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEkmConnectionName', () => { + const result = client.matchProjectFromEkmConnectionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEkmConnectionName', () => { + const result = client.matchLocationFromEkmConnectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEkmConnectionFromEkmConnectionName', () => { + const result = client.matchEkmConnectionFromEkmConnectionName(fakePath); + assert.strictEqual(result, 'ekmConnectionValue'); + assert( + (client.pathTemplates.ekmConnectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('importJob', () => { + const fakePath = '/rendered/path/importJob'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + import_job: 'importJobValue', + }; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.importJobPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.importJobPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('importJobPath', () => { + const result = client.importJobPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'importJobValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.importJobPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromImportJobName', () => { + const result = client.matchProjectFromImportJobName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromImportJobName', () => { + const result = client.matchLocationFromImportJobName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromImportJobName', () => { + const result = client.matchKeyRingFromImportJobName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchImportJobFromImportJobName', () => { + const result = client.matchImportJobFromImportJobName(fakePath); + assert.strictEqual(result, 'importJobValue'); + assert( + (client.pathTemplates.importJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('keyRing', () => { + const fakePath = '/rendered/path/keyRing'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + }; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.keyRingPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.keyRingPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('keyRingPath', () => { + const result = client.keyRingPath( + 'projectValue', + 'locationValue', + 'keyRingValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.keyRingPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromKeyRingName', () => { + const result = client.matchProjectFromKeyRingName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromKeyRingName', () => { + const result = client.matchLocationFromKeyRingName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromKeyRingName', () => { + const result = client.matchKeyRingFromKeyRingName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.keyRingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('publicKey', () => { + const fakePath = '/rendered/path/publicKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + crypto_key_version: 'cryptoKeyVersionValue', + }; + const client = + new keymanagementserviceModule.v1.KeyManagementServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.publicKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.publicKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('publicKeyPath', () => { + const result = client.publicKeyPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue', + 'cryptoKeyVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.publicKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromPublicKeyName', () => { + const result = client.matchProjectFromPublicKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromPublicKeyName', () => { + const result = client.matchLocationFromPublicKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKeyRingFromPublicKeyName', () => { + const result = client.matchKeyRingFromPublicKeyName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyFromPublicKeyName', () => { + const result = client.matchCryptoKeyFromPublicKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchCryptoKeyVersionFromPublicKeyName', () => { + const result = client.matchCryptoKeyVersionFromPublicKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyVersionValue'); + assert( + (client.pathTemplates.publicKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-kms/tsconfig.json b/packages/google-cloud-kms/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/packages/google-cloud-kms/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-kms/tslint.json b/packages/google-cloud-kms/tslint.json new file mode 100644 index 00000000000..617dc975bae --- /dev/null +++ b/packages/google-cloud-kms/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "gts/tslint.json" +} diff --git a/packages/google-cloud-kms/webpack.config.js b/packages/google-cloud-kms/webpack.config.js new file mode 100644 index 00000000000..93ebb309abf --- /dev/null +++ b/packages/google-cloud-kms/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: 'EkmService', + filename: './ekm-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/, + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader', + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader', + }, + ], + }, + mode: 'production', +}; diff --git a/release-please-config.json b/release-please-config.json index a9f648e2ed2..48791614588 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -53,6 +53,7 @@ "packages/google-cloud-gkeconnect-gateway": {}, "packages/google-cloud-gkehub": {}, "packages/google-cloud-gkemulticloud": {}, + "packages/google-cloud-kms": {}, "packages/google-cloud-ids": {}, "packages/google-cloud-iap": {}, "packages/google-cloud-iot": {},